mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
26 lines
794 B
JavaScript
Executable File
26 lines
794 B
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/* eslint-disable */
|
|
/* This is an automated install of create-react-app & getstorybook */
|
|
|
|
const { exec } = require('child-process-promise');
|
|
const rimraf = require('rimraf');
|
|
|
|
const targetFolder = 'automated-cra-getstorybook';
|
|
|
|
const cleanDir = () => new Promise(resolve => rimraf(`./${targetFolder}`, resolve));
|
|
|
|
const craInstaller = () => exec('npm install create-react-app');
|
|
const craBoot = () => exec(`create-react-app ${targetFolder}`);
|
|
|
|
const storybookBoot = () => exec(`cd ${targetFolder} && getstorybook`);
|
|
const storybookBuild = () => exec(`cd ${targetFolder} && npm run build-storybook`);
|
|
|
|
Promise.all([craInstaller(), cleanDir()])
|
|
.then(craBoot)
|
|
.then(storybookBoot)
|
|
.then(storybookBuild)
|
|
.catch(error => {
|
|
console.log('rejected: ', error);
|
|
});
|