From 16e05369d313ae3e0c8df2b1e11a49f7ce260c13 Mon Sep 17 00:00:00 2001 From: Michael Cousins Date: Mon, 21 Oct 2024 13:36:17 -0400 Subject: [PATCH] fixup: move dependency installs to a script --- .github/workflows/release.yml | 7 +------ package.json | 2 +- scripts/install-dependencies | 18 ++++++++++++++++++ 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100755 scripts/install-dependencies diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a991127..79a33af 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 }} diff --git a/package.json b/package.json index ec68715..0788f40 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/install-dependencies b/scripts/install-dependencies new file mode 100755 index 0000000..2a3f24f --- /dev/null +++ b/scripts/install-dependencies @@ -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