deplift 1.0.0 → 1.1.0
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 +33 -7
- package/dist/esm/index.mjs +33 -7
- package/package.json +13 -11
package/README.md
CHANGED
package/dist/cjs/index.cjs
CHANGED
|
@@ -10,8 +10,18 @@ const defaultIgnore = ["**/node_modules/**", "**/dist/**", "**/coverage/**", "**
|
|
|
10
10
|
const depSections = ["dependencies", "devDependencies"];
|
|
11
11
|
const args = process.argv.slice(2);
|
|
12
12
|
const dryRun = args.includes("--dry-run");
|
|
13
|
+
const noInstall = args.includes("--no-install");
|
|
13
14
|
if (dryRun) console.log("💡 Dry run enabled — no files will be changed or installed.");
|
|
14
15
|
const stripPrefix = version => version.replace(/^[^0-9]*/, "");
|
|
16
|
+
const isStableRelease = version => /^\d+\.\d+\.\d+$/.test(version);
|
|
17
|
+
const extractSemVerParts = semver => semver.split(".").map(Number);
|
|
18
|
+
function isSemVerGreater(v1, v2) {
|
|
19
|
+
const [major1, minor1, patch1] = extractSemVerParts(v1);
|
|
20
|
+
const [major2, minor2, patch2] = extractSemVerParts(v2);
|
|
21
|
+
if (major1 !== major2) return major1 > major2;
|
|
22
|
+
if (minor1 !== minor2) return minor1 > minor2;
|
|
23
|
+
return patch1 > patch2;
|
|
24
|
+
}
|
|
15
25
|
const loadConfig = async () => {
|
|
16
26
|
const configPath = path.resolve("deplift.config.json");
|
|
17
27
|
try {
|
|
@@ -86,26 +96,38 @@ async function main() {
|
|
|
86
96
|
} of latestDeps) {
|
|
87
97
|
// Failed to fetch the pkg
|
|
88
98
|
if (!latest) continue;
|
|
89
|
-
if (
|
|
90
|
-
console.log(`
|
|
99
|
+
if (!isStableRelease(latest)) {
|
|
100
|
+
console.log(` ⚠️ [skipped] ${pkg}: latest version is not a stable release (${latest})`);
|
|
101
|
+
continue;
|
|
102
|
+
}
|
|
103
|
+
const currentVersion = stripPrefix(current);
|
|
104
|
+
if (currentVersion === latest) {
|
|
105
|
+
console.log(` ${pkg} is already up to date (${latest})`);
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (isSemVerGreater(currentVersion, latest)) {
|
|
109
|
+
console.log(` ⚠️ [skipped] ${pkg}: current (${currentVersion}) version is higher than the latest (${latest})`);
|
|
91
110
|
continue;
|
|
92
111
|
}
|
|
93
|
-
|
|
112
|
+
const [currentMajor] = extractSemVerParts(currentVersion);
|
|
113
|
+
const [latestMajor] = extractSemVerParts(latest);
|
|
114
|
+
console.log(` ${currentMajor === latestMajor ? "✔" : "🚨[major]"} ${pkg}(${section}): ${current} → ^${latest}`);
|
|
94
115
|
updated = true;
|
|
95
116
|
if (!dryRun) {
|
|
96
117
|
pkgData[section][pkg] = `^${latest}`;
|
|
97
118
|
}
|
|
98
119
|
}
|
|
99
|
-
if (
|
|
120
|
+
if (updated) {
|
|
121
|
+
await promises.writeFile(packageJsonPath, JSON.stringify(pkgData, null, 2) + "\n");
|
|
122
|
+
console.log(` 💾 ${packageJson} updated.`);
|
|
123
|
+
} else {
|
|
100
124
|
console.log(` ✅ No changes needed for ${packageJson}.`);
|
|
101
|
-
continue;
|
|
102
125
|
}
|
|
126
|
+
if (noInstall) continue;
|
|
103
127
|
if (dryRun) {
|
|
104
128
|
console.log(` 📥 [Dry run] "npm install" for ${packageJson}.`);
|
|
105
129
|
continue;
|
|
106
130
|
}
|
|
107
|
-
await promises.writeFile(packageJsonPath, JSON.stringify(pkgData, null, 2) + "\n");
|
|
108
|
-
console.log(` 💾 ${packageJson} updated.`);
|
|
109
131
|
try {
|
|
110
132
|
const targetDir = path.dirname(packageJsonPath);
|
|
111
133
|
console.log(" 📥 Installing...");
|
|
@@ -113,6 +135,10 @@ async function main() {
|
|
|
113
135
|
stdio: "inherit",
|
|
114
136
|
cwd: targetDir
|
|
115
137
|
});
|
|
138
|
+
node_child_process.execSync("npm audit fix", {
|
|
139
|
+
stdio: "inherit",
|
|
140
|
+
cwd: targetDir
|
|
141
|
+
});
|
|
116
142
|
} catch (err) {
|
|
117
143
|
console.error(` ❌ Failed to install in ${packageJson}: ${err.message}`);
|
|
118
144
|
}
|
package/dist/esm/index.mjs
CHANGED
|
@@ -8,8 +8,18 @@ const defaultIgnore = ["**/node_modules/**", "**/dist/**", "**/coverage/**", "**
|
|
|
8
8
|
const depSections = ["dependencies", "devDependencies"];
|
|
9
9
|
const args = process.argv.slice(2);
|
|
10
10
|
const dryRun = args.includes("--dry-run");
|
|
11
|
+
const noInstall = args.includes("--no-install");
|
|
11
12
|
if (dryRun) console.log("💡 Dry run enabled — no files will be changed or installed.");
|
|
12
13
|
const stripPrefix = version => version.replace(/^[^0-9]*/, "");
|
|
14
|
+
const isStableRelease = version => /^\d+\.\d+\.\d+$/.test(version);
|
|
15
|
+
const extractSemVerParts = semver => semver.split(".").map(Number);
|
|
16
|
+
function isSemVerGreater(v1, v2) {
|
|
17
|
+
const [major1, minor1, patch1] = extractSemVerParts(v1);
|
|
18
|
+
const [major2, minor2, patch2] = extractSemVerParts(v2);
|
|
19
|
+
if (major1 !== major2) return major1 > major2;
|
|
20
|
+
if (minor1 !== minor2) return minor1 > minor2;
|
|
21
|
+
return patch1 > patch2;
|
|
22
|
+
}
|
|
13
23
|
const loadConfig = async () => {
|
|
14
24
|
const configPath = path.resolve("deplift.config.json");
|
|
15
25
|
try {
|
|
@@ -84,26 +94,38 @@ async function main() {
|
|
|
84
94
|
} of latestDeps) {
|
|
85
95
|
// Failed to fetch the pkg
|
|
86
96
|
if (!latest) continue;
|
|
87
|
-
if (
|
|
88
|
-
console.log(`
|
|
97
|
+
if (!isStableRelease(latest)) {
|
|
98
|
+
console.log(` ⚠️ [skipped] ${pkg}: latest version is not a stable release (${latest})`);
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
const currentVersion = stripPrefix(current);
|
|
102
|
+
if (currentVersion === latest) {
|
|
103
|
+
console.log(` ${pkg} is already up to date (${latest})`);
|
|
104
|
+
continue;
|
|
105
|
+
}
|
|
106
|
+
if (isSemVerGreater(currentVersion, latest)) {
|
|
107
|
+
console.log(` ⚠️ [skipped] ${pkg}: current (${currentVersion}) version is higher than the latest (${latest})`);
|
|
89
108
|
continue;
|
|
90
109
|
}
|
|
91
|
-
|
|
110
|
+
const [currentMajor] = extractSemVerParts(currentVersion);
|
|
111
|
+
const [latestMajor] = extractSemVerParts(latest);
|
|
112
|
+
console.log(` ${currentMajor === latestMajor ? "✔" : "🚨[major]"} ${pkg}(${section}): ${current} → ^${latest}`);
|
|
92
113
|
updated = true;
|
|
93
114
|
if (!dryRun) {
|
|
94
115
|
pkgData[section][pkg] = `^${latest}`;
|
|
95
116
|
}
|
|
96
117
|
}
|
|
97
|
-
if (
|
|
118
|
+
if (updated) {
|
|
119
|
+
await writeFile(packageJsonPath, JSON.stringify(pkgData, null, 2) + "\n");
|
|
120
|
+
console.log(` 💾 ${packageJson} updated.`);
|
|
121
|
+
} else {
|
|
98
122
|
console.log(` ✅ No changes needed for ${packageJson}.`);
|
|
99
|
-
continue;
|
|
100
123
|
}
|
|
124
|
+
if (noInstall) continue;
|
|
101
125
|
if (dryRun) {
|
|
102
126
|
console.log(` 📥 [Dry run] "npm install" for ${packageJson}.`);
|
|
103
127
|
continue;
|
|
104
128
|
}
|
|
105
|
-
await writeFile(packageJsonPath, JSON.stringify(pkgData, null, 2) + "\n");
|
|
106
|
-
console.log(` 💾 ${packageJson} updated.`);
|
|
107
129
|
try {
|
|
108
130
|
const targetDir = path.dirname(packageJsonPath);
|
|
109
131
|
console.log(" 📥 Installing...");
|
|
@@ -111,6 +133,10 @@ async function main() {
|
|
|
111
133
|
stdio: "inherit",
|
|
112
134
|
cwd: targetDir
|
|
113
135
|
});
|
|
136
|
+
execSync("npm audit fix", {
|
|
137
|
+
stdio: "inherit",
|
|
138
|
+
cwd: targetDir
|
|
139
|
+
});
|
|
114
140
|
} catch (err) {
|
|
115
141
|
console.error(` ❌ Failed to install in ${packageJson}: ${err.message}`);
|
|
116
142
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "deplift",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
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.
|
|
35
|
-
"@babel/preset-env": "^7.
|
|
36
|
-
"@babel/preset-typescript": "^7.
|
|
37
|
-
"@rollup/plugin-babel": "^6.0
|
|
38
|
-
"@rollup/plugin-node-resolve": "^16.0.
|
|
39
|
-
"@types/node": "^
|
|
36
|
+
"@babel/core": "^7.28.5",
|
|
37
|
+
"@babel/preset-env": "^7.28.5",
|
|
38
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
39
|
+
"@rollup/plugin-babel": "^6.1.0",
|
|
40
|
+
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
41
|
+
"@types/node": "^25.0.5",
|
|
40
42
|
"npm-run-all": "^4.1.5",
|
|
41
|
-
"rollup": "^4.
|
|
42
|
-
"typescript": "^5.
|
|
43
|
+
"rollup": "^4.55.1",
|
|
44
|
+
"typescript": "^5.9.3"
|
|
43
45
|
},
|
|
44
46
|
"dependencies": {
|
|
45
47
|
"fast-glob": "^3.3.3"
|
|
46
48
|
}
|
|
47
|
-
}
|
|
49
|
+
}
|