@@ -25,6 +25,7 @@ type BuildArgs = {
25
25
markdown : string ;
26
26
yaml : string ;
27
27
output : string ;
28
+ validate : boolean ;
28
29
} ;
29
30
30
31
async function build ( args : string [ ] ) {
@@ -41,6 +42,9 @@ async function build(args: string[]) {
41
42
// -o --output - default coderoad.json
42
43
const output =
43
44
getArg ( args , { name : "output" , alias : "o" } ) || "tutorial.json" ;
45
+ const validate = getArg ( args , { name : "validate" , alias : "v" } ) !== "false" ;
46
+
47
+ console . log ( "validate" , validate ) ;
44
48
45
49
console . log ( `Building CodeRoad ${ output } ...` ) ;
46
50
@@ -49,6 +53,7 @@ async function build(args: string[]) {
49
53
output,
50
54
markdown,
51
55
yaml,
56
+ validate,
52
57
} ;
53
58
} catch ( e ) {
54
59
console . error ( "Error parsing build logs" ) ;
@@ -139,10 +144,14 @@ async function build(args: string[]) {
139
144
140
145
// validate tutorial based on tutorial json schema
141
146
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
+ }
146
155
}
147
156
} catch ( e ) {
148
157
console . error ( "Error validating tutorial schema:" ) ;
0 commit comments