Skip to content

Feature/no validate build #53

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 27, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
block tutorial validation
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jun 27, 2020
commit c965ff438a16578a286d2ca7077b49030b46fbe6
13 changes: 7 additions & 6 deletions src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type BuildArgs = {
markdown: string;
yaml: string;
output: string;
noValidate: boolean;
validate: boolean;
};

async function build(args: string[]) {
Expand All @@ -42,8 +42,9 @@ async function build(args: string[]) {
// -o --output - default coderoad.json
const output =
getArg(args, { name: "output", alias: "o" }) || "tutorial.json";
const noValidate =
getArg(args, { name: "no-validate", alias: "nv" }) !== "false";
const validate = getArg(args, { name: "validate", alias: "v" }) !== "false";

console.log("validate", validate);

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

Expand All @@ -52,7 +53,7 @@ async function build(args: string[]) {
output,
markdown,
yaml,
noValidate,
validate,
};
} catch (e) {
console.error("Error parsing build logs");
Expand Down Expand Up @@ -143,13 +144,13 @@ async function build(args: string[]) {

// validate tutorial based on tutorial json schema
try {
if (!options.noValidate) {
if (options.validate) {
const valid = validateSchema(tutorialSchema, tutorial);
if (!valid) {
console.error(
"Tutorial validation failed. See above to see what to fix"
);
return;
// continue rather than exiting early
}
}
} catch (e) {
Expand Down
1 change: 1 addition & 0 deletions src/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Usage: coderoad validate [path] [options]

Options:
--help (-h) display these help docs
--validate (-v) run tutorial schema validation. Default is true, set to false to block validation.
--clean (-c) set to false to preserve .tmp folder. Helpful for debugging

More docs at https://github.com/coderoad/coderoad-cli`);
Expand Down