feature: handle multiple configs

This commit is contained in:
Jean-Baptiste Pasquier
2020-12-14 11:24:35 +01:00
parent 7b87f436a0
commit deb3b25520
7 changed files with 169 additions and 116 deletions

View File

@ -2,7 +2,7 @@ const HTMLAsset = require('parcel-bundler/lib/assets/HTMLAsset')
function shouldIgnore (file) {
// Ignore img(src="${...}") on pug & keep the components folder pristine
return /\${.+}/.test(file) || /components/.test(file);
return /\${.+}/.test(file) || /components/.test(file) || /\/lib\/solid-/.test(file);
}
class SkipStartinbloxWidgetAsset extends HTMLAsset {

View File

@ -26,12 +26,14 @@ const options = {
};
(async function() {
if(!fs.existsSync("config.json")) throw "[Error] (Mandatory) Missing config.json file";
let configPath = process.env.CONFIG_PATH || 'config.json';
if(!fs.existsSync(configPath)) throw `[Error] (Mandatory) Missing ${configPath} file`;
console.log(`Using ${configPath} config file`);
let config = JSON.parse(fs.readFileSync('config.json'));
let config = JSON.parse(fs.readFileSync(configPath));
if(!config.clientName) throw "[Error] (Mandatory) Missing clientName on config.json";
if(!config.clientLogo) throw "[Error] (Mandatory) Missing clientLogo on config.json";
if(!config.clientName) throw `[Error] (Mandatory) Missing clientName on ${configPath}`;
if(!config.clientLogo) throw `[Error] (Mandatory) Missing clientLogo on ${configPath}`;
let manifest = {
"lang": "fr",