File tree Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Expand file tree Collapse file tree 4 files changed +13
-10
lines changed Original file line number Diff line number Diff line change 1- # Coderoad Builder
1+ # CodeRoad Builder
22
3- Transform markdown tutorials into cr.JSON format.
3+ Transform markdown tutorials into ` coderoad.json ` format.
Original file line number Diff line number Diff line change 88 },
99 "scripts" : {
1010 "test" : " echo \" Error: no test specified\" && exit 1" ,
11- "start" : " node ./src/build.js coderoad.json ./src/README.md "
11+ "start" : " node ./src/build.js coderoad.json"
1212 },
1313 "author" : " Shawn McKay <shawn.j.mckay@gmail.com>" ,
1414 "license" : " ISC"
Original file line number Diff line number Diff line change @@ -214,14 +214,17 @@ function isValidJSON(text) {
214214 return false ;
215215 }
216216}
217- console . log ( process . argv ) ;
218217var output = process . argv [ 2 ] ;
219218if ( ! output ) {
220219 throw ( 'Pass in path to output cr.json file' ) ;
221220}
222221var input = process . argv [ 3 ] ;
223222if ( ! input ) {
224- throw ( 'Pass in path to .md file' ) ;
223+ input = './README.md' ;
224+ console . log ( `
225+ Pass in a path to your .md file, otherwise it defaults to README.md
226+ For example: npm start ./src/source.md
227+ ` ) ;
225228}
226229var result = cleanup ( build ( input ) ) ;
227230if ( ! isValidJSON ( result ) ) {
Original file line number Diff line number Diff line change 11import * as fs from 'fs' ;
2- // JSON.stringify
32
43function line ( char : string , times : number ) {
54 return new RegExp ( '^' + char + '{' + times + '}(?!#)(.*?)$' , 'gm' ) ;
@@ -14,7 +13,6 @@ var regex = {
1413 '```' : line ( '`' , 3 )
1514} ;
1615
17-
1816function isEmpty ( line : string ) : boolean {
1917 return ! line . length || ! ! line . match ( / ^ \s + ?[ \n \r ] / ) ;
2018}
@@ -264,16 +262,18 @@ function isValidJSON(text: string) {
264262 }
265263}
266264
267- console . log ( process . argv ) ;
268-
269265var output = process . argv [ 2 ] ;
270266if ( ! output ) {
271267 throw ( 'Pass in path to output cr.json file' ) ;
272268}
273269
274270var input = process . argv [ 3 ] ;
275271if ( ! input ) {
276- throw ( 'Pass in path to .md file' ) ;
272+ input = './README.md' ;
273+ console . log ( `
274+ Pass in a path to your .md file, otherwise it defaults to README.md
275+ For example: npm start ./src/source.md
276+ ` ) ;
277277}
278278
279279// Build
You can’t perform that action at this time.
0 commit comments