diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 09784732..d4645c08 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,3 +34,46 @@ jobs: - run: pnpm install --frozen-lockfile - run: pnpm playwright install - run: pnpm test:e2e + + checks_old_versions: + runs-on: ubuntu-latest + + strategy: + matrix: + version: [22] + + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'pnpm' + - run: pnpm install --frozen-lockfile + + - run: node ./tools/other-majors/prepare.mjs ${{ matrix.version }} + - run: pnpm install --no-frozen-lockfile + + - run: pnpm test + - run: pnpm test:types + e2e_old_versions: + runs-on: ubuntu-latest + + strategy: + matrix: + version: [22] + + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + - uses: actions/setup-node@v3 + with: + node-version-file: '.nvmrc' + cache: 'pnpm' + - run: pnpm install --frozen-lockfile + + - run: node ./tools/other-majors/prepare.mjs ${{ matrix.version }} + - run: pnpm install --no-frozen-lockfile + + - run: pnpm playwright install + - run: pnpm test:e2e diff --git a/tools/other-majors/manifest.json b/tools/other-majors/manifest.json new file mode 100644 index 00000000..439ce495 --- /dev/null +++ b/tools/other-majors/manifest.json @@ -0,0 +1,6 @@ +{ + "22": { + "effector": "^22.8.6", + "effector-vue": "^22.2.0" + } +} diff --git a/tools/other-majors/prepare.mjs b/tools/other-majors/prepare.mjs new file mode 100644 index 00000000..3a0933ce --- /dev/null +++ b/tools/other-majors/prepare.mjs @@ -0,0 +1,36 @@ +import { createRequire } from 'node:module'; + +import manifest from './manifest.json' assert { type: 'json' }; + +const require = createRequire(import.meta.url); + +const { readJsonFile, writeJsonFile } = require('@nx/devkit'); + +const [, , versoin] = process.argv; + +const oldPackageJson = readJsonFile('package.json'); + +const newVersions = manifest[versoin]; + +if (!newVersions) { + throw new Error(`No versions found for ${versoin}`); +} + +writeJsonFile('package.json', { + ...oldPackageJson, + devDependencies: applyNewVersions( + oldPackageJson.devDependencies, + newVersions + ), + dependencies: applyNewVersions(oldPackageJson.dependencies, newVersions), +}); + +function applyNewVersions(deps, newVersions) { + return Object.entries(deps).reduce((acc, [key, value]) => { + if (newVersions[key]) { + return { ...acc, [key]: newVersions[key] }; + } + + return { ...acc, [key]: value }; + }, {}); +}