Skip to content

Commit c965ff4

Browse files
committed
block tutorial validation
Signed-off-by: shmck <[email protected]>
1 parent 316b035 commit c965ff4

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

src/build.ts

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

3131
async function build(args: string[]) {
@@ -42,8 +42,9 @@ async function build(args: string[]) {
4242
// -o --output - default coderoad.json
4343
const output =
4444
getArg(args, { name: "output", alias: "o" }) || "tutorial.json";
45-
const noValidate =
46-
getArg(args, { name: "no-validate", alias: "nv" }) !== "false";
45+
const validate = getArg(args, { name: "validate", alias: "v" }) !== "false";
46+
47+
console.log("validate", validate);
4748

4849
console.log(`Building CodeRoad ${output}...`);
4950

@@ -52,7 +53,7 @@ async function build(args: string[]) {
5253
output,
5354
markdown,
5455
yaml,
55-
noValidate,
56+
validate,
5657
};
5758
} catch (e) {
5859
console.error("Error parsing build logs");
@@ -143,13 +144,13 @@ async function build(args: string[]) {
143144

144145
// validate tutorial based on tutorial json schema
145146
try {
146-
if (!options.noValidate) {
147+
if (options.validate) {
147148
const valid = validateSchema(tutorialSchema, tutorial);
148149
if (!valid) {
149150
console.error(
150151
"Tutorial validation failed. See above to see what to fix"
151152
);
152-
return;
153+
// continue rather than exiting early
153154
}
154155
}
155156
} catch (e) {

src/help.ts

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Usage: coderoad validate [path] [options]
4747
4848
Options:
4949
--help (-h) display these help docs
50+
--validate (-v) run tutorial schema validation. Default is true, set to false to block validation.
5051
--clean (-c) set to false to preserve .tmp folder. Helpful for debugging
5152
5253
More docs at https://github.com/coderoad/coderoad-cli`);

0 commit comments

Comments
 (0)