* WIP test custom deploy script * Add console logs * Use common JS require instead of import * WIP * Use proper names * Move back one directory...? * Add npm install? * Remove console logs * Refactor a bit
26 lines
610 B
JavaScript
26 lines
610 B
JavaScript
const exec = require('child_process').exec;
|
|
const subdomain = process.env.URL;
|
|
|
|
let buildCommand;
|
|
switch (subdomain) {
|
|
case 'docs':
|
|
buildCommand = 'npm install -g gitdocs@latest && gitdocs build';
|
|
break;
|
|
case 'storybook':
|
|
buildCommand = 'cd .. && npm install && npm run build-storybook';
|
|
break;
|
|
default:
|
|
throw `Domain ${subdomain} is invalid`;
|
|
}
|
|
|
|
async function execute(command) {
|
|
return await exec(command, function(error, stdout, stderr) {
|
|
if (error) {
|
|
throw error;
|
|
}
|
|
console.log(`domain: ${subdomain}`);
|
|
console.log(stdout);
|
|
});
|
|
}
|
|
|
|
execute(buildCommand);
|