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
package/lib/kill-night-crows.cjs
CHANGED
|
@@ -65,19 +65,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
|
|
|
65
65
|
process.exit(0);
|
|
66
66
|
}
|
|
67
67
|
if (!scriptPath) {
|
|
68
|
-
console.error(
|
|
69
|
-
|
|
68
|
+
console.error(
|
|
69
|
+
`PowerShell script not found in any of these paths:
|
|
70
|
+
${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
|
|
71
|
+
);
|
|
70
72
|
process.exit(1);
|
|
71
73
|
}
|
|
72
74
|
if (process.platform !== "win32") {
|
|
73
75
|
console.error("kill-night-crows is supported only on Windows.");
|
|
74
76
|
process.exit(1);
|
|
75
77
|
}
|
|
76
|
-
var result = (0, import_node_child_process.spawnSync)(
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
{ stdio: "inherit" }
|
|
80
|
-
);
|
|
78
|
+
var result = (0, import_node_child_process.spawnSync)("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
|
|
79
|
+
stdio: "inherit"
|
|
80
|
+
});
|
|
81
81
|
if (typeof result.status === "number") {
|
|
82
82
|
process.exit(result.status);
|
|
83
83
|
}
|
package/lib/kill-night-crows.mjs
CHANGED
|
@@ -43,19 +43,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
|
|
|
43
43
|
process.exit(0);
|
|
44
44
|
}
|
|
45
45
|
if (!scriptPath) {
|
|
46
|
-
console.error(
|
|
47
|
-
|
|
46
|
+
console.error(
|
|
47
|
+
`PowerShell script not found in any of these paths:
|
|
48
|
+
${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
|
|
49
|
+
);
|
|
48
50
|
process.exit(1);
|
|
49
51
|
}
|
|
50
52
|
if (process.platform !== "win32") {
|
|
51
53
|
console.error("kill-night-crows is supported only on Windows.");
|
|
52
54
|
process.exit(1);
|
|
53
55
|
}
|
|
54
|
-
var result = spawnSync(
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
{ stdio: "inherit" }
|
|
58
|
-
);
|
|
56
|
+
var result = spawnSync("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
|
|
57
|
+
stdio: "inherit"
|
|
58
|
+
});
|
|
59
59
|
if (typeof result.status === "number") {
|
|
60
60
|
process.exit(result.status);
|
|
61
61
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/node-cache-cleaner/npm.ts
|
|
20
|
+
var npm_exports = {};
|
|
21
|
+
__export(npm_exports, {
|
|
22
|
+
cleanNpmCache: () => cleanNpmCache,
|
|
23
|
+
npmVersion: () => npmVersion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(npm_exports);
|
|
26
|
+
var import_cross_spawn = require("cross-spawn");
|
|
27
|
+
function npmVersion() {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const process = (0, import_cross_spawn.spawn)("npm", ["--version"], {
|
|
30
|
+
stdio: "pipe",
|
|
31
|
+
shell: true
|
|
32
|
+
});
|
|
33
|
+
let version = "";
|
|
34
|
+
process.stdout.on("data", (data) => {
|
|
35
|
+
version += data.toString();
|
|
36
|
+
});
|
|
37
|
+
process.on("close", (code) => {
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
resolve(version.trim());
|
|
40
|
+
} else {
|
|
41
|
+
reject(new Error(`NPM version check failed with exit code ${code}`));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function cleanNpmCache() {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const process = (0, import_cross_spawn.spawn)("npm", ["cache", "clean", "--force"], {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
shell: true
|
|
51
|
+
});
|
|
52
|
+
process.on("close", (code) => {
|
|
53
|
+
if (code === 0) {
|
|
54
|
+
resolve(true);
|
|
55
|
+
} else {
|
|
56
|
+
reject(new Error(`NPM cache clean failed with exit code ${code}`));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
cleanNpmCache,
|
|
64
|
+
npmVersion
|
|
65
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.npmVersion = npmVersion;
|
|
4
|
+
exports.cleanNpmCache = cleanNpmCache;
|
|
5
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
6
|
+
function npmVersion() {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const process = (0, cross_spawn_1.spawn)('npm', ['--version'], {
|
|
9
|
+
stdio: 'pipe',
|
|
10
|
+
shell: true
|
|
11
|
+
});
|
|
12
|
+
let version = '';
|
|
13
|
+
process.stdout.on('data', (data) => {
|
|
14
|
+
version += data.toString();
|
|
15
|
+
});
|
|
16
|
+
process.on('close', (code) => {
|
|
17
|
+
if (code === 0) {
|
|
18
|
+
resolve(version.trim());
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
reject(new Error(`NPM version check failed with exit code ${code}`));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function cleanNpmCache() {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const process = (0, cross_spawn_1.spawn)('npm', ['cache', 'clean', '--force'], {
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
shell: true
|
|
31
|
+
});
|
|
32
|
+
process.on('close', (code) => {
|
|
33
|
+
if (code === 0) {
|
|
34
|
+
resolve(true);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
reject(new Error(`NPM cache clean failed with exit code ${code}`));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
28
|
+
|
|
29
|
+
// src/node-cache-cleaner/npx.ts
|
|
30
|
+
var npx_exports = {};
|
|
31
|
+
__export(npx_exports, {
|
|
32
|
+
cleanNpxCache: () => cleanNpxCache
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(npx_exports);
|
|
35
|
+
var import_fs_extra = __toESM(require("fs-extra"), 1);
|
|
36
|
+
var import_upath = __toESM(require("upath"), 1);
|
|
37
|
+
var import_os = __toESM(require("os"), 1);
|
|
38
|
+
var import_cross_spawn = require("cross-spawn");
|
|
39
|
+
function getNpmCacheDir() {
|
|
40
|
+
return new Promise((resolve, reject) => {
|
|
41
|
+
var _a, _b;
|
|
42
|
+
const child = (0, import_cross_spawn.spawn)("npm", ["config", "get", "cache"], {
|
|
43
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
44
|
+
shell: true
|
|
45
|
+
});
|
|
46
|
+
let output = "";
|
|
47
|
+
let error = "";
|
|
48
|
+
(_a = child.stdout) == null ? void 0 : _a.on("data", (data) => {
|
|
49
|
+
output += data.toString();
|
|
50
|
+
});
|
|
51
|
+
(_b = child.stderr) == null ? void 0 : _b.on("data", (data) => {
|
|
52
|
+
error += data.toString();
|
|
53
|
+
});
|
|
54
|
+
child.on("close", (code) => {
|
|
55
|
+
if (code === 0) {
|
|
56
|
+
resolve(output.trim());
|
|
57
|
+
} else {
|
|
58
|
+
reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
async function removeDir(target) {
|
|
64
|
+
try {
|
|
65
|
+
const exists = await import_fs_extra.default.pathExists(target);
|
|
66
|
+
if (exists) {
|
|
67
|
+
console.log(`Removing: ${target}`);
|
|
68
|
+
await import_fs_extra.default.remove(target);
|
|
69
|
+
} else {
|
|
70
|
+
console.log(`Not found: ${target}`);
|
|
71
|
+
}
|
|
72
|
+
} catch (err) {
|
|
73
|
+
console.error(`Failed to remove ${target}:`, err);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
async function cleanNpxCache() {
|
|
77
|
+
const cacheDir = await getNpmCacheDir();
|
|
78
|
+
console.log("Detected npm cache:", cacheDir);
|
|
79
|
+
console.log("\nCleaning npm/npx cache...\n");
|
|
80
|
+
const npxCache = import_upath.default.join(cacheDir, "_npx");
|
|
81
|
+
const npmCache = import_upath.default.join(cacheDir, "_cacache");
|
|
82
|
+
const altNpxLinux = import_upath.default.join(import_os.default.homedir(), ".cache", "npx");
|
|
83
|
+
await Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
|
|
84
|
+
console.log("\nDone \u2714\uFE0F");
|
|
85
|
+
}
|
|
86
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
87
|
+
0 && (module.exports = {
|
|
88
|
+
cleanNpxCache
|
|
89
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.cleanNpxCache = cleanNpxCache;
|
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
+
const upath_1 = __importDefault(require("upath"));
|
|
18
|
+
const os_1 = __importDefault(require("os"));
|
|
19
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
20
|
+
/**
|
|
21
|
+
* Get npm cache directory using `npm config get cache`
|
|
22
|
+
*/
|
|
23
|
+
function getNpmCacheDir() {
|
|
24
|
+
return new Promise((resolve, reject) => {
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const child = (0, cross_spawn_1.spawn)('npm', ['config', 'get', 'cache'], {
|
|
27
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
28
|
+
shell: true
|
|
29
|
+
});
|
|
30
|
+
let output = '';
|
|
31
|
+
let error = '';
|
|
32
|
+
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (data) => {
|
|
33
|
+
output += data.toString();
|
|
34
|
+
});
|
|
35
|
+
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (data) => {
|
|
36
|
+
error += data.toString();
|
|
37
|
+
});
|
|
38
|
+
child.on('close', (code) => {
|
|
39
|
+
if (code === 0) {
|
|
40
|
+
resolve(output.trim());
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Remove directory safely
|
|
50
|
+
*/
|
|
51
|
+
function removeDir(target) {
|
|
52
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
+
try {
|
|
54
|
+
const exists = yield fs_extra_1.default.pathExists(target);
|
|
55
|
+
if (exists) {
|
|
56
|
+
console.log(`Removing: ${target}`);
|
|
57
|
+
yield fs_extra_1.default.remove(target);
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
console.log(`Not found: ${target}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
console.error(`Failed to remove ${target}:`, err);
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Main cleaner
|
|
70
|
+
*/
|
|
71
|
+
function cleanNpxCache() {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const cacheDir = yield getNpmCacheDir();
|
|
74
|
+
console.log('Detected npm cache:', cacheDir);
|
|
75
|
+
console.log('\nCleaning npm/npx cache...\n');
|
|
76
|
+
const npxCache = upath_1.default.join(cacheDir, '_npx');
|
|
77
|
+
const npmCache = upath_1.default.join(cacheDir, '_cacache');
|
|
78
|
+
const altNpxLinux = upath_1.default.join(os_1.default.homedir(), '.cache', 'npx');
|
|
79
|
+
yield Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
|
|
80
|
+
console.log('\nDone ✔️');
|
|
81
|
+
});
|
|
82
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
-
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
cleanNpxCache
|
|
4
|
+
} from "../chunk-OXV52GD5.mjs";
|
|
5
|
+
import "../chunk-QQ4A6DLD.mjs";
|
|
6
|
+
export {
|
|
7
|
+
cleanNpxCache
|
|
8
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/node-cache-cleaner/yarn.ts
|
|
20
|
+
var yarn_exports = {};
|
|
21
|
+
__export(yarn_exports, {
|
|
22
|
+
cleanYarnCache: () => cleanYarnCache,
|
|
23
|
+
yarnVersion: () => yarnVersion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(yarn_exports);
|
|
26
|
+
var import_cross_spawn = require("cross-spawn");
|
|
27
|
+
function yarnVersion() {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const process = (0, import_cross_spawn.spawn)("yarn", ["--version"], {
|
|
30
|
+
stdio: "pipe",
|
|
31
|
+
shell: true
|
|
32
|
+
});
|
|
33
|
+
let version = "";
|
|
34
|
+
process.stdout.on("data", (data) => {
|
|
35
|
+
version += data.toString();
|
|
36
|
+
});
|
|
37
|
+
process.on("close", (code) => {
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
resolve(version.trim());
|
|
40
|
+
} else {
|
|
41
|
+
reject(new Error(`Yarn version check failed with exit code ${code}`));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
async function cleanYarnCache() {
|
|
47
|
+
let version = "";
|
|
48
|
+
try {
|
|
49
|
+
version = await yarnVersion();
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
const major = parseInt(version.split(".")[0], 10);
|
|
53
|
+
const isClassic = major === 1 || version === "";
|
|
54
|
+
const args = isClassic ? ["cache", "clean"] : ["cache", "clean", "--all"];
|
|
55
|
+
return new Promise((resolve, reject) => {
|
|
56
|
+
const process = (0, import_cross_spawn.spawn)("yarn", args, {
|
|
57
|
+
stdio: "inherit",
|
|
58
|
+
shell: true
|
|
59
|
+
});
|
|
60
|
+
process.on("close", (code) => {
|
|
61
|
+
if (code === 0) {
|
|
62
|
+
resolve(true);
|
|
63
|
+
} else {
|
|
64
|
+
reject(new Error(`Yarn cache clean failed with exit code ${code}`));
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
70
|
+
0 && (module.exports = {
|
|
71
|
+
cleanYarnCache,
|
|
72
|
+
yarnVersion
|
|
73
|
+
});
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.yarnVersion = yarnVersion;
|
|
13
|
+
exports.cleanYarnCache = cleanYarnCache;
|
|
14
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
15
|
+
function yarnVersion() {
|
|
16
|
+
return new Promise((resolve, reject) => {
|
|
17
|
+
const process = (0, cross_spawn_1.spawn)('yarn', ['--version'], {
|
|
18
|
+
stdio: 'pipe',
|
|
19
|
+
shell: true
|
|
20
|
+
});
|
|
21
|
+
let version = '';
|
|
22
|
+
process.stdout.on('data', (data) => {
|
|
23
|
+
version += data.toString();
|
|
24
|
+
});
|
|
25
|
+
process.on('close', (code) => {
|
|
26
|
+
if (code === 0) {
|
|
27
|
+
resolve(version.trim());
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
reject(new Error(`Yarn version check failed with exit code ${code}`));
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function cleanYarnCache() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
let version = '';
|
|
38
|
+
try {
|
|
39
|
+
version = yield yarnVersion();
|
|
40
|
+
}
|
|
41
|
+
catch (_a) {
|
|
42
|
+
// if version check fails, just try the generic command
|
|
43
|
+
}
|
|
44
|
+
const major = parseInt(version.split('.')[0], 10);
|
|
45
|
+
const isClassic = major === 1 || version === '';
|
|
46
|
+
const args = isClassic ? ['cache', 'clean'] : ['cache', 'clean', '--all'];
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const process = (0, cross_spawn_1.spawn)('yarn', args, {
|
|
49
|
+
stdio: 'inherit',
|
|
50
|
+
shell: true
|
|
51
|
+
});
|
|
52
|
+
process.on('close', (code) => {
|
|
53
|
+
if (code === 0) {
|
|
54
|
+
resolve(true);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
reject(new Error(`Yarn cache clean failed with exit code ${code}`));
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|