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
This commit is contained in:
parent
07ba4d8b2b
commit
dd62a321d1
2 changed files with 27 additions and 1 deletions
26
docs/deploy-script.js
Normal file
26
docs/deploy-script.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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);
|
||||
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
[build]
|
||||
base = "docs/"
|
||||
command = "make"
|
||||
command = "node deploy-script.js"
|
||||
|
||||
[[redirects]]
|
||||
from = "http://docs.dev.to"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue