binary-collections 2.0.11 → 2.0.12
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/.opencode/package.json +5 -0
- package/binaries/rmx +15 -1
- package/binaries/rmx.cmd +12 -0
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +178 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +110 -0
- package/binaries/yc.cjs +178 -0
- package/lib/binary-collections/config.cjs +126 -0
- package/lib/binary-collections/config.mjs +7 -0
- package/lib/binary-collections/executeScript.cjs +19 -0
- package/lib/binary-collections/executeScript.d.cts +12 -0
- package/lib/binary-collections/executeScript.mjs +6 -0
- package/lib/binary-collections/findScript.cjs +284 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +266 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +224 -137
- package/lib/binary-collections.mjs +22 -282
- package/lib/changelog.cjs +2 -2
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
- package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
- package/lib/chunk-6PU7BAHB.mjs +61 -0
- package/lib/chunk-C6D2TTYU.mjs +32 -0
- package/lib/chunk-FB2WKVJD.mjs +158 -0
- package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-NCZPTKDV.mjs +79 -0
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OGXVGBRI.mjs +29 -0
- package/lib/chunk-OXV52GD5.mjs +62 -0
- package/lib/chunk-PXBMHE7O.mjs +35 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-SPTECFE5.mjs +180 -0
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/chunk-V2IBPCEV.mjs +39 -0
- package/lib/chunk-XPJGCDOD.mjs +14 -0
- package/lib/chunk-ZOWVMII3.mjs +228 -0
- package/lib/clean-github-actions-caches-cli.cjs +465 -0
- package/lib/clean-github-actions-caches-cli.d.cts +1 -0
- package/lib/clean-github-actions-caches-cli.mjs +56 -0
- package/lib/clean-github-actions-caches.cjs +149 -205
- package/lib/clean-github-actions-caches.d.cts +15 -1
- package/lib/clean-github-actions-caches.mjs +4 -130
- package/lib/cross-env/command.cjs +63 -0
- package/lib/cross-env/command.d.ts +8 -0
- package/lib/cross-env/command.js +45 -0
- package/lib/cross-env/command.mjs +9 -0
- package/lib/cross-env/index.cjs +178 -0
- package/lib/cross-env/index.d.ts +8 -0
- package/lib/cross-env/index.js +102 -0
- package/lib/cross-env/index.mjs +101 -0
- package/lib/cross-env/variable.cjs +60 -0
- package/lib/cross-env/variable.d.ts +7 -0
- package/lib/cross-env/variable.js +59 -0
- package/lib/cross-env/variable.mjs +9 -0
- package/lib/del-gradle.cjs +2 -2
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.js +24 -24
- package/lib/del-ps.cjs +2 -2
- package/lib/del-ps.js +8 -8
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +2 -2
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/file/copy-cli.cjs +92 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +55 -0
- package/lib/file/copy.cjs +56 -0
- package/lib/file/copy.d.mts +1 -0
- package/lib/file/copy.mjs +8 -0
- package/lib/file/move-cli.cjs +91 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +55 -0
- package/lib/file/move.cjs +55 -0
- package/lib/file/move.d.mts +1 -0
- package/lib/file/move.mjs +8 -0
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/free-chatgpt.cjs +21 -15
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +2 -2
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +188 -42
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +188 -42
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +91 -34
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +2 -2
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +2 -2
- package/lib/git-purge.mjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/kill-night-crows.cjs +7 -7
- package/lib/kill-night-crows.mjs +7 -7
- package/lib/node-cache-cleaner/npm.cjs +65 -0
- package/lib/node-cache-cleaner/npm.d.ts +2 -0
- package/lib/node-cache-cleaner/npm.js +41 -0
- package/lib/node-cache-cleaner/npm.mjs +10 -0
- package/lib/node-cache-cleaner/npx.cjs +89 -0
- package/lib/node-cache-cleaner/npx.d.ts +4 -0
- package/lib/node-cache-cleaner/npx.js +82 -0
- package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
- package/lib/node-cache-cleaner/yarn.cjs +73 -0
- package/lib/node-cache-cleaner/yarn.d.ts +2 -0
- package/lib/node-cache-cleaner/yarn.js +62 -0
- package/lib/node-cache-cleaner/yarn.mjs +10 -0
- package/lib/node-cache-cleaner-cli.cjs +182 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +60 -0
- package/lib/node-cache-cleaner-cli.mjs +56 -0
- package/lib/node-executor.cjs +91 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +103 -0
- package/lib/npm-run-series.cjs +21 -28
- package/lib/npm-run-series.mjs +20 -6
- package/lib/package-resolutions-updater-cli.cjs +213 -128
- package/lib/package-resolutions-updater-cli.mjs +17 -39
- package/lib/package-resolutions-updater.cjs +204 -98
- package/lib/package-resolutions-updater.d.mts +20 -1
- package/lib/package-resolutions-updater.mjs +7 -5
- package/lib/print-directory-tree.cjs +2 -2
- package/lib/print-directory-tree.mjs +1 -1
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +1 -1
- package/lib/ps/index.mjs +177 -171
- package/lib/ps/isWin.js +1 -1
- package/lib/ps/table-parser.js +6 -6
- package/lib/remove-module.cjs +2 -2
- package/lib/remove-module.mjs +1 -1
- package/lib/rm-node-module-cli.cjs +222 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +89 -0
- package/lib/rm-node-modules.cjs +127 -0
- package/lib/rm-node-modules.d.cts +35 -0
- package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
- package/lib/rmpath.cjs +2 -2
- package/lib/rmpath.mjs +1 -1
- package/lib/submodule-install.cjs +47 -34
- package/lib/submodule-install.mjs +46 -33
- package/lib/submodule-remove-cli.cjs +1 -2
- package/lib/submodule-remove-cli.js +3 -3
- package/lib/submodule-remove-cli.mjs +1 -2
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +28 -46
- package/lib/utils/findEnvFiles.d.cts +19 -0
- package/lib/utils/findEnvFiles.mjs +3 -5
- package/lib/utils/findWorkspaceRoot.js +4 -4
- package/lib/utils/index.cjs +2 -2
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +8 -0
- package/lib/utils/runBash.cjs +53 -0
- package/lib/utils/runBash.d.cts +12 -0
- package/lib/utils/runBash.mjs +66 -0
- package/lib/yarn-per-branch-lock-installer.cjs +97 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +109 -0
- package/lib/yarn-reinstall.cjs +2 -2
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +61 -52
- package/readme.html +784 -0
- package/readme.md +106 -218
- package/releases/readme.md +1 -1
- package/test/README.md +2 -2
- package/test-project/package.json +8 -2
- package/test-project/workspaces/workspace-a/package.json +135 -0
- package/test-project/workspaces/workspace-a/readme.md +20 -0
- package/test-project/workspaces/workspace-a/release/readme.md +42 -0
- package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
- package/test-project/workspaces/workspace-a/test/readme.md +12 -0
- package/test-project/workspaces/workspace-b/package.json +139 -0
- package/test-project/workspaces/workspace-b/readme.md +94 -0
- package/test-project/workspaces/workspace-b/requirements.txt +1 -0
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/rm-node-modules-test-project/package.json +17 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo/package.json +13 -3
- package/docs-src/clean-github-actions-caches.md +0 -26
- package/docs-src/free-chatgpt.md +0 -26
- package/lib/binary-collections-config.cjs +0 -15
- package/lib/chunk-2CBJCW7E.mjs +0 -81
- package/lib/chunk-4UHL4WVN.mjs +0 -136
- package/lib/chunk-66PAU5PS.mjs +0 -31
- package/lib/chunk-6HHJRKFB.mjs +0 -59
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-FCDQGYBF.mjs +0 -136
- package/lib/chunk-GEYA2USY.mjs +0 -207
- package/lib/chunk-GJTGHXRA.mjs +0 -356
- package/lib/chunk-ID2WBTE2.mjs +0 -80
- package/lib/chunk-JXFOHKDM.mjs +0 -239
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- package/lib/chunk-RWLXRTYP.mjs +0 -109
- package/lib/chunk-TOIVAQF7.mjs +0 -136
- package/lib/chunk-V5SKYJUB.mjs +0 -136
- package/lib/chunk-WSRETQCA.mjs +0 -59
- package/lib/chunk-YYLIQQKF.mjs +0 -31
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
|
@@ -42,8 +42,8 @@ var init_cjs_shims = __esm({
|
|
|
42
42
|
var require_utils = __commonJS({
|
|
43
43
|
"src/utils/index.cjs"(exports2, module2) {
|
|
44
44
|
init_cjs_shims();
|
|
45
|
-
var
|
|
46
|
-
var
|
|
45
|
+
var fs2 = require("fs");
|
|
46
|
+
var path2 = require("upath");
|
|
47
47
|
var argv = require("minimist")(process.argv.slice(2));
|
|
48
48
|
var { exec } = require("child_process");
|
|
49
49
|
var { URL: URL2 } = require("url");
|
|
@@ -94,11 +94,11 @@ var require_utils = __commonJS({
|
|
|
94
94
|
module2.exports.getArgs = getArgs2;
|
|
95
95
|
function del(fullPath) {
|
|
96
96
|
try {
|
|
97
|
-
if (!
|
|
98
|
-
const stat =
|
|
97
|
+
if (!fs2.existsSync(fullPath)) return;
|
|
98
|
+
const stat = fs2.lstatSync(fullPath);
|
|
99
99
|
if (stat.isSymbolicLink()) {
|
|
100
100
|
try {
|
|
101
|
-
|
|
101
|
+
fs2.unlinkSync(fullPath);
|
|
102
102
|
console.log("deleted symlink", fullPath);
|
|
103
103
|
} catch (e) {
|
|
104
104
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -106,16 +106,16 @@ var require_utils = __commonJS({
|
|
|
106
106
|
return;
|
|
107
107
|
}
|
|
108
108
|
if (stat.isDirectory()) {
|
|
109
|
-
const subdir =
|
|
109
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
110
110
|
for (let i = 0; i < subdir.length; i++) {
|
|
111
111
|
del(subdir[i]);
|
|
112
112
|
}
|
|
113
113
|
try {
|
|
114
|
-
|
|
114
|
+
fs2.rmdirSync(fullPath);
|
|
115
115
|
console.log("deleted", fullPath);
|
|
116
|
-
} catch (
|
|
116
|
+
} catch (_e) {
|
|
117
117
|
try {
|
|
118
|
-
|
|
118
|
+
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
119
119
|
console.log("deleted", fullPath);
|
|
120
120
|
} catch (ee) {
|
|
121
121
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -124,11 +124,11 @@ var require_utils = __commonJS({
|
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
126
126
|
try {
|
|
127
|
-
|
|
127
|
+
fs2.unlinkSync(fullPath);
|
|
128
128
|
console.log("deleted", fullPath);
|
|
129
|
-
} catch (
|
|
129
|
+
} catch (_e) {
|
|
130
130
|
try {
|
|
131
|
-
|
|
131
|
+
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
132
132
|
console.log("deleted", fullPath);
|
|
133
133
|
} catch (ee) {
|
|
134
134
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -141,13 +141,13 @@ var require_utils = __commonJS({
|
|
|
141
141
|
module2.exports.del = del;
|
|
142
142
|
function delStream(globStream) {
|
|
143
143
|
globStream.stream().on("data", (result) => {
|
|
144
|
-
const fullPath =
|
|
144
|
+
const fullPath = path2.resolve(process.cwd(), result);
|
|
145
145
|
try {
|
|
146
|
-
if (
|
|
147
|
-
const stat =
|
|
146
|
+
if (fs2.existsSync(fullPath)) {
|
|
147
|
+
const stat = fs2.lstatSync(fullPath);
|
|
148
148
|
if (stat.isSymbolicLink()) {
|
|
149
149
|
try {
|
|
150
|
-
|
|
150
|
+
fs2.unlinkSync(fullPath);
|
|
151
151
|
console.log("deleted symlink", fullPath);
|
|
152
152
|
} catch (e) {
|
|
153
153
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -155,7 +155,7 @@ var require_utils = __commonJS({
|
|
|
155
155
|
return;
|
|
156
156
|
}
|
|
157
157
|
if (stat.isDirectory()) {
|
|
158
|
-
const subdir =
|
|
158
|
+
const subdir = fs2.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
159
159
|
for (let i = 0; i < subdir.length; i++) {
|
|
160
160
|
del(subdir[i]);
|
|
161
161
|
}
|
|
@@ -210,6 +210,101 @@ var require_utils = __commonJS({
|
|
|
210
210
|
}
|
|
211
211
|
});
|
|
212
212
|
|
|
213
|
+
// src/utils/findEnvFiles.cjs
|
|
214
|
+
var require_findEnvFiles = __commonJS({
|
|
215
|
+
"src/utils/findEnvFiles.cjs"(exports2, module2) {
|
|
216
|
+
init_cjs_shims();
|
|
217
|
+
var fs2 = require("fs");
|
|
218
|
+
var path2 = require("path");
|
|
219
|
+
var glob = require("glob");
|
|
220
|
+
var DEFAULT_IGNORES = [
|
|
221
|
+
"**/node_modules/**",
|
|
222
|
+
"**/.git/**",
|
|
223
|
+
"**/.yarn/**",
|
|
224
|
+
"**/.pnpm/**",
|
|
225
|
+
"**/dist/**",
|
|
226
|
+
"**/build/**",
|
|
227
|
+
"**/coverage/**",
|
|
228
|
+
"**/vendor/**",
|
|
229
|
+
"**/tmp/**",
|
|
230
|
+
"**/.cache/**",
|
|
231
|
+
"**/assets/**",
|
|
232
|
+
"**/logs/**",
|
|
233
|
+
"**/output/**",
|
|
234
|
+
"**/public/**",
|
|
235
|
+
"**/static/**",
|
|
236
|
+
"**/temp/**",
|
|
237
|
+
"**/backup/**",
|
|
238
|
+
"**/backups/**",
|
|
239
|
+
"**/examples/**",
|
|
240
|
+
"**/docs/**",
|
|
241
|
+
"**/tests/**",
|
|
242
|
+
"**/__tests__/**",
|
|
243
|
+
"**/spec/**",
|
|
244
|
+
"**/__specs__/**",
|
|
245
|
+
"**/scripts/**",
|
|
246
|
+
"**/bin/**",
|
|
247
|
+
"**/hooks/**",
|
|
248
|
+
"**/config/**",
|
|
249
|
+
"**/configs/**",
|
|
250
|
+
"**/settings/**",
|
|
251
|
+
"**/.vscode/**",
|
|
252
|
+
"**/.idea/**"
|
|
253
|
+
];
|
|
254
|
+
function findEnvFiles2(startDir = process.cwd(), filter) {
|
|
255
|
+
const found = /* @__PURE__ */ new Set();
|
|
256
|
+
function addFile(file) {
|
|
257
|
+
const normalized = path2.normalize(file);
|
|
258
|
+
if (typeof filter === "function" && !filter(normalized)) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
261
|
+
found.add(normalized);
|
|
262
|
+
}
|
|
263
|
+
let current = path2.resolve(startDir);
|
|
264
|
+
while (true) {
|
|
265
|
+
const envPath2 = path2.join(current, ".env");
|
|
266
|
+
if (fs2.existsSync(envPath2)) {
|
|
267
|
+
addFile(envPath2);
|
|
268
|
+
}
|
|
269
|
+
const parent = path2.dirname(current);
|
|
270
|
+
if (parent === current) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
273
|
+
current = parent;
|
|
274
|
+
}
|
|
275
|
+
const files = glob.globSync("**/.env*", {
|
|
276
|
+
cwd: startDir,
|
|
277
|
+
absolute: true,
|
|
278
|
+
nodir: true,
|
|
279
|
+
ignore: DEFAULT_IGNORES
|
|
280
|
+
});
|
|
281
|
+
for (const file of files) {
|
|
282
|
+
addFile(file);
|
|
283
|
+
}
|
|
284
|
+
return [...found];
|
|
285
|
+
}
|
|
286
|
+
function findEnvWithToken(startDir = process.cwd(), tokenName = "GITHUB_TOKEN") {
|
|
287
|
+
const envFiles = findEnvFiles2(startDir);
|
|
288
|
+
return envFiles.find((file) => {
|
|
289
|
+
try {
|
|
290
|
+
const content = fs2.readFileSync(file, "utf-8");
|
|
291
|
+
const regex = new RegExp(`^\\s*${tokenName}\\s*=`, "m");
|
|
292
|
+
return regex.test(content);
|
|
293
|
+
} catch (err) {
|
|
294
|
+
console.warn(`Failed to read ${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
295
|
+
return false;
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
}
|
|
299
|
+
module2.exports = {
|
|
300
|
+
DEFAULT_IGNORES,
|
|
301
|
+
findEnvFiles: findEnvFiles2,
|
|
302
|
+
findEnvWithToken,
|
|
303
|
+
default: findEnvFiles2
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
});
|
|
307
|
+
|
|
213
308
|
// src/package-resolutions-updater.mjs
|
|
214
309
|
var package_resolutions_updater_exports = {};
|
|
215
310
|
__export(package_resolutions_updater_exports, {
|
|
@@ -217,7 +312,8 @@ __export(package_resolutions_updater_exports, {
|
|
|
217
312
|
getLatestCommit: () => getLatestCommit,
|
|
218
313
|
getLatestCommitAcrossBranches: () => getLatestCommitAcrossBranches,
|
|
219
314
|
parseGitHubUrl: () => import_git_command_helper.parseGitHubUrl,
|
|
220
|
-
replaceRawWithLatestHash: () => replaceRawWithLatestHash
|
|
315
|
+
replaceRawWithLatestHash: () => replaceRawWithLatestHash,
|
|
316
|
+
resolvePackageResolutionUpdates: () => resolvePackageResolutionUpdates
|
|
221
317
|
});
|
|
222
318
|
module.exports = __toCommonJS(package_resolutions_updater_exports);
|
|
223
319
|
init_cjs_shims();
|
|
@@ -227,86 +323,14 @@ var import_https = __toESM(require("https"), 1);
|
|
|
227
323
|
var import_os = __toESM(require("os"), 1);
|
|
228
324
|
var import_path = __toESM(require("path"), 1);
|
|
229
325
|
var utils = __toESM(require_utils(), 1);
|
|
230
|
-
|
|
231
|
-
// src/utils/findEnvFiles.js
|
|
232
|
-
init_cjs_shims();
|
|
233
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
234
|
-
var import_node_path = __toESM(require("path"), 1);
|
|
235
|
-
var glob = __toESM(require("glob"), 1);
|
|
236
|
-
var DEFAULT_IGNORES = [
|
|
237
|
-
"**/node_modules/**",
|
|
238
|
-
"**/.git/**",
|
|
239
|
-
"**/.yarn/**",
|
|
240
|
-
"**/.pnpm/**",
|
|
241
|
-
"**/dist/**",
|
|
242
|
-
"**/build/**",
|
|
243
|
-
"**/coverage/**",
|
|
244
|
-
"**/vendor/**",
|
|
245
|
-
"**/tmp/**",
|
|
246
|
-
"**/.cache/**",
|
|
247
|
-
"**/assets/**",
|
|
248
|
-
"**/logs/**",
|
|
249
|
-
"**/output/**",
|
|
250
|
-
"**/public/**",
|
|
251
|
-
"**/static/**",
|
|
252
|
-
"**/temp/**",
|
|
253
|
-
"**/backup/**",
|
|
254
|
-
"**/backups/**",
|
|
255
|
-
"**/examples/**",
|
|
256
|
-
"**/docs/**",
|
|
257
|
-
"**/tests/**",
|
|
258
|
-
"**/__tests__/**",
|
|
259
|
-
"**/spec/**",
|
|
260
|
-
"**/__specs__/**",
|
|
261
|
-
"**/scripts/**",
|
|
262
|
-
"**/bin/**",
|
|
263
|
-
"**/hooks/**",
|
|
264
|
-
"**/config/**",
|
|
265
|
-
"**/configs/**",
|
|
266
|
-
"**/settings/**",
|
|
267
|
-
"**/.vscode/**",
|
|
268
|
-
"**/.idea/**"
|
|
269
|
-
];
|
|
270
|
-
function findEnvFiles(startDir = process.cwd(), filter) {
|
|
271
|
-
const found = /* @__PURE__ */ new Set();
|
|
272
|
-
function addFile(file) {
|
|
273
|
-
const normalized = import_node_path.default.normalize(file);
|
|
274
|
-
if (typeof filter === "function" && !filter(normalized)) {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
found.add(normalized);
|
|
278
|
-
}
|
|
279
|
-
let current = import_node_path.default.resolve(startDir);
|
|
280
|
-
while (true) {
|
|
281
|
-
const envPath2 = import_node_path.default.join(current, ".env");
|
|
282
|
-
if (import_node_fs.default.existsSync(envPath2)) {
|
|
283
|
-
addFile(envPath2);
|
|
284
|
-
}
|
|
285
|
-
const parent = import_node_path.default.dirname(current);
|
|
286
|
-
if (parent === current) {
|
|
287
|
-
break;
|
|
288
|
-
}
|
|
289
|
-
current = parent;
|
|
290
|
-
}
|
|
291
|
-
const files = glob.globSync("**/.env*", {
|
|
292
|
-
cwd: startDir,
|
|
293
|
-
absolute: true,
|
|
294
|
-
nodir: true,
|
|
295
|
-
ignore: DEFAULT_IGNORES
|
|
296
|
-
});
|
|
297
|
-
for (const file of files) {
|
|
298
|
-
addFile(file);
|
|
299
|
-
}
|
|
300
|
-
return [...found];
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
// src/package-resolutions-updater.mjs
|
|
326
|
+
var import_findEnvFiles = __toESM(require_findEnvFiles(), 1);
|
|
304
327
|
var import_git_command_helper = require("git-command-helper");
|
|
328
|
+
var import_axios = __toESM(require("axios"), 1);
|
|
305
329
|
var projectDir = process.cwd();
|
|
306
330
|
var envPath = import_path.default.join(projectDir, ".env");
|
|
307
331
|
var args = utils.getArgs();
|
|
308
332
|
if (!import_fs.default.existsSync(envPath)) {
|
|
309
|
-
const envFiles = findEnvFiles(projectDir, (file) => {
|
|
333
|
+
const envFiles = (0, import_findEnvFiles.findEnvFiles)(projectDir, (file) => {
|
|
310
334
|
const content = import_fs.default.readFileSync(file, "utf-8");
|
|
311
335
|
return /GITHUB_TOKEN|ACCESS_TOKEN/.test(content);
|
|
312
336
|
});
|
|
@@ -452,10 +476,91 @@ async function getLatestCommitAcrossBranches(owner, repo) {
|
|
|
452
476
|
};
|
|
453
477
|
}
|
|
454
478
|
function replaceRawWithLatestHash(url, latestHash) {
|
|
455
|
-
const
|
|
456
|
-
if (!
|
|
457
|
-
|
|
458
|
-
|
|
479
|
+
const parsed = (0, import_git_command_helper.parseGitHubUrl)(url);
|
|
480
|
+
if (!parsed || !parsed.owner || !parsed.repo || !parsed.branch) {
|
|
481
|
+
throw new Error("Invalid GitHub raw URL");
|
|
482
|
+
}
|
|
483
|
+
const branchPrefix = `${parsed.branch}/`;
|
|
484
|
+
const rawPrefix = parsed.host === "github.com" ? `raw/${branchPrefix}` : branchPrefix;
|
|
485
|
+
const refsPrefix = `refs/heads/${branchPrefix}`;
|
|
486
|
+
const path2 = parsed.path.startsWith(rawPrefix) ? parsed.path.slice(rawPrefix.length) : parsed.path.startsWith(refsPrefix) ? parsed.path.slice(refsPrefix.length) : parsed.path.startsWith(branchPrefix) ? parsed.path.slice(branchPrefix.length) : parsed.path;
|
|
487
|
+
if (parsed.host === "github.com") {
|
|
488
|
+
return `https://github.com/${parsed.owner}/${parsed.repo}/raw/${latestHash}/${path2}`;
|
|
489
|
+
}
|
|
490
|
+
if (parsed.host === "raw.githubusercontent.com") {
|
|
491
|
+
return `https://raw.githubusercontent.com/${parsed.owner}/${parsed.repo}/${latestHash}/${path2}`;
|
|
492
|
+
}
|
|
493
|
+
throw new Error("Invalid GitHub raw URL");
|
|
494
|
+
}
|
|
495
|
+
async function resolvePackageResolutionUpdates(resolutions, specialPackageOverrides = []) {
|
|
496
|
+
const updates = [];
|
|
497
|
+
for (const [currentPkgName, url] of Object.entries(resolutions || {})) {
|
|
498
|
+
let repo;
|
|
499
|
+
try {
|
|
500
|
+
repo = (0, import_git_command_helper.parseGitHubUrl)(url);
|
|
501
|
+
} catch (error) {
|
|
502
|
+
updates.push({
|
|
503
|
+
skipped: true,
|
|
504
|
+
currentPkgName,
|
|
505
|
+
url,
|
|
506
|
+
error
|
|
507
|
+
});
|
|
508
|
+
continue;
|
|
509
|
+
}
|
|
510
|
+
try {
|
|
511
|
+
const override = specialPackageOverrides.find((p) => p.pkg === currentPkgName);
|
|
512
|
+
const latest = override ? await getLatestCommit(override.owner, override.repo, override.branch) : await getLatestCommitAcrossBranches(repo.owner, repo.repo);
|
|
513
|
+
const new_url = replaceRawWithLatestHash(url, latest.sha);
|
|
514
|
+
await import_axios.default.head(new_url, {
|
|
515
|
+
headers: {
|
|
516
|
+
"User-Agent": selectedUserAgent,
|
|
517
|
+
Accept: "application/vnd.github.v3+json",
|
|
518
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
519
|
+
...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
|
|
520
|
+
}
|
|
521
|
+
}).then((response) => {
|
|
522
|
+
if (response.status < 200 || response.status >= 300) {
|
|
523
|
+
updates.push({
|
|
524
|
+
failed: true,
|
|
525
|
+
currentPkgName,
|
|
526
|
+
url,
|
|
527
|
+
new_url,
|
|
528
|
+
repo,
|
|
529
|
+
latest,
|
|
530
|
+
error: new Error(`New URL is not accessible, status code: ${response.status}`)
|
|
531
|
+
});
|
|
532
|
+
return;
|
|
533
|
+
}
|
|
534
|
+
updates.push({
|
|
535
|
+
currentPkgName,
|
|
536
|
+
url,
|
|
537
|
+
new_url,
|
|
538
|
+
repo,
|
|
539
|
+
latest
|
|
540
|
+
});
|
|
541
|
+
}).catch((e) => {
|
|
542
|
+
updates.push({
|
|
543
|
+
failed: true,
|
|
544
|
+
currentPkgName,
|
|
545
|
+
url,
|
|
546
|
+
new_url,
|
|
547
|
+
repo,
|
|
548
|
+
latest,
|
|
549
|
+
error: new Error(`New URL is not accessible: ${e.message}`)
|
|
550
|
+
});
|
|
551
|
+
return null;
|
|
552
|
+
});
|
|
553
|
+
} catch (error) {
|
|
554
|
+
updates.push({
|
|
555
|
+
failed: true,
|
|
556
|
+
currentPkgName,
|
|
557
|
+
url,
|
|
558
|
+
repo,
|
|
559
|
+
error
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
return updates;
|
|
459
564
|
}
|
|
460
565
|
// Annotate the CommonJS export names for ESM import in node:
|
|
461
566
|
0 && (module.exports = {
|
|
@@ -463,5 +568,6 @@ function replaceRawWithLatestHash(url, latestHash) {
|
|
|
463
568
|
getLatestCommit,
|
|
464
569
|
getLatestCommitAcrossBranches,
|
|
465
570
|
parseGitHubUrl,
|
|
466
|
-
replaceRawWithLatestHash
|
|
571
|
+
replaceRawWithLatestHash,
|
|
572
|
+
resolvePackageResolutionUpdates
|
|
467
573
|
});
|
|
@@ -28,5 +28,24 @@ export function getLatestCommitAcrossBranches(owner: any, repo: any): Promise<{
|
|
|
28
28
|
* Replace the branch or commit in a GitHub raw URL with the latest hash.
|
|
29
29
|
*/
|
|
30
30
|
export function replaceRawWithLatestHash(url: any, latestHash: any): string;
|
|
31
|
+
/**
|
|
32
|
+
* Resolve all package resolution updates.
|
|
33
|
+
* Pure logic function for Jest testing.
|
|
34
|
+
*/
|
|
35
|
+
export function resolvePackageResolutionUpdates(resolutions: any, specialPackageOverrides?: any[]): Promise<({
|
|
36
|
+
skipped: boolean;
|
|
37
|
+
currentPkgName: string;
|
|
38
|
+
url: any;
|
|
39
|
+
error: unknown;
|
|
40
|
+
failed?: undefined;
|
|
41
|
+
repo?: undefined;
|
|
42
|
+
} | {
|
|
43
|
+
failed: boolean;
|
|
44
|
+
currentPkgName: string;
|
|
45
|
+
url: any;
|
|
46
|
+
repo: import("git-command-helper").ParsedGitHubUrl;
|
|
47
|
+
error: unknown;
|
|
48
|
+
skipped?: undefined;
|
|
49
|
+
})[]>;
|
|
31
50
|
export { parseGitHubUrl };
|
|
32
|
-
import { parseGitHubUrl } from
|
|
51
|
+
import { parseGitHubUrl } from 'git-command-helper';
|
|
@@ -4,15 +4,17 @@ import {
|
|
|
4
4
|
getLatestCommit,
|
|
5
5
|
getLatestCommitAcrossBranches,
|
|
6
6
|
parseGitHubUrl,
|
|
7
|
-
replaceRawWithLatestHash
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
import "./chunk-
|
|
7
|
+
replaceRawWithLatestHash,
|
|
8
|
+
resolvePackageResolutionUpdates
|
|
9
|
+
} from "./chunk-66KDU4TX.mjs";
|
|
10
|
+
import "./chunk-H44UWUFY.mjs";
|
|
11
|
+
import "./chunk-5RTXZVCW.mjs";
|
|
11
12
|
import "./chunk-QQ4A6DLD.mjs";
|
|
12
13
|
export {
|
|
13
14
|
fetchJson,
|
|
14
15
|
getLatestCommit,
|
|
15
16
|
getLatestCommitAcrossBranches,
|
|
16
17
|
parseGitHubUrl,
|
|
17
|
-
replaceRawWithLatestHash
|
|
18
|
+
replaceRawWithLatestHash,
|
|
19
|
+
resolvePackageResolutionUpdates
|
|
18
20
|
};
|
|
@@ -88,7 +88,7 @@ var require_utils = __commonJS({
|
|
|
88
88
|
try {
|
|
89
89
|
fs2.rmdirSync(fullPath);
|
|
90
90
|
console.log("deleted", fullPath);
|
|
91
|
-
} catch (
|
|
91
|
+
} catch (_e) {
|
|
92
92
|
try {
|
|
93
93
|
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
94
94
|
console.log("deleted", fullPath);
|
|
@@ -101,7 +101,7 @@ var require_utils = __commonJS({
|
|
|
101
101
|
try {
|
|
102
102
|
fs2.unlinkSync(fullPath);
|
|
103
103
|
console.log("deleted", fullPath);
|
|
104
|
-
} catch (
|
|
104
|
+
} catch (_e) {
|
|
105
105
|
try {
|
|
106
106
|
fs2.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
107
107
|
console.log("deleted", fullPath);
|
|
@@ -13,10 +13,10 @@ exports.default = default_1;
|
|
|
13
13
|
function default_1(tdArray, indicator, hardlink) {
|
|
14
14
|
hardlink = hardlink || false;
|
|
15
15
|
if (!tdArray) {
|
|
16
|
-
throw new Error(
|
|
16
|
+
throw new Error('tdArray must be provided');
|
|
17
17
|
}
|
|
18
18
|
if (!indicator) {
|
|
19
|
-
throw new Error(
|
|
19
|
+
throw new Error('indicator must be provided');
|
|
20
20
|
}
|
|
21
21
|
// clone 一份数据,因为需要对饮用进行修改,方便执行
|
|
22
22
|
tdArray = JSON.parse(JSON.stringify(tdArray));
|
|
@@ -34,21 +34,21 @@ function default_1(tdArray, indicator, hardlink) {
|
|
|
34
34
|
var neighbours = [];
|
|
35
35
|
// top neighbour
|
|
36
36
|
if (tdArray[y - 1] && tdArray[y - 1][x] !== undefined) {
|
|
37
|
-
neighbours.push(pointsHash[x +
|
|
37
|
+
neighbours.push(pointsHash[x + '_' + (y - 1)]);
|
|
38
38
|
}
|
|
39
39
|
// left neighbour
|
|
40
40
|
if (row[x - 1] !== undefined) {
|
|
41
|
-
neighbours.push(pointsHash[x - 1 +
|
|
41
|
+
neighbours.push(pointsHash[x - 1 + '_' + y]);
|
|
42
42
|
}
|
|
43
43
|
// soft link will treat corner link as domain link.
|
|
44
44
|
if (!hardlink) {
|
|
45
45
|
// top left neighbour
|
|
46
46
|
if (tdArray[y - 1] && tdArray[y - 1][x - 1] !== undefined) {
|
|
47
|
-
neighbours.push(pointsHash[x - 1 +
|
|
47
|
+
neighbours.push(pointsHash[x - 1 + '_' + (y - 1)]);
|
|
48
48
|
}
|
|
49
49
|
// top right neighbour
|
|
50
50
|
if (tdArray[y - 1] && tdArray[y - 1][x + 1] !== undefined) {
|
|
51
|
-
neighbours.push(pointsHash[x + 1 +
|
|
51
|
+
neighbours.push(pointsHash[x + 1 + '_' + (y - 1)]);
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
if (neighbours.length) {
|
|
@@ -63,7 +63,7 @@ function default_1(tdArray, indicator, hardlink) {
|
|
|
63
63
|
// If more than one neighbour matched, check if these neighbours belong to the same domain
|
|
64
64
|
// If not, merge these domains since they connects to each other.
|
|
65
65
|
else {
|
|
66
|
-
var colItemPoint = pointsHash[x +
|
|
66
|
+
var colItemPoint = pointsHash[x + '_' + y];
|
|
67
67
|
if (neighbour.domainId != colItemPoint.domainId) {
|
|
68
68
|
mergeDomains(neighbour.domainId, colItemPoint.domainId);
|
|
69
69
|
}
|
|
@@ -150,7 +150,7 @@ function default_1(tdArray, indicator, hardlink) {
|
|
|
150
150
|
identifier: identifier,
|
|
151
151
|
domainId: newDomain.domainId
|
|
152
152
|
};
|
|
153
|
-
pointsHash[x +
|
|
153
|
+
pointsHash[x + '_' + y] = {
|
|
154
154
|
value: point,
|
|
155
155
|
identifier: identifier,
|
|
156
156
|
domainId: newDomain.domainId
|
|
@@ -174,7 +174,7 @@ function default_1(tdArray, indicator, hardlink) {
|
|
|
174
174
|
identifier: domain.identifier,
|
|
175
175
|
domainId: domainId
|
|
176
176
|
};
|
|
177
|
-
pointsHash[x +
|
|
177
|
+
pointsHash[x + '_' + y] = {
|
|
178
178
|
value: point,
|
|
179
179
|
identifier: domain.identifier,
|
|
180
180
|
domainId: domainId
|
|
@@ -194,7 +194,7 @@ function default_1(tdArray, indicator, hardlink) {
|
|
|
194
194
|
domainB.domainId = domainA.domainId;
|
|
195
195
|
domainB.points.forEach(function (point) {
|
|
196
196
|
point.domainId = domainA.domainId;
|
|
197
|
-
pointsHash[point.x +
|
|
197
|
+
pointsHash[point.x + '_' + point.y].domainId = domainA.domainId;
|
|
198
198
|
});
|
|
199
199
|
domainA.points = domainA.points.concat(domainB.points);
|
|
200
200
|
// 删除domainB
|
package/lib/ps/index.cjs
CHANGED