🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

spyre

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spyre - npm Package Compare versions

Comparing version
0.0.2
to
0.0.3
+12
bin/spyre.js
#!/usr/bin/env node
'use strict';
// Load Modules
const fs = require('fs');
const Spyre = require('../lib/spyre');
const spyre = new Spyre();
spyre.start();
'use strict';
// Load Modules
const fs = require('fs');
const glob = require('glob');
const marked = require('marked');
class Spyre {
constructor() {
// Make sure both posts/ and site/ exist
try {
fs.accessSync('./posts', fs.R_OK);
fs.accessSync('./site', fs.R_OK | fs.W_OK);
}
catch (e) {
console.error('Error. Please make sure posts/ and site/ exist and can be written to.');
}
}
init(config) {
// Configure AWS eventually
}
start() {
// Glob over posts getting all .md files
glob('posts/*.md', (er, files) => {
files.forEach((file) => {
const newName = file.replace('posts', 'site').replace('md', 'html');
// Read in the Markdown and return HTML
fs.readFile(file, 'utf8', (err, data) => {
if (err) throw err;
// Write HTML to file
fs.writeFile(newName, marked(data), (err) => {
if (err) throw err;
});
});
});
});
}
}
module.exports = Spyre;
+75
-57

@@ -5,5 +5,3 @@ <?xml version="1.0" encoding="UTF-8"?>

<list default="true" id="21e3a87a-3f89-475b-a106-f008171e38c8" name="Default" comment="">
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/index.js" />
<change type="NEW" beforePath="" afterPath="$PROJECT_DIR$/examples/posts/example_post.md" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/index.js" afterPath="$PROJECT_DIR$/index.js" />
<change type="MODIFICATION" beforePath="$PROJECT_DIR$/package.json" afterPath="$PROJECT_DIR$/package.json" />
</list>

@@ -30,18 +28,8 @@ <ignored path="spyre.iws" />

<component name="FileEditorManager">
<leaf>
<file leaf-file-name="index.js" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/index.js">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="package.json" pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="211">
<caret line="19" column="73" selection-start-line="19" selection-start-column="73" selection-end-line="19" selection-end-column="73" />
<folding />
</state>
</provider>
</entry>
</file>
<file leaf-file-name="index.js" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/examples/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="52">
<caret line="2" column="34" selection-start-line="2" selection-start-column="34" selection-end-line="2" selection-end-column="34" />
<caret line="2" column="19" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
<folding />

@@ -61,6 +49,11 @@ </state>

<option value="$PROJECT_DIR$/.eslintrc" />
<option value="$PROJECT_DIR$/package.json" />
<option value="$PROJECT_DIR$/examples/posts/example_post.md" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/lib/init.js" />
<option value="$PROJECT_DIR$/examples/index.js" />
<option value="$PROJECT_DIR$/lib/index.js" />
<option value="$PROJECT_DIR$/index.js" />
<option value="$PROJECT_DIR$/bin/spyre.js" />
<option value="$PROJECT_DIR$/lib/spyre.js" />
<option value="$PROJECT_DIR$/package.json" />
</list>

@@ -107,6 +100,6 @@ </option>

<panes>
<pane id="Scope" />
<pane id="Scratches">
<subPane />
</pane>
<pane id="Scope" />
<pane id="ProjectPane">

@@ -140,3 +133,3 @@ <subPane>

<PATH_ELEMENT>
<option name="myItemId" value="examples" />
<option name="myItemId" value="lib" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />

@@ -155,9 +148,5 @@ </PATH_ELEMENT>

<PATH_ELEMENT>
<option name="myItemId" value="examples" />
<option name="myItemId" value="bin" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
<PATH_ELEMENT>
<option name="myItemId" value="posts" />
<option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.PsiDirectoryNode" />
</PATH_ELEMENT>
</PATH>

@@ -181,2 +170,3 @@ </subPane>

<property name="JavaScriptWeakerCompletionTypeGuess" value="false" />
<property name="SearchEverywhereHistoryKey" value="pack&#9;FILE&#9;file:///Users/admin/workspace/spyre/package.json&#10;pa&#9;FILE&#9;file:///Users/admin/workspace/spyre/package.json&#10;readme&#9;FILE&#9;file:///Users/admin/workspace/spyre/README.md" />
</component>

@@ -197,2 +187,8 @@ <component name="RunManager">

<configuration default="true" type="js.build_tools.gulp" factoryName="Gulp.js">
<node-interpreter>project</node-interpreter>
<node-options />
<gulpfile />
<tasks />
<arguments />
<envs />
<method />

@@ -238,18 +234,18 @@ </configuration>

<layout>
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2494043" sideWeight="0.4948605" order="0" side_tool="false" content_ui="combo" />
<window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.2494043" sideWeight="0.4889868" order="0" side_tool="false" content_ui="combo" />
<window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="true" content_ui="tabs" />
<window_info id="npm" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2494043" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2494043" sideWeight="0.5051395" order="-1" side_tool="true" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.2494043" sideWeight="0.5110132" order="2" side_tool="true" content_ui="tabs" />
<window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
<window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
<window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />

