mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 16:11:33 +08:00
Merge pull request #3535 from Keraito/use-npm
Use the --use-npm flag also for version checking
This commit is contained in:
commit
f1e2d47d03
@ -89,24 +89,24 @@ const runGenerator = () => {
|
|||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
|
||||||
case types.UPDATE_PACKAGE_ORGANIZATIONS:
|
case types.UPDATE_PACKAGE_ORGANIZATIONS:
|
||||||
return updateOrganisationsGenerator(program.parser)
|
return updateOrganisationsGenerator(program.parser, npmOptions)
|
||||||
.then(() => null) // commmandLog doesn't like to see output
|
.then(() => null) // commmandLog doesn't like to see output
|
||||||
.then(commandLog('Upgrading your project to the new storybook packages.'))
|
.then(commandLog('Upgrading your project to the new storybook packages.'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.REACT_SCRIPTS:
|
case types.REACT_SCRIPTS:
|
||||||
return reactScriptsGenerator()
|
return reactScriptsGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Create React App" based project'))
|
.then(commandLog('Adding storybook support to your "Create React App" based project'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.REACT:
|
case types.REACT:
|
||||||
return reactGenerator()
|
return reactGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "React" app'))
|
.then(commandLog('Adding storybook support to your "React" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.REACT_NATIVE_SCRIPTS: {
|
case types.REACT_NATIVE_SCRIPTS: {
|
||||||
const app = chalk.bold('"./App.js"');
|
const app = chalk.bold('"./App.js"');
|
||||||
return reactNativeScriptsGenerator()
|
return reactNativeScriptsGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Create React Native App" app'))
|
.then(commandLog('Adding storybook support to your "Create React Native App" app'))
|
||||||
.then(end)
|
.then(end)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -120,57 +120,57 @@ const runGenerator = () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case types.REACT_NATIVE:
|
case types.REACT_NATIVE:
|
||||||
return reactNativeGenerator()
|
return reactNativeGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "React Native" app'))
|
.then(commandLog('Adding storybook support to your "React Native" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.METEOR:
|
case types.METEOR:
|
||||||
return meteorGenerator()
|
return meteorGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Meteor" app'))
|
.then(commandLog('Adding storybook support to your "Meteor" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.WEBPACK_REACT:
|
case types.WEBPACK_REACT:
|
||||||
return webpackReactGenerator()
|
return webpackReactGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Webpack React" app'))
|
.then(commandLog('Adding storybook support to your "Webpack React" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.REACT_PROJECT:
|
case types.REACT_PROJECT:
|
||||||
return reactGenerator()
|
return reactGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "React" library'))
|
.then(commandLog('Adding storybook support to your "React" library'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.SFC_VUE:
|
case types.SFC_VUE:
|
||||||
return sfcVueGenerator()
|
return sfcVueGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Single File Components Vue" app'))
|
.then(commandLog('Adding storybook support to your "Single File Components Vue" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.VUE:
|
case types.VUE:
|
||||||
return vueGenerator()
|
return vueGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Vue" app'))
|
.then(commandLog('Adding storybook support to your "Vue" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.ANGULAR:
|
case types.ANGULAR:
|
||||||
return angularGenerator()
|
return angularGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Angular" app'))
|
.then(commandLog('Adding storybook support to your "Angular" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.POLYMER:
|
case types.POLYMER:
|
||||||
return polymerGenerator()
|
return polymerGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Polymer" app'))
|
.then(commandLog('Adding storybook support to your "Polymer" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.MITHRIL:
|
case types.MITHRIL:
|
||||||
return mithrilGenerator()
|
return mithrilGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Mithril" app'))
|
.then(commandLog('Adding storybook support to your "Mithril" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.MARKO:
|
case types.MARKO:
|
||||||
return markoGenerator()
|
return markoGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "Marko" app'))
|
.then(commandLog('Adding storybook support to your "Marko" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
case types.HTML:
|
case types.HTML:
|
||||||
return htmlGenerator()
|
return htmlGenerator(npmOptions)
|
||||||
.then(commandLog('Adding storybook support to your "HTML" app'))
|
.then(commandLog('Adding storybook support to your "HTML" app'))
|
||||||
.then(end);
|
.then(end);
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ import mergeDirs from 'merge-dirs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
notesVersion,
|
notesVersion,
|
||||||
@ -10,6 +10,7 @@ export default async () => {
|
|||||||
linksVersion,
|
linksVersion,
|
||||||
addonsVersion,
|
addonsVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/angular',
|
'@storybook/angular',
|
||||||
'@storybook/addon-notes',
|
'@storybook/addon-notes',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
|
@ -3,8 +3,9 @@ import path from 'path';
|
|||||||
import npmInit from '../../lib/npm_init';
|
import npmInit from '../../lib/npm_init';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [storybookVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
const [storybookVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/html',
|
'@storybook/html',
|
||||||
'babel-core',
|
'babel-core',
|
||||||
'babel-runtime'
|
'babel-runtime'
|
||||||
|
@ -2,8 +2,9 @@ import path from 'path';
|
|||||||
import mergeDirs from 'merge-dirs';
|
import mergeDirs from 'merge-dirs';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [storybookVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
const [storybookVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/marko',
|
'@storybook/marko',
|
||||||
'babel-core',
|
'babel-core',
|
||||||
'babel-runtime'
|
'babel-runtime'
|
||||||
|
@ -4,7 +4,7 @@ import JSON5 from 'json5';
|
|||||||
import mergeDirs from 'merge-dirs';
|
import mergeDirs from 'merge-dirs';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -18,6 +18,7 @@ export default async () => {
|
|||||||
presetStage1Version,
|
presetStage1Version,
|
||||||
rootSlashImportVersion,
|
rootSlashImportVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react',
|
'@storybook/react',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -4,7 +4,7 @@ import JSON5 from 'json5';
|
|||||||
import mergeDirs from 'merge-dirs';
|
import mergeDirs from 'merge-dirs';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -13,6 +13,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelPluginTransformReactJsxVersion,
|
babelPluginTransformReactJsxVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/mithril',
|
'@storybook/mithril',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -2,13 +2,14 @@ import mergeDirs from 'merge-dirs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
polymerLoaderVarion,
|
polymerLoaderVarion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/polymer',
|
'@storybook/polymer',
|
||||||
'babel-core',
|
'babel-core',
|
||||||
'babel-runtime',
|
'babel-runtime',
|
||||||
|
@ -2,7 +2,7 @@ import path from 'path';
|
|||||||
import mergeDirs from 'merge-dirs';
|
import mergeDirs from 'merge-dirs';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -11,6 +11,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react',
|
'@storybook/react',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -4,7 +4,7 @@ import shell from 'shelljs';
|
|||||||
import chalk from 'chalk';
|
import chalk from 'chalk';
|
||||||
import { getVersions, getPackageJson, writePackageJson, paddedLog } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson, paddedLog } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -14,6 +14,7 @@ export default async () => {
|
|||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
propTypesVersion,
|
propTypesVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react-native',
|
'@storybook/react-native',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -2,7 +2,7 @@ import mergeDirs from 'merge-dirs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -12,6 +12,7 @@ export default async () => {
|
|||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
propTypesVersion,
|
propTypesVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react-native',
|
'@storybook/react-native',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -3,7 +3,7 @@ import path from 'path';
|
|||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -12,6 +12,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react',
|
'@storybook/react',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
writeBabelRc,
|
writeBabelRc,
|
||||||
} from '../../lib/helpers';
|
} from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -17,6 +17,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelPresetVersion,
|
babelPresetVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/vue',
|
'@storybook/vue',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -4,15 +4,16 @@ import { spawn } from 'child-process-promise';
|
|||||||
import { packageNames } from '@storybook/codemod';
|
import { packageNames } from '@storybook/codemod';
|
||||||
import { getVersion, getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersion, getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
async function updatePackage(devDependencies, oldName, newName) {
|
async function updatePackage(devDependencies, oldName, newName, npmOptions) {
|
||||||
if (devDependencies[oldName]) {
|
if (devDependencies[oldName]) {
|
||||||
delete devDependencies[oldName];
|
delete devDependencies[oldName];
|
||||||
devDependencies[newName] = await getVersion(newName);
|
devDependencies[newName] = await getVersion(npmOptions, newName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function addPeerDependencies(packageJson) {
|
async function addPeerDependencies(packageJson, npmOptions) {
|
||||||
const [addonsVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
const [addonsVersion, babelCoreVersion, babelRuntimeVersion] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/addons',
|
'@storybook/addons',
|
||||||
'babel-core',
|
'babel-core',
|
||||||
'babel-runtime'
|
'babel-runtime'
|
||||||
@ -30,14 +31,14 @@ async function addPeerDependencies(packageJson) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function updatePackageJson() {
|
async function updatePackageJson(npmOptions) {
|
||||||
const packageJson = getPackageJson();
|
const packageJson = getPackageJson();
|
||||||
const { devDependencies } = packageJson;
|
const { devDependencies } = packageJson;
|
||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
Object.keys(packageNames).map(oldName => {
|
Object.keys(packageNames).map(oldName => {
|
||||||
const newName = packageNames[oldName];
|
const newName = packageNames[oldName];
|
||||||
return updatePackage(devDependencies, oldName, newName);
|
return updatePackage(devDependencies, oldName, newName, npmOptions);
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ async function updatePackageJson() {
|
|||||||
throw new Error('Expected to find `@kadira/[react-native]-storybook` in devDependencies');
|
throw new Error('Expected to find `@kadira/[react-native]-storybook` in devDependencies');
|
||||||
}
|
}
|
||||||
|
|
||||||
await addPeerDependencies(packageJson);
|
await addPeerDependencies(packageJson, npmOptions);
|
||||||
|
|
||||||
writePackageJson(packageJson);
|
writePackageJson(packageJson);
|
||||||
}
|
}
|
||||||
@ -66,7 +67,7 @@ function updateSourceCode(parser) {
|
|||||||
return spawn(jscodeshiftCommand, args, { stdio: 'inherit' });
|
return spawn(jscodeshiftCommand, args, { stdio: 'inherit' });
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async parser => {
|
export default async (parser, npmOptions) => {
|
||||||
await updatePackageJson();
|
await updatePackageJson(npmOptions);
|
||||||
return updateSourceCode(parser);
|
return updateSourceCode(parser);
|
||||||
};
|
};
|
||||||
|
@ -8,7 +8,7 @@ import {
|
|||||||
writeBabelRc,
|
writeBabelRc,
|
||||||
} from '../../lib/helpers';
|
} from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -17,6 +17,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelPresetVersion,
|
babelPresetVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/vue',
|
'@storybook/vue',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -2,7 +2,7 @@ import mergeDirs from 'merge-dirs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
import { getVersions, getPackageJson, writePackageJson } from '../../lib/helpers';
|
||||||
|
|
||||||
export default async () => {
|
export default async npmOptions => {
|
||||||
const [
|
const [
|
||||||
storybookVersion,
|
storybookVersion,
|
||||||
actionsVersion,
|
actionsVersion,
|
||||||
@ -11,6 +11,7 @@ export default async () => {
|
|||||||
babelCoreVersion,
|
babelCoreVersion,
|
||||||
babelRuntimeVersion,
|
babelRuntimeVersion,
|
||||||
] = await getVersions(
|
] = await getVersions(
|
||||||
|
npmOptions,
|
||||||
'@storybook/react',
|
'@storybook/react',
|
||||||
'@storybook/addon-actions',
|
'@storybook/addon-actions',
|
||||||
'@storybook/addon-links',
|
'@storybook/addon-links',
|
||||||
|
@ -9,7 +9,7 @@ import { version, devDependencies } from '../package.json';
|
|||||||
|
|
||||||
const logger = console;
|
const logger = console;
|
||||||
|
|
||||||
export async function getVersion(packageName) {
|
export async function getVersion(npmOptions, packageName) {
|
||||||
let current;
|
let current;
|
||||||
if (packageName === '@storybook/cli') {
|
if (packageName === '@storybook/cli') {
|
||||||
current = version;
|
current = version;
|
||||||
@ -19,7 +19,7 @@ export async function getVersion(packageName) {
|
|||||||
|
|
||||||
let latest;
|
let latest;
|
||||||
try {
|
try {
|
||||||
latest = await latestVersion(packageName);
|
latest = await latestVersion(npmOptions, packageName);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (current) {
|
if (current) {
|
||||||
logger.warn(`\n ${chalk.yellow(e.message)}`);
|
logger.warn(`\n ${chalk.yellow(e.message)}`);
|
||||||
@ -34,8 +34,8 @@ export async function getVersion(packageName) {
|
|||||||
return `^${versionToUse}`;
|
return `^${versionToUse}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getVersions(...packageNames) {
|
export function getVersions(npmOptions, ...packageNames) {
|
||||||
return Promise.all(packageNames.map(getVersion));
|
return Promise.all(packageNames.map(packageName => getVersion(npmOptions, packageName)));
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getPackageJson() {
|
export function getPackageJson() {
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import { spawn } from 'cross-spawn';
|
import { spawn } from 'cross-spawn';
|
||||||
import hasYarn from './has_yarn';
|
|
||||||
|
|
||||||
const packageManager = hasYarn() ? 'yarn' : 'npm';
|
export default function latestVersion(npmOptions, packageName) {
|
||||||
|
const packageManager = npmOptions.useYarn ? 'yarn' : 'npm';
|
||||||
export default function latestVersion(packageName) {
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const command = spawn(packageManager, ['info', packageName, 'version', '--json', '--silent'], {
|
const command = spawn(packageManager, ['info', packageName, 'version', '--json', '--silent'], {
|
||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user