Skip to content

Commit 316b035

Browse files
committed
no-validate
Signed-off-by: shmck <[email protected]>
1 parent cd0e4e9 commit 316b035

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/build.ts

+12-4
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type BuildArgs = {
2525
markdown: string;
2626
yaml: string;
2727
output: string;
28+
noValidate: boolean;
2829
};
2930

3031
async function build(args: string[]) {
@@ -41,6 +42,8 @@ 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 noValidate =
46+
getArg(args, { name: "no-validate", alias: "nv" }) !== "false";
4447

4548
console.log(`Building CodeRoad ${output}...`);
4649

@@ -49,6 +52,7 @@ async function build(args: string[]) {
4952
output,
5053
markdown,
5154
yaml,
55+
noValidate,
5256
};
5357
} catch (e) {
5458
console.error("Error parsing build logs");
@@ -139,10 +143,14 @@ async function build(args: string[]) {
139143

140144
// validate tutorial based on tutorial json schema
141145
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;
146+
if (!options.noValidate) {
147+
const valid = validateSchema(tutorialSchema, tutorial);
148+
if (!valid) {
149+
console.error(
150+
"Tutorial validation failed. See above to see what to fix"
151+
);
152+
return;
153+
}
146154
}
147155
} catch (e) {
148156
console.error("Error validating tutorial schema:");

0 commit comments

Comments
 (0)