@@ -274,14 +270,29 @@ </layout>

<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/.eslintrc.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="130">
<caret line="5" column="1" selection-start-line="5" selection-start-column="1" selection-end-line="5" selection-end-column="1" />
<folding />
<entry file="file://$PROJECT_DIR$/.eslintrc.json" />
<entry file="file://$PROJECT_DIR$/.eslintrc" />
<entry file="file://$PROJECT_DIR$/examples/posts/example_post.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="260">
<caret line="10" column="32" selection-start-line="10" selection-start-column="32" selection-end-line="10" selection-end-column="32" />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/.eslintrc">
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="208">
<caret line="8" column="88" selection-start-line="8" selection-start-column="88" selection-end-line="8" selection-end-column="88" />
<folding />
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/init.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="315">
<caret line="19" column="42" selection-start-line="19" selection-start-column="42" selection-end-line="19" selection-end-column="42" />
<state relative-caret-position="78">
<caret line="3" column="0" selection-start-line="3" selection-start-column="0" selection-end-line="3" selection-end-column="0" />
<folding />

@@ -291,6 +302,6 @@ </state>

</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<entry file="file://$PROJECT_DIR$/examples/index.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="419">
<caret line="26" column="22" selection-start-line="26" selection-start-column="22" selection-end-line="26" selection-end-column="22" />
<state relative-caret-position="182">
<caret line="7" column="0" selection-start-line="7" selection-start-column="0" selection-end-line="7" selection-end-column="0" />
<folding />

@@ -300,17 +311,14 @@ </state>

</entry>
<entry file="file://$PROJECT_DIR$/examples/posts/example_post.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="260">
<caret line="10" column="32" selection-start-line="10" selection-start-column="32" selection-end-line="10" selection-end-column="32" />
<folding />
</first_editor>
<second_editor />
<entry file="file://$PROJECT_DIR$/bin/spyre.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="286">
<caret line="11" column="14" selection-start-line="11" selection-start-column="14" selection-end-line="11" selection-end-column="14" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/examples/index.js">
<entry file="file://$PROJECT_DIR$/lib/spyre.js">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="52">
<caret line="2" column="34" selection-start-line="2" selection-start-column="34" selection-end-line="2" selection-end-column="34" />
<state relative-caret-position="312">
<caret line="12" column="28" selection-start-line="12" selection-start-column="28" selection-end-line="12" selection-end-column="28" />
<folding />

@@ -322,4 +330,14 @@ </state>

<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="211">
<caret line="19" column="73" selection-start-line="19" selection-start-column="73" selection-end-line="19" selection-end-column="73" />
<state relative-caret-position="130">
<caret line="5" column="0" selection-start-line="5" selection-start-column="0" selection-end-line="5" selection-end-column="0" />
<folding>
<element signature="e#0#23#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/package.json">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="52">
<caret line="2" column="19" selection-start-line="2" selection-start-column="19" selection-end-line="2" selection-end-column="19" />
<folding />

@@ -326,0 +344,0 @@ </state>

@@ -1,33 +0,5 @@

'use strict';
/**
* Export Spyre
*/
// Load Modules
const fs = require('fs');
const marked = require('marked');
const glob = require('glob');
// Make sure both posts/ and site/ exist
try {
fs.accessSync(__dirname + '/examples/posts', fs.R_OK);
fs.accessSync(__dirname + '/examples/site', fs.R_OK | fs.W_OK);
}
catch (e) {
console.error('Error. Please make sure posts/ and site/ exist and can be written to.');
}
// Glob over posts getting all .md files
glob('posts/*.md', (er, files) => {
files.forEach((file) => {
const newName = file.replace('posts', 'site').replace('md', 'html');
// Read in the Markdown and return HTML
fs.readFile(file, 'utf8', (err, data) => {
if (err) throw err;
// Write HTML to file
fs.writeFile(newName, marked(data), (err) => {
if (err) throw err;
});
});
});
});
module.exports = require('./lib/spyre');
{
"name": "spyre",
"version": "0.0.2",
"version": "0.0.3",
"description": "A blog-aware markdown to HTML generator",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node"
},

@@ -9,0 +10,0 @@ "repository": {

@@ -1,2 +0,9 @@

# spyre
Nothing to see here
# Spyre
This is going to be a command line tool that allows you to have a folder of Markdown files which can be transformed into a static website and deployed to AWS.
It doesn't do most of those things right now, so it's more serving as a learning opportunity!
## Contributions
If you feel like helping out, just hop on in! Feel free to create an issue or send a PR.
// Load in library
const Spyre = require('../index');
## Hello World
This is an example Markdown document.
Here is an example list:
+ One thing
+ Another Thing
+ A third thing
> Finally, here is a blockquote.
<h2 id="hello-world">Hello World</h2>
<p>This is an example Markdown document.</p>
<p>Here is an example list:</p>
<ul>
<li>One thing</li>
<li>Another Thing</li>
<li>A third thing</li>
</ul>
<blockquote>
<p>Finally, here is a blockquote.</p>
</blockquote>