-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup all tests for old versions of effector (#61)
- Loading branch information
1 parent
00e05ea
commit 77cc914
Showing
3 changed files
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"22": { | ||
"effector": "^22.8.6", | ||
"effector-vue": "^22.2.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }; | ||
}, {}); | ||
} |