BVB Source Codes

storybook Show storybook-start.js Source code

Return Download storybook: download storybook-start.js Source code - Download storybook Source code - Type:.js
  1. #!/usr/bin/env node
  2.  
  3. import path from 'path';
  4. import program from 'commander';
  5. import shelljs from 'shelljs';
  6. import Server from '../server';
  7.  
  8. program
  9.   .option('-h, --host <host>', 'host to listen on')
  10.   .option('-p, --port <port>', 'port to listen on')
  11.   .option('-s, --secured', 'whether server is running on https')
  12.   .option('-c, --config-dir [dir-name]', 'storybook config directory')
  13.   .option('-e, --environment [environment]', 'DEVELOPMENT/PRODUCTION environment for webpack')
  14.   .option('-r, --reset-cache', 'reset react native packager')
  15.   .option('--skip-packager', 'run only storybook server')
  16.   .option('-i, --manual-id', 'allow multiple users to work with same storybook')
  17.   .parse(process.argv);
  18.  
  19. const projectDir = path.resolve();
  20. const configDir = path.resolve(program.configDir || './storybook');
  21. const listenAddr = [program.port];
  22. if (program.host) {
  23.   listenAddr.push(program.host);
  24. }
  25.  
  26. const server = new Server({
  27.   projectDir,
  28.   configDir,
  29.   environment: program.environment,
  30.   manualId: program.manualId,
  31.   secured: program.secured,
  32. });
  33.  
  34. server.listen(...listenAddr, err => {
  35.   if (err) {
  36.     throw err;
  37.   }
  38.   const address = `http://${program.host || 'localhost'}:${program.port}/`;
  39.   console.info(`\nReact Native Storybook started on => ${address}\n`);
  40. });
  41.  
  42. if (!program.skipPackager) {
  43.   const projectRoots = configDir === projectDir ? [configDir] : [configDir, projectDir];
  44.  
  45.   // RN packager
  46.   shelljs.exec(
  47.     [
  48.       'node node_modules/react-native/local-cli/cli.js start',
  49.       `--projectRoots ${projectRoots.join(',')}`,
  50.       `--root ${projectDir}`,
  51.       program.resetCache && '--reset-cache',
  52.     ]
  53.       .filter(x => x)
  54.       .join(' '),
  55.     { async: true }
  56.   );
  57. }
  58.  
downloadstorybook-start.js Source code - Download storybook Source code
Related Source Codes/Software:
ionicons - The premium icon font for Ionic ... 2017-06-07
AsyncDisplayKit - Smooth asynchronous user interfaces for iOS apps. ... 2017-06-07
lottie-android - Render After Effects animations natively on Androi... 2017-06-07
parse-server - Parse-compatible API server module for Node/Expres... 2017-06-07
prettier - Prettier is an opinionated JavaScript formatter. ... 2017-06-08
inferno - An extremely fast, React-like JavaScript library f... 2017-06-08
guetzli - Perceptual JPEG encoder 2017-06-08
cs-video-courses - List of Computer Science courses with video lectur... 2017-06-08
interviews - Everything you need to know to get the job. 2017-06-08
CRYENGINE - CRYENGINE is a powerful real-time game development... 2017-06-11
postal - 2017-06-11
reactide - Reactide is the first dedicated IDE for React web ... 2017-06-11
rkt - rkt is a pod-native container engine for Linux. It... 2017-06-11
uWebSockets - Tiny WebSockets https://for... 2017-06-11
realworld - TodoMVC for the RealWorld - Exemplary fullstack Me... 2017-06-11
goreplay - GoReplay is an open-source tool for capturing and ... 2017-06-10
pyenv - Simple Python version management 2017-06-10
redux-saga - An alternative side effect model for Redux apps ... 2017-06-10
angular-starter - 2017-06-10

 Back to top