Skip to content

Commit

Permalink
Merge pull request #29723 from storybookjs/yann/downgrade-to-vite-5
Browse files Browse the repository at this point in the history
Build: Temporarily downgrade Vite to v5 in sandboxes
  • Loading branch information
yannbf authored Nov 27, 2024
2 parents eb8007f + 182c509 commit 5a27290
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -986,30 +986,30 @@ workflows:
requires:
- build
- create-sandboxes:
parallelism: 37
parallelism: 38
requires:
- build
# - smoke-test-sandboxes: # disabled for now
# requires:
# - create-sandboxes
- build-sandboxes:
parallelism: 37
parallelism: 38
requires:
- create-sandboxes
- chromatic-sandboxes:
parallelism: 34
parallelism: 35
requires:
- build-sandboxes
- e2e-production:
parallelism: 32
parallelism: 33
requires:
- build-sandboxes
- e2e-dev:
parallelism: 2
requires:
- create-sandboxes
- test-runner-production:
parallelism: 32
parallelism: 33
requires:
- build-sandboxes
- vitest-integration:
Expand Down
3 changes: 1 addition & 2 deletions code/lib/cli-storybook/src/sandbox-templates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -853,8 +853,7 @@ export const daily: TemplateKey[] = [
'html-vite/default-js',
'internal/react16-webpack',
'internal/react18-webpack-babel',
// TODO: bring this back once ts-docgen supports Vite 6
// 'react-native-web-vite/expo-ts',
'react-native-web-vite/expo-ts',
// 'react-native-web-vite/rn-cli-ts',
];

Expand Down
5 changes: 3 additions & 2 deletions scripts/tasks/sandbox-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,10 @@ export const install: Task['run'] = async ({ sandboxDir, key }, { link, dryRun,
'svelte-vite/default-ts',
'vue3-vite/default-js',
'vue3-vite/default-ts',
'svelte-kit/skeleton-ts',
];
if (sandboxesNeedingWorkarounds.includes(key)) {
await addWorkaroundResolutions({ cwd, dryRun, debug });
if (sandboxesNeedingWorkarounds.includes(key) || key.includes('vite')) {
await addWorkaroundResolutions({ cwd, dryRun, debug, key });
}

await exec(
Expand Down
15 changes: 14 additions & 1 deletion scripts/utils/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ export const installYarn2 = async ({ cwd, dryRun, debug }: YarnOptions) => {
);
};

export const addWorkaroundResolutions = async ({ cwd, dryRun }: YarnOptions) => {
export const addWorkaroundResolutions = async ({
cwd,
dryRun,
key,
}: YarnOptions & { key?: TemplateKey }) => {
logger.info(`🔢 Adding resolutions for workarounds`);

if (dryRun) {
Expand All @@ -81,10 +85,19 @@ export const addWorkaroundResolutions = async ({ cwd, dryRun }: YarnOptions) =>
// Due to our support of older vite versions
'@vitejs/plugin-react': '4.2.0',
'@vitejs/plugin-vue': '4.5.0',
// TODO: Remove this once we figure out how to properly test Vite 4, 5 and 6 in our sandboxes
vite: '^5.0.0',
// We need to downgrade the plugin so that it works with Vite 5 projects
'@sveltejs/vite-plugin-svelte': '4.0.2',
'@testing-library/dom': '^9.3.4',
'@testing-library/jest-dom': '^6.5.0',
'@testing-library/user-event': '^14.5.2',
};

if (key.includes('svelte-kit')) {
packageJson.resolutions['@sveltejs/vite-plugin-svelte'] = '^3.0.0';
}

await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
};

Expand Down

0 comments on commit 5a27290

Please sign in to comment.