docbrown/docs/deploy-script.js
Andy Zhao 6acd1a62aa
Use subdomain env var for Netlify deploys (#6839)
* Use new ENV var since URL is taken

* Use subdomain not domain for error msg
2020-03-25 12:34:48 -04:00

26 lines
577 B
JavaScript

const exec = require('child_process').exec;
const subdomain = process.env.subdomain;
let buildCommand;
switch (subdomain) {
case 'docs':
buildCommand = 'make';
break;
case 'storybook':
buildCommand = 'cd .. && npm install && npm run build-storybook';
break;
default:
throw `Subdomain ${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);