cicd: exit code

This commit is contained in:
Jean-Baptiste Pasquier 2021-03-08 15:34:34 +01:00
parent ccc9d24d09
commit d2b19ac6c8

View File

@ -25,9 +25,9 @@ const options = {
autoInstall: true
};
(async function() {
((async function () {
let configPath = process.env.CONFIG_PATH || 'config.json';
if(!fs.existsSync(configPath)) throw `[Error] (Mandatory) Missing ${configPath} file`;
if (!fs.existsSync(configPath)) throw console.error(Error(`(Mandatory) Missing ${configPath} file`));
console.log(`Using ${configPath} config file`);
let config = JSON.parse(fs.readFileSync(configPath));
@ -68,9 +68,11 @@ const options = {
const bundler = new Bundler('./src/index.pug', options);
bundler.addAssetType('html', require.resolve('./assets.js'));
if(process.env.NODE_ENV !== 'production') {
if (process.env.NODE_ENV !== 'production') {
await bundler.serve();
} else {
await bundler.bundle();
}
})();
})()).catch((e) => {
process.exitCode = 1;
});