File tree Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Expand file tree Collapse file tree 3 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -99,4 +99,4 @@ typings/
9999
100100# End of https://www.gitignore.io/api/node,macos,visualstudiocode
101101
102- blogs /
102+ blog /
Original file line number Diff line number Diff line change @@ -5,11 +5,17 @@ const importer = require('./importer.js')
55const exporter = require ( './exporter.js' )
66
77const 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
1521runner ( )
Original file line number Diff line number Diff line change 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" : " " ,
You can’t perform that action at this time.
0 commit comments