Skip to content

Commit

Permalink
fix(upgrade): dont upgrade nx packages
Browse files Browse the repository at this point in the history
  • Loading branch information
mandarini committed May 5, 2023
1 parent 91b4484 commit 5aa1ea5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions code/lib/cli/src/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const excludeList = [
'@storybook/test-runner',
'@storybook/testing-library',
'@storybook/testing-react',
'@nrwl/storybook',
'@nx/storybook',
];
export const isCorePackage = (pkg: string) =>
pkg.startsWith('@storybook/') &&
Expand Down Expand Up @@ -135,6 +137,19 @@ export const addExtraFlags = (
);
};

const addNxPackagesToReject = (flags: string[]) => {
const newFlags = [...flags];
if (flags.indexOf('--reject') > -1) {
newFlags[flags.indexOf('--reject') + 1] = `${
flags[flags.indexOf('--reject') + 1]
},@nrwl/storybook,@nx/storybook`;
} else {
newFlags.push('--reject');
newFlags.push('@nrwl/storybook,@nx/storybook');
}
return newFlags;
};

export interface UpgradeOptions {
tag: string;
prerelease: boolean;
Expand Down Expand Up @@ -190,6 +205,7 @@ export const doUpgrade = async ({
flags.push('--target');
flags.push(target);
flags = addExtraFlags(EXTRA_FLAGS, flags, packageManager.retrievePackageJson());
flags = addNxPackagesToReject(flags);
const check = spawnSync('npx', ['npm-check-updates@latest', '/storybook/', ...flags], {
stdio: 'pipe',
shell: true,
Expand Down

0 comments on commit 5aa1ea5

Please sign in to comment.