mirror of
https://github.com/warkanum/monorepo-dep-checker.git
synced 2025-05-18 18:57:29 +00:00
Publishing "@warkypublic/monorepo-dep-checker" at "1.0.3"
This commit is contained in:
parent
b0c6e7e38e
commit
3013441c12
@ -1,5 +1,11 @@
|
||||
# @warkypublic/monorepo-dep-checker
|
||||
|
||||
## 1.0.3
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- Fixed ><= version comparisons
|
||||
|
||||
## 1.0.2
|
||||
|
||||
### Patch Changes
|
||||
|
28
package.json
28
package.json
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@warkypublic/monorepo-dep-checker",
|
||||
"version": "1.0.2",
|
||||
"version": "1.0.3",
|
||||
"description": "A CLI tool to check and manage dependencies across packages in a monorepo",
|
||||
"type": "module",
|
||||
"main": "./dist/index.js",
|
||||
@ -37,23 +37,23 @@
|
||||
"author": "Hein (Warkanum) Puth",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"chalk": "^5.3.0",
|
||||
"semver": "^7.5.4",
|
||||
"chalk": "^5.4.1",
|
||||
"semver": "^7.7.1",
|
||||
"yargs": "^17.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@changesets/cli": "^2.27.10",
|
||||
"@eslint/js": "^9.16.0",
|
||||
"@types/node": "^22.10.1",
|
||||
"@types/semver": "~7.5.8",
|
||||
"@changesets/cli": "^2.29.3",
|
||||
"@eslint/js": "^9.26.0",
|
||||
"@types/node": "^22.15.12",
|
||||
"@types/semver": "~7.7.0",
|
||||
"@types/yargs": "~17.0.33",
|
||||
"eslint": "^9.16.0",
|
||||
"globals": "^15.13.0",
|
||||
"prettier-eslint": "^16.3.0",
|
||||
"typescript-eslint": "^8.18.0",
|
||||
"typesync": "^0.14.0",
|
||||
"vite": "^5.4.11",
|
||||
"vitest": "^1.6.0"
|
||||
"eslint": "^9.26.0",
|
||||
"globals": "^16.0.0",
|
||||
"prettier-eslint": "^16.4.1",
|
||||
"typescript-eslint": "^8.32.0",
|
||||
"typesync": "^0.14.3",
|
||||
"vite": "^6.3.5",
|
||||
"vitest": "^3.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14.16"
|
||||
|
22
src/lib.ts
22
src/lib.ts
@ -173,11 +173,12 @@ class DependencyChecker {
|
||||
if (semver.valid(workspaceVersion)) return workspaceVersion;
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
if (version === "*" || version === "latest") return null;
|
||||
|
||||
const cleanVersion = version.replace(/^[~^]/, "");
|
||||
|
||||
|
||||
// Handle more version range operators: ^, ~, >=, >
|
||||
const cleanVersion = version.replace(/^[~^>=]+\s*/, "");
|
||||
|
||||
try {
|
||||
if (semver.valid(cleanVersion)) return cleanVersion;
|
||||
return null;
|
||||
@ -590,14 +591,23 @@ class DependencyChecker {
|
||||
if (appDependencies[dep]) {
|
||||
const appVersion = appDependencies[dep];
|
||||
if (version !== appVersion) {
|
||||
// Extract the version prefix (>=, >, ^, ~) if any
|
||||
const versionPrefix = version.match(/^([~^>=]+\s*)/)?.[0] || '';
|
||||
const newVersion = appVersion.startsWith(versionPrefix) ?
|
||||
appVersion :
|
||||
// If the app version doesn't have the same prefix, preserve the original prefix
|
||||
appVersion.match(/^[~^>=]+\s*/) ?
|
||||
appVersion :
|
||||
`${versionPrefix}${appVersion.replace(/^[~^>=]+\s*/, '')}`;
|
||||
|
||||
if (!dryRun) {
|
||||
packageJson[section]![dep] = appVersion;
|
||||
packageJson[section]![dep] = newVersion;
|
||||
}
|
||||
updates.push({
|
||||
package: packageJson.name,
|
||||
dependency: dep,
|
||||
from: version,
|
||||
to: appVersion,
|
||||
to: newVersion,
|
||||
type: section,
|
||||
});
|
||||
hasUpdates = true;
|
||||
|
Loading…
Reference in New Issue
Block a user