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

ci: fix node 16 builds again #423

Merged
merged 1 commit into from
Feb 11, 2025
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"@testing-library/user-event": "^14.5.2",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@vitest/coverage-v8": "^1.0.0 || ^2.0.2",
"@vitest/coverage-v8": "0.x.x || ^1.0.0 || ^2.0.2",
"all-contributors-cli": "^6.26.1",
"doctoc": "^2.2.1",
"esbuild": "*",
Expand All @@ -128,6 +128,6 @@
"svelte-jester": "^5.0.0",
"typescript": "^5.5.3",
"vite": "^4.0.0 || ^5.3.3",
"vitest": "^1.0.0 || ^2.0.2"
"vitest": "0.x.x || ^1.0.0 || ^2.0.2"
}
}
18 changes: 12 additions & 6 deletions scripts/install-dependencies
Original file line number Diff line number Diff line change
@@ -1,22 +1,28 @@
#!/usr/bin/env bash
# Install dependencies for a given version of Svelte
set -euo pipefail
set -euxo pipefail

svelte_version=${1}
node_version=$(node --version)

rm -rf node_modules
npm install --no-package-lock

if [[ "${svelte_version}" == "4" ]]; then
if [[ "${svelte_version}" == "3" ]]; then
npm uninstall --no-save vite vitest @vitest/coverage-v8 @sveltejs/vite-plugin-svelte svelte-check svelte
npm install --no-save vite@4 [email protected] @vitest/[email protected] @sveltejs/vite-plugin-svelte@2 svelte-check@3 svelte@3
elif [[ "${svelte_version}" == "4" ]]; then
npm uninstall --no-save @sveltejs/vite-plugin-svelte svelte
npm install --no-save @sveltejs/vite-plugin-svelte@3 svelte@4
elif [[ "${svelte_version}" == "3" ]]; then
npm uninstall --no-save vite vitest @vitest/coverage-v8 @sveltejs/vite-plugin-svelte svelte-check svelte
npm install --no-save vite@4 vitest@1 @vitest/coverage-v8@1 @sveltejs/vite-plugin-svelte@2 svelte-check@3 svelte@3
fi

if [[ "${node_version}" =~ "v16" ]]; then
npm uninstall --no-save vite vitest @vitest/coverage-v8 @sveltejs/vite-plugin-svelte
npm install --no-save vite@4 [email protected] @vitest/[email protected] @sveltejs/vite-plugin-svelte@2
fi

npm dedupe
installed_version=$(npm ls --depth=0 --parseable svelte@${svelte_version})
installed_version=$(npm ls --depth=0 --parseable svelte@${svelte_version})

if [[ -z "${installed_version}" ]]; then
echo "Error: expected svelte@${svelte_version}"
Expand Down
7 changes: 7 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { createRequire } from 'node:module'

import { svelte } from '@sveltejs/vite-plugin-svelte'
import { defineConfig } from 'vite'

import { svelteTesting } from './src/vite.js'

const require = createRequire(import.meta.url)

// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte(), svelteTesting()],
Expand All @@ -17,5 +21,8 @@ export default defineConfig({
include: ['src/**/*'],
exclude: ['**/__tests__/**', 'src/vite.js', 'src/vitest.js'],
},
alias: {
'@testing-library/svelte': require.resolve('.'),
},
},
})