mirror of
https://github.com/Redocly/redoc.git
synced 2025-04-25 11:13:52 +03:00
fix(cli): return 1 as exit code if an error happens in the cli (#516)
This commit is contained in:
parent
ac7372be6f
commit
720c304484
12
cli/index.ts
12
cli/index.ts
|
@ -60,16 +60,12 @@ YargsParser.command(
|
||||||
return yargs;
|
return yargs;
|
||||||
},
|
},
|
||||||
async argv => {
|
async argv => {
|
||||||
try {
|
|
||||||
await serve(argv.port, argv.spec, {
|
await serve(argv.port, argv.spec, {
|
||||||
ssr: argv.ssr,
|
ssr: argv.ssr,
|
||||||
watch: argv.watch,
|
watch: argv.watch,
|
||||||
templateFileName: argv.template,
|
templateFileName: argv.template,
|
||||||
redocOptions: argv.options || {},
|
redocOptions: argv.options || {},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.log(e.stack);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.command(
|
.command(
|
||||||
|
@ -103,7 +99,6 @@ YargsParser.command(
|
||||||
return yargs;
|
return yargs;
|
||||||
},
|
},
|
||||||
async argv => {
|
async argv => {
|
||||||
try {
|
|
||||||
await bundle(argv.spec, {
|
await bundle(argv.spec, {
|
||||||
ssr: true,
|
ssr: true,
|
||||||
output: argv.o,
|
output: argv.o,
|
||||||
|
@ -112,9 +107,6 @@ YargsParser.command(
|
||||||
templateFileName: argv.template,
|
templateFileName: argv.template,
|
||||||
redocOptions: argv.options || {},
|
redocOptions: argv.options || {},
|
||||||
});
|
});
|
||||||
} catch (e) {
|
|
||||||
console.log(e.message);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
.demandCommand()
|
.demandCommand()
|
||||||
|
@ -125,6 +117,10 @@ YargsParser.command(
|
||||||
})
|
})
|
||||||
.options('options', {
|
.options('options', {
|
||||||
describe: 'ReDoc options, use dot notation, e.g. options.nativeScrollbars',
|
describe: 'ReDoc options, use dot notation, e.g. options.nativeScrollbars',
|
||||||
|
})
|
||||||
|
.fail((message, error) => {
|
||||||
|
console.log(error.stack);
|
||||||
|
process.exit(1);
|
||||||
}).argv;
|
}).argv;
|
||||||
|
|
||||||
async function serve(port: number, pathToSpec: string, options: Options = {}) {
|
async function serve(port: number, pathToSpec: string, options: Options = {}) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user