storybook/examples/scripts/automated-cra-storybook.js
Norbert de Langen 03c56b446c FIX linting
2017-05-19 00:43:58 +02:00

26 lines
791 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-storybook';
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);
});