deplift 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/cjs/index.cjs +23 -3
- package/dist/esm/index.mjs +23 -3
- package/package.json +8 -6
package/README.md
CHANGED
package/dist/cjs/index.cjs
CHANGED
|
@@ -12,6 +12,15 @@ const args = process.argv.slice(2);
|
|
|
12
12
|
const dryRun = args.includes("--dry-run");
|
|
13
13
|
if (dryRun) console.log("💡 Dry run enabled — no files will be changed or installed.");
|
|
14
14
|
const stripPrefix = version => version.replace(/^[^0-9]*/, "");
|
|
15
|
+
const isStableRelease = version => /^\d+\.\d+\.\d+$/.test(version);
|
|
16
|
+
const extractSemVerParts = semver => semver.split(".").map(Number);
|
|
17
|
+
function isSemVerGreater(v1, v2) {
|
|
18
|
+
const [major1, minor1, patch1] = extractSemVerParts(v1);
|
|
19
|
+
const [major2, minor2, patch2] = extractSemVerParts(v2);
|
|
20
|
+
if (major1 !== major2) return major1 > major2;
|
|
21
|
+
if (minor1 !== minor2) return minor1 > minor2;
|
|
22
|
+
return patch1 > patch2;
|
|
23
|
+
}
|
|
15
24
|
const loadConfig = async () => {
|
|
16
25
|
const configPath = path.resolve("deplift.config.json");
|
|
17
26
|
try {
|
|
@@ -86,11 +95,22 @@ async function main() {
|
|
|
86
95
|
} of latestDeps) {
|
|
87
96
|
// Failed to fetch the pkg
|
|
88
97
|
if (!latest) continue;
|
|
89
|
-
if (
|
|
90
|
-
console.log(`
|
|
98
|
+
if (!isStableRelease(latest)) {
|
|
99
|
+
console.log(` ⚠️ [skipped] ${pkg}: latest version is not a stable release (${latest})`);
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const currentVersion = stripPrefix(current);
|
|
103
|
+
if (currentVersion === latest) {
|
|
104
|
+
console.log(` ${pkg} is already up to date (${latest})`);
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
if (isSemVerGreater(currentVersion, latest)) {
|
|
108
|
+
console.log(` ⚠️ [skipped] ${pkg}: current (${currentVersion}) version is higher than the latest (${latest})`);
|
|
91
109
|
continue;
|
|
92
110
|
}
|
|
93
|
-
|
|
111
|
+
const [currentMajor] = extractSemVerParts(currentVersion);
|
|
112
|
+
const [latestMajor] = extractSemVerParts(latest);
|
|
113
|
+
console.log(` ${currentMajor === latestMajor ? "✔" : "🚨[major]"} ${pkg}(${section}): ${current} → ^${latest}`);
|
|
94
114
|
updated = true;
|
|
95
115
|
if (!dryRun) {
|
|
96
116
|
pkgData[section][pkg] = `^${latest}`;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -10,6 +10,15 @@ const args = process.argv.slice(2);
|
|
|
10
10
|
const dryRun = args.includes("--dry-run");
|
|
11
11
|
if (dryRun) console.log("💡 Dry run enabled — no files will be changed or installed.");
|
|
12
12
|
const stripPrefix = version => version.replace(/^[^0-9]*/, "");
|
|
13
|
+
const isStableRelease = version => /^\d+\.\d+\.\d+$/.test(version);
|
|
14
|
+
const extractSemVerParts = semver => semver.split(".").map(Number);
|
|
15
|
+
function isSemVerGreater(v1, v2) {
|
|
16
|
+
const [major1, minor1, patch1] = extractSemVerParts(v1);
|
|
17
|
+
const [major2, minor2, patch2] = extractSemVerParts(v2);
|
|
18
|
+
if (major1 !== major2) return major1 > major2;
|
|
19
|
+
if (minor1 !== minor2) return minor1 > minor2;
|
|
20
|
+
return patch1 > patch2;
|
|
21
|
+
}
|
|
13
22
|
const loadConfig = async () => {
|
|
14
23
|
const configPath = path.resolve("deplift.config.json");
|
|
15
24
|
try {
|
|
@@ -84,11 +93,22 @@ async function main() {
|
|
|
84
93
|
} of latestDeps) {
|
|
85
94
|
// Failed to fetch the pkg
|
|
86
95
|
if (!latest) continue;
|
|
87
|
-
if (
|
|
88
|
-
console.log(`
|
|
96
|
+
if (!isStableRelease(latest)) {
|
|
97
|
+
console.log(` ⚠️ [skipped] ${pkg}: latest version is not a stable release (${latest})`);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
const currentVersion = stripPrefix(current);
|
|
101
|
+
if (currentVersion === latest) {
|
|
102
|
+
console.log(` ${pkg} is already up to date (${latest})`);
|
|
103
|
+
continue;
|
|
104
|
+
}
|
|
105
|
+
if (isSemVerGreater(currentVersion, latest)) {
|
|
106
|
+
console.log(` ⚠️ [skipped] ${pkg}: current (${currentVersion}) version is higher than the latest (${latest})`);
|
|
89
107
|
continue;
|
|
90
108
|
}
|
|
91
|
-
|
|
109
|
+
const [currentMajor] = extractSemVerParts(currentVersion);
|
|
110
|
+
const [latestMajor] = extractSemVerParts(latest);
|
|
111
|
+
console.log(` ${currentMajor === latestMajor ? "✔" : "🚨[major]"} ${pkg}(${section}): ${current} → ^${latest}`);
|
|
92
112
|
updated = true;
|
|
93
113
|
if (!dryRun) {
|
|
94
114
|
pkgData[section][pkg] = `^${latest}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deplift",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "CLI to update deps in monorepos",
|
|
5
5
|
"author": "Zheng Song",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,7 +13,9 @@
|
|
|
13
13
|
"main": "./dist/cjs/index.cjs",
|
|
14
14
|
"module": "./dist/esm/index.mjs",
|
|
15
15
|
"types": "./types/index.d.ts",
|
|
16
|
-
"bin":
|
|
16
|
+
"bin": {
|
|
17
|
+
"deplift": "dist/cjs/index.cjs"
|
|
18
|
+
},
|
|
17
19
|
"sideEffects": false,
|
|
18
20
|
"files": [
|
|
19
21
|
"dist/",
|
|
@@ -31,17 +33,17 @@
|
|
|
31
33
|
"deplift:dry-run": "node ./dist/cjs/index.cjs --dry-run"
|
|
32
34
|
},
|
|
33
35
|
"devDependencies": {
|
|
34
|
-
"@babel/core": "^7.27.
|
|
36
|
+
"@babel/core": "^7.27.4",
|
|
35
37
|
"@babel/preset-env": "^7.27.2",
|
|
36
38
|
"@babel/preset-typescript": "^7.27.1",
|
|
37
39
|
"@rollup/plugin-babel": "^6.0.4",
|
|
38
40
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
39
|
-
"@types/node": "^22.15.
|
|
41
|
+
"@types/node": "^22.15.29",
|
|
40
42
|
"npm-run-all": "^4.1.5",
|
|
41
|
-
"rollup": "^4.41.
|
|
43
|
+
"rollup": "^4.41.1",
|
|
42
44
|
"typescript": "^5.8.3"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"fast-glob": "^3.3.3"
|
|
46
48
|
}
|
|
47
|
-
}
|
|
49
|
+
}
|