@@ -25,6 +25,7 @@ type BuildArgs = {
2525 markdown : string ;
2626 yaml : string ;
2727 output : string ;
28+ validate : boolean ;
2829} ;
2930
3031async function build ( args : string [ ] ) {
@@ -41,6 +42,9 @@ async function build(args: string[]) {
4142 // -o --output - default coderoad.json
4243 const output =
4344 getArg ( args , { name : "output" , alias : "o" } ) || "tutorial.json" ;
45+ const validate = getArg ( args , { name : "validate" , alias : "v" } ) !== "false" ;
46+
47+ console . log ( "validate" , validate ) ;
4448
4549 console . log ( `Building CodeRoad ${ output } ...` ) ;
4650
@@ -49,6 +53,7 @@ async function build(args: string[]) {
4953 output,
5054 markdown,
5155 yaml,
56+ validate,
5257 } ;
5358 } catch ( e ) {
5459 console . error ( "Error parsing build logs" ) ;
@@ -139,10 +144,14 @@ async function build(args: string[]) {
139144
140145 // validate tutorial based on tutorial json schema
141146 try {
142- const valid = validateSchema ( tutorialSchema , tutorial ) ;
143- if ( ! valid ) {
144- console . error ( "Tutorial validation failed. See above to see what to fix" ) ;
145- return ;
147+ if ( options . validate ) {
148+ const valid = validateSchema ( tutorialSchema , tutorial ) ;
149+ if ( ! valid ) {
150+ console . error (
151+ "Tutorial validation failed. See above to see what to fix"
152+ ) ;
153+ // continue rather than exiting early
154+ }
146155 }
147156 } catch ( e ) {
148157 console . error ( "Error validating tutorial schema:" ) ;
0 commit comments