docbrown/docs/deploy-script.js
Andy Zhao dd62a321d1 Add Setup for storybook.dev.to (#3885)
* 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
2019-09-03 16:49:37 -04:00

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);