File tree 3 files changed +12
-6
lines changed
3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -99,4 +99,4 @@ typings/
99
99
100
100
# End of https://www.gitignore.io/api/node,macos,visualstudiocode
101
101
102
- blogs /
102
+ blog /
Original file line number Diff line number Diff line change @@ -5,11 +5,17 @@ const importer = require('./importer.js')
5
5
const exporter = require ( './exporter.js' )
6
6
7
7
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 ]
10
15
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 )
13
19
}
14
20
15
21
runner ( )
Original file line number Diff line number Diff line change 5
5
"main" : " index.js" ,
6
6
"scripts" : {
7
7
"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 " ,
9
9
"test" : " echo \" Error: no test specified\" && exit 1"
10
10
},
11
11
"author" : " " ,
You can’t perform that action at this time.
0 commit comments