Skip to content

Commit

Permalink
Only apply workarounds for sandboxes that need it
Browse files Browse the repository at this point in the history
  • Loading branch information
IanVS committed Nov 21, 2023
1 parent 73e7bc5 commit 34a449d
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
19 changes: 19 additions & 0 deletions scripts/tasks/sandbox-parts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,25 @@ export const install: Task['run'] = async ({ sandboxDir }, { link, dryRun, debug
await addPackageResolutions({ cwd, dryRun, debug });
await configureYarn2ForVerdaccio({ cwd, dryRun, debug });

// Add vite plugin workarounds for frameworks that need it
// (to support vite 5 without peer dep errors)
if (
[
'bench-react-vite-default-ts',
'bench-react-vite-default-ts-nodocs',
'bench-react-vite-default-ts-test-build',
'internal-ssv6-vite',
'react-vite-default-js',
'react-vite-default-ts',
'svelte-vite-default-js',
'svelte-vite-default-ts',
'vue3-vite-default-js',
'vue3-vite-default-ts',
].includes(sandboxDir.split(sep).at(-1))
) {
await addWorkaroundResolutions({ cwd, dryRun, debug });
}

await exec(
'yarn install',
{ cwd },
Expand Down
10 changes: 4 additions & 6 deletions scripts/utils/yarn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@ export const addPackageResolutions = async ({ cwd, dryRun }: YarnOptions) => {
playwright: '1.36.0',
'playwright-core': '1.36.0',
'@playwright/test': '1.36.0',

// Due to support of older vite versions
'@vitejs/plugin-react': '4.2.0',
'@sveltejs/vite-plugin-svelte': '3.0.1',
'@vitejs/plugin-vue': '4.5.0',
};
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
};
Expand Down Expand Up @@ -72,7 +67,10 @@ export const addWorkaroundResolutions = async ({ cwd, dryRun }: YarnOptions) =>
const packageJson = await readJSON(packageJsonPath);
packageJson.resolutions = {
...packageJson.resolutions,
'@vitejs/plugin-react': '4.2.0', // due to conflicting version in @storybook/vite-react
// Due to our support of older vite versions
'@vitejs/plugin-react': '4.2.0',
'@sveltejs/vite-plugin-svelte': '3.0.1',
'@vitejs/plugin-vue': '4.5.0',
};
await writeJSON(packageJsonPath, packageJson, { spaces: 2 });
};
Expand Down

0 comments on commit 34a449d

Please sign in to comment.