From 1601322fdc2749485640ed7210580953e4b67d06 Mon Sep 17 00:00:00 2001 From: hypnos Date: Sun, 13 Aug 2017 23:03:59 +0300 Subject: [PATCH 1/2] CLI: Add explicit dependencies on used plugins --- lib/cli/generators/METEOR/index.js | 2 ++ lib/cli/generators/METEOR/template/.stories/index.js | 2 +- lib/cli/generators/METEOR/template/.storybook/addons.js | 2 +- lib/cli/generators/METEOR/template/.storybook/config.js | 2 +- lib/cli/generators/REACT/index.js | 2 ++ lib/cli/generators/REACT/template/.storybook/addons.js | 2 +- lib/cli/generators/REACT/template/.storybook/config.js | 2 +- lib/cli/generators/REACT_NATIVE/index.js | 2 ++ lib/cli/generators/REACT_NATIVE/template/storybook/addons.js | 2 +- .../template/storybook/stories/Button/index.android.js | 2 +- .../REACT_NATIVE/template/storybook/stories/Button/index.ios.js | 2 +- .../REACT_NATIVE/template/storybook/stories/CenterView/index.js | 2 +- .../REACT_NATIVE/template/storybook/stories/Welcome/index.js | 2 +- .../generators/REACT_NATIVE/template/storybook/stories/index.js | 2 +- lib/cli/generators/REACT_NATIVE/template/storybook/storybook.js | 2 +- lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js | 2 ++ lib/cli/generators/REACT_SCRIPTS/index.js | 2 ++ lib/cli/generators/REACT_SCRIPTS/template/.storybook/addons.js | 2 +- lib/cli/generators/REACT_SCRIPTS/template/.storybook/config.js | 2 +- lib/cli/generators/SFC_VUE/index.js | 2 ++ lib/cli/generators/SFC_VUE/template/.storybook/addons.js | 2 +- lib/cli/generators/SFC_VUE/template/src/stories/index.js | 2 +- lib/cli/generators/VUE/index.js | 2 ++ lib/cli/generators/VUE/template/.storybook/addons.js | 2 +- lib/cli/generators/VUE/template/.storybook/config.js | 2 +- lib/cli/generators/VUE/template/stories/MyButton.js | 2 -- lib/cli/generators/VUE/template/stories/Welcome.js | 2 -- lib/cli/generators/WEBPACK_REACT/index.js | 2 ++ 28 files changed, 34 insertions(+), 22 deletions(-) diff --git a/lib/cli/generators/METEOR/index.js b/lib/cli/generators/METEOR/index.js index 1cbc30e0b187..d60bbc010ac2 100644 --- a/lib/cli/generators/METEOR/index.js +++ b/lib/cli/generators/METEOR/index.js @@ -62,6 +62,8 @@ module.exports = Promise.all([ // write the new package.json. packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${storybookVersion}`; packageJson.scripts.storybook = 'start-storybook -p 6006'; packageJson.scripts['build-storybook'] = 'build-storybook'; diff --git a/lib/cli/generators/METEOR/template/.stories/index.js b/lib/cli/generators/METEOR/template/.stories/index.js index c0062d92e548..2d21134b3223 100644 --- a/lib/cli/generators/METEOR/template/.stories/index.js +++ b/lib/cli/generators/METEOR/template/.stories/index.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React from 'react'; diff --git a/lib/cli/generators/METEOR/template/.storybook/addons.js b/lib/cli/generators/METEOR/template/.storybook/addons.js index 967b20533fe6..beadf411f7cc 100644 --- a/lib/cli/generators/METEOR/template/.storybook/addons.js +++ b/lib/cli/generators/METEOR/template/.storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; diff --git a/lib/cli/generators/METEOR/template/.storybook/config.js b/lib/cli/generators/METEOR/template/.storybook/config.js index 308cc4f3e66e..f525576eb114 100644 --- a/lib/cli/generators/METEOR/template/.storybook/config.js +++ b/lib/cli/generators/METEOR/template/.storybook/config.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import { configure } from '@storybook/react'; diff --git a/lib/cli/generators/REACT/index.js b/lib/cli/generators/REACT/index.js index 1cabab408785..9f95f1a0ac13 100644 --- a/lib/cli/generators/REACT/index.js +++ b/lib/cli/generators/REACT/index.js @@ -10,6 +10,8 @@ module.exports = latestVersion('@storybook/react').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/react'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/REACT/template/.storybook/addons.js b/lib/cli/generators/REACT/template/.storybook/addons.js index 967b20533fe6..beadf411f7cc 100644 --- a/lib/cli/generators/REACT/template/.storybook/addons.js +++ b/lib/cli/generators/REACT/template/.storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; diff --git a/lib/cli/generators/REACT/template/.storybook/config.js b/lib/cli/generators/REACT/template/.storybook/config.js index 00e315321d39..d109f0da15b1 100644 --- a/lib/cli/generators/REACT/template/.storybook/config.js +++ b/lib/cli/generators/REACT/template/.storybook/config.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import { configure } from '@storybook/react'; diff --git a/lib/cli/generators/REACT_NATIVE/index.js b/lib/cli/generators/REACT_NATIVE/index.js index e60007786675..8c67e5e34405 100644 --- a/lib/cli/generators/REACT_NATIVE/index.js +++ b/lib/cli/generators/REACT_NATIVE/index.js @@ -29,6 +29,8 @@ module.exports = latestVersion('@storybook/react-native').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/react-native'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) { const reactVersion = packageJson.dependencies.react; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/addons.js b/lib/cli/generators/REACT_NATIVE/template/storybook/addons.js index 967b20533fe6..beadf411f7cc 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/addons.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.android.js b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.android.js index 7a285bc65e46..2cae885acda5 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.android.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.android.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React, { PropTypes } from 'react'; import { TouchableNativeFeedback } from 'react-native'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.ios.js b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.ios.js index 035cacc61e99..9c32872772ab 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.ios.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Button/index.ios.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React, { PropTypes } from 'react'; import { TouchableHighlight } from 'react-native'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/CenterView/index.js b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/CenterView/index.js index e6c8fc60ee19..1ae222fc4858 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/CenterView/index.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/CenterView/index.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React, { PropTypes } from 'react'; import { View } from 'react-native'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Welcome/index.js b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Welcome/index.js index 1106a2ba934d..fd1c4d184a44 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Welcome/index.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/Welcome/index.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React, { PropTypes } from 'react'; import { View, Text } from 'react-native'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/index.js b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/index.js index 9c6dea2c0807..606feb7b6732 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/stories/index.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/stories/index.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import React from 'react'; import { Text } from 'react-native'; diff --git a/lib/cli/generators/REACT_NATIVE/template/storybook/storybook.js b/lib/cli/generators/REACT_NATIVE/template/storybook/storybook.js index 1890fc97c6e3..2e5726511e75 100644 --- a/lib/cli/generators/REACT_NATIVE/template/storybook/storybook.js +++ b/lib/cli/generators/REACT_NATIVE/template/storybook/storybook.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions, global-require */ +/* eslint-disable import/extensions, global-require */ import { AppRegistry } from 'react-native'; import { getStorybookUI, configure } from '@storybook/react-native'; diff --git a/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js b/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js index b163469d2082..eca7926a60ee 100644 --- a/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js +++ b/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js @@ -13,6 +13,8 @@ module.exports = latestVersion('@storybook/react-native').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/react-native'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) { const reactVersion = packageJson.dependencies.react; diff --git a/lib/cli/generators/REACT_SCRIPTS/index.js b/lib/cli/generators/REACT_SCRIPTS/index.js index 56a462237ace..49923ca2a472 100644 --- a/lib/cli/generators/REACT_SCRIPTS/index.js +++ b/lib/cli/generators/REACT_SCRIPTS/index.js @@ -10,6 +10,8 @@ module.exports = latestVersion('@storybook/react').then(version => { const packageJson = helpers.getPackageJson(); packageJson.devDependencies['@storybook/react'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; packageJson.scripts.storybook = 'start-storybook -p 9009'; packageJson.scripts['build-storybook'] = 'build-storybook'; diff --git a/lib/cli/generators/REACT_SCRIPTS/template/.storybook/addons.js b/lib/cli/generators/REACT_SCRIPTS/template/.storybook/addons.js index 967b20533fe6..beadf411f7cc 100644 --- a/lib/cli/generators/REACT_SCRIPTS/template/.storybook/addons.js +++ b/lib/cli/generators/REACT_SCRIPTS/template/.storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register'; import '@storybook/addon-links/register'; diff --git a/lib/cli/generators/REACT_SCRIPTS/template/.storybook/config.js b/lib/cli/generators/REACT_SCRIPTS/template/.storybook/config.js index a3e9bb446cb2..f97e6c899a04 100644 --- a/lib/cli/generators/REACT_SCRIPTS/template/.storybook/config.js +++ b/lib/cli/generators/REACT_SCRIPTS/template/.storybook/config.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import { configure } from '@storybook/react'; diff --git a/lib/cli/generators/SFC_VUE/index.js b/lib/cli/generators/SFC_VUE/index.js index 6c4752e23dda..91f9929d9f5a 100644 --- a/lib/cli/generators/SFC_VUE/index.js +++ b/lib/cli/generators/SFC_VUE/index.js @@ -10,6 +10,8 @@ module.exports = latestVersion('@storybook/vue').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/vue'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/SFC_VUE/template/.storybook/addons.js b/lib/cli/generators/SFC_VUE/template/.storybook/addons.js index 9a07f194721e..4cfa4a658d52 100644 --- a/lib/cli/generators/SFC_VUE/template/.storybook/addons.js +++ b/lib/cli/generators/SFC_VUE/template/.storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register' import '@storybook/addon-links/register' diff --git a/lib/cli/generators/SFC_VUE/template/src/stories/index.js b/lib/cli/generators/SFC_VUE/template/src/stories/index.js index 8e7b6d7a7383..94c5b20ad726 100644 --- a/lib/cli/generators/SFC_VUE/template/src/stories/index.js +++ b/lib/cli/generators/SFC_VUE/template/src/stories/index.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import { storiesOf } from '@storybook/vue'; import { action } from '@storybook/addon-actions'; diff --git a/lib/cli/generators/VUE/index.js b/lib/cli/generators/VUE/index.js index 6c4752e23dda..91f9929d9f5a 100644 --- a/lib/cli/generators/VUE/index.js +++ b/lib/cli/generators/VUE/index.js @@ -10,6 +10,8 @@ module.exports = latestVersion('@storybook/vue').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/vue'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/VUE/template/.storybook/addons.js b/lib/cli/generators/VUE/template/.storybook/addons.js index 9a07f194721e..4cfa4a658d52 100644 --- a/lib/cli/generators/VUE/template/.storybook/addons.js +++ b/lib/cli/generators/VUE/template/.storybook/addons.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import '@storybook/addon-actions/register' import '@storybook/addon-links/register' diff --git a/lib/cli/generators/VUE/template/.storybook/config.js b/lib/cli/generators/VUE/template/.storybook/config.js index 3ba740c5ae71..f30732660180 100644 --- a/lib/cli/generators/VUE/template/.storybook/config.js +++ b/lib/cli/generators/VUE/template/.storybook/config.js @@ -1,4 +1,4 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ +/* eslint-disable import/extensions */ import { configure } from '@storybook/vue' diff --git a/lib/cli/generators/VUE/template/stories/MyButton.js b/lib/cli/generators/VUE/template/stories/MyButton.js index 1a6cc9c997e2..aea1ebbf27f7 100644 --- a/lib/cli/generators/VUE/template/stories/MyButton.js +++ b/lib/cli/generators/VUE/template/stories/MyButton.js @@ -1,5 +1,3 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ - export default { name: 'my-button', diff --git a/lib/cli/generators/VUE/template/stories/Welcome.js b/lib/cli/generators/VUE/template/stories/Welcome.js index 1a5651f76fce..040c367a04e6 100644 --- a/lib/cli/generators/VUE/template/stories/Welcome.js +++ b/lib/cli/generators/VUE/template/stories/Welcome.js @@ -1,5 +1,3 @@ -/* eslint-disable import/no-extraneous-dependencies, import/no-unresolved, import/extensions */ - const log = () => console.log('Welcome to storybook!') export default { diff --git a/lib/cli/generators/WEBPACK_REACT/index.js b/lib/cli/generators/WEBPACK_REACT/index.js index 1cabab408785..9f95f1a0ac13 100644 --- a/lib/cli/generators/WEBPACK_REACT/index.js +++ b/lib/cli/generators/WEBPACK_REACT/index.js @@ -10,6 +10,8 @@ module.exports = latestVersion('@storybook/react').then(version => { packageJson.devDependencies = packageJson.devDependencies || {}; packageJson.devDependencies['@storybook/react'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; From 24df8433099dc88f720cb7adceb3da7c6ba9c029 Mon Sep 17 00:00:00 2001 From: hypnos Date: Thu, 17 Aug 2017 02:24:56 +0300 Subject: [PATCH 2/2] Detect each latest version independently --- lib/cli/generators/METEOR/index.js | 8 ++++++-- lib/cli/generators/REACT/index.js | 12 ++++++++---- lib/cli/generators/REACT_NATIVE/index.js | 12 ++++++++---- lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js | 12 ++++++++---- lib/cli/generators/REACT_SCRIPTS/index.js | 12 ++++++++---- lib/cli/generators/SFC_VUE/index.js | 12 ++++++++---- lib/cli/generators/VUE/index.js | 12 ++++++++---- lib/cli/generators/WEBPACK_REACT/index.js | 12 ++++++++---- 8 files changed, 62 insertions(+), 30 deletions(-) diff --git a/lib/cli/generators/METEOR/index.js b/lib/cli/generators/METEOR/index.js index d60bbc010ac2..be1183468cd7 100644 --- a/lib/cli/generators/METEOR/index.js +++ b/lib/cli/generators/METEOR/index.js @@ -7,6 +7,8 @@ const latestVersion = require('latest-version'); module.exports = Promise.all([ latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), latestVersion('react'), latestVersion('react-dom'), latestVersion('babel-preset-es2015'), @@ -18,6 +20,8 @@ module.exports = Promise.all([ ( [ storybookVersion, + actionsVersion, + linksVersion, reactVersion, reactDomVersion, presetEs2015Version, @@ -62,8 +66,8 @@ module.exports = Promise.all([ // write the new package.json. packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${storybookVersion}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts.storybook = 'start-storybook -p 6006'; packageJson.scripts['build-storybook'] = 'build-storybook'; diff --git a/lib/cli/generators/REACT/index.js b/lib/cli/generators/REACT/index.js index 9f95f1a0ac13..8fe1dd2e2591 100644 --- a/lib/cli/generators/REACT/index.js +++ b/lib/cli/generators/REACT/index.js @@ -3,15 +3,19 @@ const helpers = require('../../lib/helpers'); const path = require('path'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/react').then(version => { +module.exports = Promise.all([ + latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite'); const packageJson = helpers.getPackageJson(); packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/react'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/REACT_NATIVE/index.js b/lib/cli/generators/REACT_NATIVE/index.js index 8c67e5e34405..b4d4f66152d0 100644 --- a/lib/cli/generators/REACT_NATIVE/index.js +++ b/lib/cli/generators/REACT_NATIVE/index.js @@ -5,7 +5,11 @@ const latestVersion = require('latest-version'); const chalk = require('chalk'); const helpers = require('../../lib/helpers'); -module.exports = latestVersion('@storybook/react-native').then(version => { +module.exports = Promise.all([ + latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { // copy all files from the template directory to project directory mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite'); @@ -28,9 +32,9 @@ module.exports = latestVersion('@storybook/react-native').then(version => { packageJson.dependencies = packageJson.dependencies || {}; packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/react-native'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) { const reactVersion = packageJson.dependencies.react; diff --git a/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js b/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js index eca7926a60ee..2a15f05a12f3 100644 --- a/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js +++ b/lib/cli/generators/REACT_NATIVE_SCRIPTS/index.js @@ -3,7 +3,11 @@ const helpers = require('../../lib/helpers'); const path = require('path'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/react-native').then(version => { +module.exports = Promise.all([ + latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { // copy all files from the template directory to project directory mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite'); @@ -12,9 +16,9 @@ module.exports = latestVersion('@storybook/react-native').then(version => { packageJson.dependencies = packageJson.dependencies || {}; packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/react-native'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; if (!packageJson.dependencies['react-dom'] && !packageJson.devDependencies['react-dom']) { const reactVersion = packageJson.dependencies.react; diff --git a/lib/cli/generators/REACT_SCRIPTS/index.js b/lib/cli/generators/REACT_SCRIPTS/index.js index 49923ca2a472..63dd0da7c85a 100644 --- a/lib/cli/generators/REACT_SCRIPTS/index.js +++ b/lib/cli/generators/REACT_SCRIPTS/index.js @@ -4,14 +4,18 @@ const path = require('path'); const fs = require('fs'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/react').then(version => { +module.exports = Promise.all([ + latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite'); const packageJson = helpers.getPackageJson(); - packageJson.devDependencies['@storybook/react'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts.storybook = 'start-storybook -p 9009'; packageJson.scripts['build-storybook'] = 'build-storybook'; diff --git a/lib/cli/generators/SFC_VUE/index.js b/lib/cli/generators/SFC_VUE/index.js index 91f9929d9f5a..5b8fb90f0b66 100644 --- a/lib/cli/generators/SFC_VUE/index.js +++ b/lib/cli/generators/SFC_VUE/index.js @@ -3,15 +3,19 @@ const helpers = require('../../lib/helpers'); const path = require('path'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/vue').then(version => { +module.exports = Promise.all([ + latestVersion('@storybook/vue'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { mergeDirs(path.resolve(__dirname, 'template'), '.', 'overwrite'); const packageJson = helpers.getPackageJson(); packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/vue'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/vue'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/VUE/index.js b/lib/cli/generators/VUE/index.js index 91f9929d9f5a..206472a23630 100644 --- a/lib/cli/generators/VUE/index.js +++ b/lib/cli/generators/VUE/index.js @@ -3,15 +3,19 @@ const helpers = require('../../lib/helpers'); const path = require('path'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/vue').then(version => { +Promise.all([ + latestVersion('@storybook/vue'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { mergeDirs(path.resolve(__dirname, 'template'), '.', 'overwrite'); const packageJson = helpers.getPackageJson(); packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/vue'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/vue'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006'; diff --git a/lib/cli/generators/WEBPACK_REACT/index.js b/lib/cli/generators/WEBPACK_REACT/index.js index 9f95f1a0ac13..bc9be259b839 100644 --- a/lib/cli/generators/WEBPACK_REACT/index.js +++ b/lib/cli/generators/WEBPACK_REACT/index.js @@ -3,15 +3,19 @@ const helpers = require('../../lib/helpers'); const path = require('path'); const latestVersion = require('latest-version'); -module.exports = latestVersion('@storybook/react').then(version => { +Promise.all([ + latestVersion('@storybook/react'), + latestVersion('@storybook/addon-actions'), + latestVersion('@storybook/addon-links'), +]).then(([storybookVersion, actionsVersion, linksVersion]) => { mergeDirs(path.resolve(__dirname, 'template/'), '.', 'overwrite'); const packageJson = helpers.getPackageJson(); packageJson.devDependencies = packageJson.devDependencies || {}; - packageJson.devDependencies['@storybook/react'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-actions'] = `^${version}`; - packageJson.devDependencies['@storybook/addon-links'] = `^${version}`; + packageJson.devDependencies['@storybook/react'] = `^${storybookVersion}`; + packageJson.devDependencies['@storybook/addon-actions'] = `^${actionsVersion}`; + packageJson.devDependencies['@storybook/addon-links'] = `^${linksVersion}`; packageJson.scripts = packageJson.scripts || {}; packageJson.scripts.storybook = 'start-storybook -p 6006';