Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix the CI by adding a resolution for the broken release of enhanced resolve, and also overriding the dep version of types/node on sandboxes so that they may be linked #19936

Merged
merged 1 commit into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion code/lib/cli/src/link.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fse from 'fs-extra';
import fse, { readJSON, writeJSON } from 'fs-extra';
import path from 'path';
import { sync as spawnSync } from 'cross-spawn';
import { logger } from '@storybook/node-logger';
Expand Down Expand Up @@ -51,6 +51,12 @@ export const link = async ({ target, local, start }: LinkOptions) => {
logger.info(`Linking ${reproDir}`);
await exec(`yarn link --all ${storybookDir}`, { cwd: reproDir });

// TODO remove this once https://github.com/webpack/enhanced-resolve/issues/362 is resolved
const packageJsonPath = path.join(reproDir, 'package.json');
const packageJson = await readJSON(packageJsonPath);
packageJson.resolutions = { ...packageJson.resolutions, 'enhanced-resolve': '~5.10.0' };
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });

logger.info(`Installing ${reproName}`);
await exec(`yarn install`, { cwd: reproDir });

Expand All @@ -60,6 +66,9 @@ export const link = async ({ target, local, start }: LinkOptions) => {
);
await exec(`yarn add -D webpack-hot-middleware`, { cwd: reproDir });

// ensure that linking is possible
await exec(`yarn add @types/node@16`, { cwd: reproDir });

if (start) {
logger.info(`Running ${reproName} storybook`);
await exec(`yarn run storybook`, { cwd: reproDir });
Expand Down
2 changes: 1 addition & 1 deletion scripts/utils/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const addPackageResolutions = async ({ cwd, dryRun }: YarnOptions) => {

const packageJsonPath = path.join(cwd, 'package.json');
const packageJson = await readJSON(packageJsonPath);
packageJson.resolutions = storybookVersions;
packageJson.resolutions = { ...storybookVersions, 'enhanced-resolve': '~5.10.0' };
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
};

Expand Down