Skip to content

Commit

Permalink
fixup: move dependency installs to a script
Browse files Browse the repository at this point in the history
  • Loading branch information
mcous committed Oct 21, 2024
1 parent 90bb3dd commit 16e0536
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,7 @@ jobs:
node-version: ${{ matrix.node }}

- name: 📥 Download deps
run: |
npm install --no-package-lock
npm install --no-save svelte@${SVELTE_VERSION} @sveltejs/vite-plugin-svelte@${VITE_PLUGIN_VERSION}
env:
SVELTE_VERSION: ${{ matrix.svelte }}
VITE_PLUGIN_VERSION: ${{ matrix.svelte == '5' && '4' || matrix.svelte == '4' && '3' || '2' }}
run: ./scripts/install-dependencies ${{ matrix.svelte }}

- name: ▶️ Run ${{ matrix.check }}
run: npm run ${{ matrix.check }}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
},
"devDependencies": {
"@jest/globals": "^29.7.0",
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0",
"@sveltejs/vite-plugin-svelte": "^2.0.0 || ^3.0.0 || ^4.0.0",
"@testing-library/jest-dom": "^6.3.0",
"@testing-library/user-event": "^14.5.2",
"@typescript-eslint/eslint-plugin": "^8.0.0",
Expand Down
18 changes: 18 additions & 0 deletions scripts/install-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# Install dependencies for a given version of Svelte
set -euo pipefail

svelte_version=${1}

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

if [[ "${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

npm ls --depth=0 svelte

0 comments on commit 16e0536

Please sign in to comment.