Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite5ab4fc

Browse files
authored
Merge pull request#53 from coderoad/feature/no-validate-build
Feature/no validate build
2 parentscd0e4e9 +62de1ba commite5ab4fc

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

‎src/build.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type BuildArgs = {
2525
markdown:string;
2626
yaml:string;
2727
output:string;
28+
validate:boolean;
2829
};
2930

3031
asyncfunctionbuild(args:string[]){
@@ -41,6 +42,9 @@ async function build(args: string[]) {
4142
// -o --output - default coderoad.json
4243
constoutput=
4344
getArg(args,{name:"output",alias:"o"})||"tutorial.json";
45+
constvalidate=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-
constvalid=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+
constvalid=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:");

‎src/help.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ export function build() {
3232
Usage: coderoad build [path] [options]
3333
3434
Options:
35-
--help (-h) display these help docs
36-
--markdown (-m) custom path to the tutorial markdown file(TUTORIAL.md)
37-
--yaml (-y) custom path to the tutorial yaml file(coderoad.yaml)
38-
--output (-o) custom path to tutorial json config file(coderoad.json)
35+
--help (-h)display these help docs
36+
--markdown (-m)(TUTORIAL.md)custom path to the tutorial markdown file
37+
--yaml (-y)(coderoad.yaml)custom path to the tutorial yaml file
38+
--output (-o)(coderoad.json)custom path to tutorial json config file
3939
4040
More docs at https://github.com/coderoad/coderoad-cli`);
4141
}
@@ -46,8 +46,9 @@ export function validate() {
4646
Usage: coderoad validate [path] [options]
4747
4848
Options:
49-
--help (-h) display these help docs
50-
--clean (-c) set to false to preserve .tmp folder. Helpful for debugging
49+
--help (-h) display these help docs
50+
--validate (-v) (true) run tutorial schema validation. Set to false to block validation.
51+
--clean (-c) (false) set to false to preserve .tmp folder. Helpful for debugging
5152
5253
More docs at https://github.com/coderoad/coderoad-cli`);
5354
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp