Skip to content

Commit ccd5f2a

Browse files
committed
Root folder name now parameter
1 parent 842eec0 commit ccd5f2a

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,4 +99,4 @@ typings/
9999

100100
# End of https://www.gitignore.io/api/node,macos,visualstudiocode
101101

102-
blogs/
102+
blog/

index.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@ const importer = require('./importer.js')
55
const exporter = require('./exporter.js')
66

77
const runner = async () => {
8-
const inputFile = args._[0]
9-
const file = fs.readFileSync(inputFile, 'utf8')
8+
if (args._.length < 2) {
9+
console.error('Expects at least input file as first parameter, and export directory as second.')
10+
process.exit()
11+
}
12+
13+
const inputFilePath = args._[0]
14+
const outputDir = args._[1]
1015

11-
const posts = await importer.importPosts(file)
12-
await exporter.exportPosts(posts, 'blogs')
16+
const inputFile = fs.readFileSync(inputFilePath, 'utf8')
17+
const posts = await importer.importPosts(inputFile)
18+
await exporter.exportPosts(posts, outputDir)
1319
}
1420

1521
runner()

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"main": "index.js",
66
"scripts": {
77
"start": "node index.js",
8-
"debug": "node --nolazy --inspect-brk=9229 index.js squarespace.xml",
8+
"debug": "node --nolazy --inspect-brk=9229 index.js squarespace.xml blog",
99
"test": "echo \"Error: no test specified\" && exit 1"
1010
},
1111
"author": "",

0 commit comments

Comments
 (0)