mirror of
https://github.com/warkanum/monorepo-dep-checker.git
synced 2025-05-19 03:07:30 +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
|
# @warkypublic/monorepo-dep-checker
|
||||||
|
|
||||||
|
## 1.0.3
|
||||||
|
|
||||||
|
### Patch Changes
|
||||||
|
|
||||||
|
- Fixed ><= version comparisons
|
||||||
|
|
||||||
## 1.0.2
|
## 1.0.2
|
||||||
|
|
||||||
### Patch Changes
|
### Patch Changes
|
||||||
|
28
package.json
28
package.json
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@warkypublic/monorepo-dep-checker",
|
"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",
|
"description": "A CLI tool to check and manage dependencies across packages in a monorepo",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "./dist/index.js",
|
"main": "./dist/index.js",
|
||||||
@ -37,23 +37,23 @@
|
|||||||
"author": "Hein (Warkanum) Puth",
|
"author": "Hein (Warkanum) Puth",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"chalk": "^5.3.0",
|
"chalk": "^5.4.1",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.7.1",
|
||||||
"yargs": "^17.7.2"
|
"yargs": "^17.7.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "^2.27.10",
|
"@changesets/cli": "^2.29.3",
|
||||||
"@eslint/js": "^9.16.0",
|
"@eslint/js": "^9.26.0",
|
||||||
"@types/node": "^22.10.1",
|
"@types/node": "^22.15.12",
|
||||||
"@types/semver": "~7.5.8",
|
"@types/semver": "~7.7.0",
|
||||||
"@types/yargs": "~17.0.33",
|
"@types/yargs": "~17.0.33",
|
||||||
"eslint": "^9.16.0",
|
"eslint": "^9.26.0",
|
||||||
"globals": "^15.13.0",
|
"globals": "^16.0.0",
|
||||||
"prettier-eslint": "^16.3.0",
|
"prettier-eslint": "^16.4.1",
|
||||||
"typescript-eslint": "^8.18.0",
|
"typescript-eslint": "^8.32.0",
|
||||||
"typesync": "^0.14.0",
|
"typesync": "^0.14.3",
|
||||||
"vite": "^5.4.11",
|
"vite": "^6.3.5",
|
||||||
"vitest": "^1.6.0"
|
"vitest": "^3.1.3"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=14.16"
|
"node": ">=14.16"
|
||||||
|
22
src/lib.ts
22
src/lib.ts
@ -173,11 +173,12 @@ class DependencyChecker {
|
|||||||
if (semver.valid(workspaceVersion)) return workspaceVersion;
|
if (semver.valid(workspaceVersion)) return workspaceVersion;
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version === "*" || version === "latest") return null;
|
if (version === "*" || version === "latest") return null;
|
||||||
|
|
||||||
const cleanVersion = version.replace(/^[~^]/, "");
|
// Handle more version range operators: ^, ~, >=, >
|
||||||
|
const cleanVersion = version.replace(/^[~^>=]+\s*/, "");
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (semver.valid(cleanVersion)) return cleanVersion;
|
if (semver.valid(cleanVersion)) return cleanVersion;
|
||||||
return null;
|
return null;
|
||||||
@ -590,14 +591,23 @@ class DependencyChecker {
|
|||||||
if (appDependencies[dep]) {
|
if (appDependencies[dep]) {
|
||||||
const appVersion = appDependencies[dep];
|
const appVersion = appDependencies[dep];
|
||||||
if (version !== appVersion) {
|
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) {
|
if (!dryRun) {
|
||||||
packageJson[section]![dep] = appVersion;
|
packageJson[section]![dep] = newVersion;
|
||||||
}
|
}
|
||||||
updates.push({
|
updates.push({
|
||||||
package: packageJson.name,
|
package: packageJson.name,
|
||||||
dependency: dep,
|
dependency: dep,
|
||||||
from: version,
|
from: version,
|
||||||
to: appVersion,
|
to: newVersion,
|
||||||
type: section,
|
type: section,
|
||||||
});
|
});
|
||||||
hasUpdates = true;
|
hasUpdates = true;
|
||||||
|
Loading…
Reference in New Issue
Block a user