binary-collections 2.0.11 → 2.0.13
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/binaries/binary-executor.cjs +89 -13
- package/binaries/clean-nodemodule.cjs +89 -13
- package/binaries/clean-nodemodules.cjs +89 -13
- package/binaries/dev.cjs +89 -13
- package/binaries/empty.cjs +89 -13
- package/binaries/git-reduce-size.cjs +89 -13
- package/binaries/javakill.cjs +89 -13
- package/binaries/kill-process.cjs +89 -13
- package/binaries/nodekill.cjs +89 -13
- package/binaries/prod.cjs +89 -13
- package/binaries/py.cjs +89 -13
- package/binaries/rmfind.cjs +89 -13
- package/binaries/rmx +15 -1
- package/binaries/rmx.cjs +89 -13
- package/binaries/rmx.cmd +12 -0
- package/binaries/submodule-token.cjs +89 -13
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cjs +89 -13
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +254 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cjs +89 -13
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +131 -0
- package/binaries/yc.cjs +254 -0
- package/binaries/ycw +256 -0
- package/binaries/ycw.cjs +254 -0
- package/docs-src/binary-collections.md +34 -0
- package/docs-src/changelog.md +26 -0
- package/docs-src/clean-github-actions-caches.md +91 -2
- package/docs-src/copy-move-file.md +59 -0
- package/docs-src/del-gradle.md +17 -0
- package/docs-src/del-ps.md +28 -0
- package/docs-src/downloader.md +62 -0
- package/docs-src/env-helpers.md +29 -0
- package/docs-src/find-node-modules.md +17 -0
- package/docs-src/git-diff.md +33 -0
- package/docs-src/git-fix.md +34 -0
- package/docs-src/git-purge.md +17 -0
- package/docs-src/git-reduce-size.md +17 -0
- package/docs-src/git-undo.md +21 -0
- package/docs-src/kill-night-crows.md +26 -0
- package/docs-src/node-cache-cleaner.md +182 -0
- package/docs-src/node-executor.md +50 -0
- package/docs-src/node-package-packer.md +48 -0
- package/docs-src/npm-run-series.md +43 -0
- package/docs-src/package-resolutions-updater.md +22 -0
- package/docs-src/php-cs-fixer-staged.md +19 -0
- package/docs-src/print-directory-tree.md +35 -0
- package/docs-src/print-tarball-tree.md +55 -0
- package/docs-src/py.md +19 -0
- package/docs-src/remove-module.md +32 -0
- package/docs-src/rmfind-rmx.md +21 -0
- package/docs-src/rmpath.md +38 -0
- package/docs-src/run-by-checksum.md +87 -0
- package/docs-src/submodule-install.md +31 -0
- package/docs-src/submodule-remove.md +22 -0
- package/docs-src/submodule-token.md +17 -0
- package/docs-src/test-runners.md +21 -0
- package/docs-src/yarn-install.md +31 -0
- package/docs-src/yarn-reinstall.md +27 -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 +309 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +291 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +264 -157
- package/lib/binary-collections.mjs +26 -286
- package/lib/changelog.cjs +9 -14
- package/lib/changelog.mjs +2 -2
- package/lib/chunk-2MN4VPV2.mjs +246 -0
- package/lib/chunk-6C7KTYGZ.mjs +41 -0
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-6RK5UCTP.mjs} +7 -12
- package/lib/chunk-CD3HF3LK.mjs +190 -0
- package/lib/chunk-FLYSZFLW.mjs +61 -0
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-KLKAIFKI.mjs +40 -0
- package/lib/chunk-LVSPEFU2.mjs +86 -0
- package/lib/{chunk-RWLXRTYP.mjs → chunk-MGPYPKIE.mjs} +2 -2
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NQXUYO67.mjs +253 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OBXLTXFJ.mjs +34 -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-QD4T255Z.mjs +40 -0
- package/lib/chunk-QII2EKCS.mjs +26 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-RDGDLSPD.mjs +76 -0
- package/lib/chunk-RDN6HF5Z.mjs +79 -0
- package/lib/chunk-RJKTSUAX.mjs +123 -0
- package/lib/{chunk-XA3SNBPA.mjs → chunk-TBWXE7ST.mjs} +97 -38
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
- package/lib/chunk-WSHVPGNM.mjs +44 -0
- package/lib/{chunk-66PAU5PS.mjs → chunk-X2B3X7D4.mjs} +10 -6
- package/lib/clean-github-actions-caches-cli.cjs +507 -0
- package/lib/clean-github-actions-caches-cli.mjs +74 -0
- package/lib/clean-github-actions-caches.cjs +246 -106
- package/lib/clean-github-actions-caches.d.cts +53 -1
- package/lib/clean-github-actions-caches.mjs +5 -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/{ps/isWin.mjs → cross-env/command.mjs} +4 -5
- 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 +8 -13
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +185 -3
- package/lib/del-node-modules.js +25 -25
- package/lib/del-node-modules.mjs +6 -3
- package/lib/{del-ps.cjs → del-ps-cli.cjs} +38 -43
- package/lib/del-ps-cli.d.mts +1 -0
- package/lib/del-ps-cli.mjs +44 -0
- package/lib/del-yarn-caches.cjs +8 -13
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/downloader-cli.cjs +256 -0
- package/lib/downloader-cli.d.cts +2 -0
- package/lib/downloader-cli.mjs +90 -0
- package/lib/file/copy-cli.cjs +273 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +59 -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 +272 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +59 -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.cjs +1 -1
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/find-node-modules-cli.mjs +1 -1
- package/lib/find-node-modules.cjs +1 -1
- package/lib/find-node-modules.mjs +1 -1
- package/lib/free-chatgpt.cjs +27 -26
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +9 -14
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +273 -66
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +273 -66
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +153 -39
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +9 -14
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +9 -14
- package/lib/git-purge.mjs +2 -2
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +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 +365 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +57 -0
- package/lib/node-cache-cleaner-cli.mjs +60 -0
- package/lib/node-executor.cjs +272 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +106 -0
- package/lib/node-package-packer/build-readme.cjs +150 -0
- package/lib/node-package-packer/build-readme.d.mts +10 -0
- package/lib/node-package-packer/build-readme.mjs +10 -0
- package/lib/node-package-packer/build-tarball.cjs +495 -0
- package/lib/node-package-packer/build-tarball.d.mts +33 -0
- package/lib/node-package-packer/build-tarball.mjs +175 -0
- package/lib/node-package-packer-cli.cjs +525 -0
- package/lib/node-package-packer-cli.d.mts +1 -0
- package/lib/node-package-packer-cli.mjs +34 -0
- package/lib/npm-run-series.cjs +28 -40
- package/lib/npm-run-series.mjs +21 -7
- package/lib/package-resolutions-updater-cli.cjs +255 -173
- package/lib/package-resolutions-updater-cli.mjs +19 -40
- package/lib/package-resolutions-updater.cjs +244 -141
- package/lib/package-resolutions-updater.d.mts +54 -1
- package/lib/package-resolutions-updater.mjs +8 -5
- package/lib/php-cs-fixer-staged.cjs +1 -1
- package/lib/php-cs-fixer-staged.mjs +1 -1
- package/lib/print-directory-tree.cjs +18 -20
- package/lib/print-directory-tree.mjs +11 -8
- package/lib/print-tarball-tree.cjs +262 -0
- package/lib/print-tarball-tree.d.mts +1 -0
- package/lib/print-tarball-tree.mjs +68 -0
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +11 -11
- package/lib/ps/index.mjs +180 -174
- package/lib/ps/table-parser.d.ts +3 -4
- package/lib/ps/table-parser.js +15 -22
- package/lib/remove-module.cjs +19 -24
- package/lib/remove-module.mjs +2 -2
- package/lib/rm-node-module-cli.cjs +389 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +92 -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-cli.cjs +285 -0
- package/lib/rmpath-cli.d.mts +1 -0
- package/lib/rmpath-cli.mjs +23 -0
- package/lib/rmpath.cjs +6 -217
- package/lib/rmpath.mjs +5 -101
- package/lib/run-by-checksum/cache.cjs +69 -0
- package/lib/run-by-checksum/cache.d.ts +19 -0
- package/lib/run-by-checksum/cache.js +50 -0
- package/lib/run-by-checksum/cache.mjs +12 -0
- package/lib/run-by-checksum/hash.cjs +72 -0
- package/lib/run-by-checksum/hash.d.ts +14 -0
- package/lib/run-by-checksum/hash.js +85 -0
- package/lib/run-by-checksum/hash.mjs +10 -0
- package/lib/run-by-checksum/run.cjs +169 -0
- package/lib/run-by-checksum/run.d.ts +22 -0
- package/lib/run-by-checksum/run.js +93 -0
- package/lib/run-by-checksum/run.mjs +10 -0
- package/lib/run-by-checksum-cli.cjs +382 -0
- package/lib/run-by-checksum-cli.d.ts +2 -0
- package/lib/run-by-checksum-cli.js +43 -0
- package/lib/run-by-checksum-cli.mjs +56 -0
- package/lib/submodule-install.cjs +55 -47
- package/lib/submodule-install.mjs +48 -35
- package/lib/submodule-remove-cli.cjs +170 -4
- package/lib/submodule-remove-cli.js +5 -5
- package/lib/submodule-remove-cli.mjs +6 -4
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/fetchResponse.cjs +24 -0
- package/lib/utils/fetchResponse.d.cts +25 -0
- package/lib/utils/fetchResponse.mjs +6 -0
- 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 +7 -12
- package/lib/utils/index.d.cts +2 -9
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/isWin.cjs → utils/isWindows.cjs} +12 -7
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +10 -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 +288 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +122 -0
- package/lib/yarn-reinstall.cjs +8 -13
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +91 -57
- package/readme.html +784 -0
- package/readme.md +107 -219
- package/releases/readme.md +6 -3
- package/test/README.md +2 -2
- 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/readme.md +12 -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/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
- package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
- 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-6HHJRKFB.mjs +0 -59
- package/lib/chunk-6S4NXESK.mjs +0 -26
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-AJDD5DZM.mjs +0 -109
- 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-NCXAP7AA.mjs +0 -31
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- 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/del-ps.js +0 -32
- package/lib/del-ps.mjs +0 -43
- package/lib/ps/index.d.cjs +0 -17
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/ps/isWin.d.ts +0 -2
- package/lib/ps/isWin.js +0 -4
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/test/package.json +0 -20
- package/test-project/package.json +0 -16
- package/tmp/test-repo/package.json +0 -7
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
- /package/lib/{del-ps.d.ts → clean-github-actions-caches-cli.d.cts} +0 -0
|
@@ -17,11 +17,11 @@ var init_cjs_shims = __esm({
|
|
|
17
17
|
var require_utils = __commonJS({
|
|
18
18
|
"src/utils/index.cjs"(exports2, module2) {
|
|
19
19
|
init_cjs_shims();
|
|
20
|
-
var
|
|
20
|
+
var fs = require("fs");
|
|
21
21
|
var path2 = require("upath");
|
|
22
|
-
var
|
|
22
|
+
var minimistLib = require("minimist");
|
|
23
|
+
var argv = minimistLib(process.argv.slice(2));
|
|
23
24
|
var { exec } = require("child_process");
|
|
24
|
-
var { URL: URL2 } = require("url");
|
|
25
25
|
var { promisify } = require("util");
|
|
26
26
|
var execAsync = promisify(exec);
|
|
27
27
|
async function parseGitRemotes() {
|
|
@@ -34,7 +34,7 @@ var require_utils = __commonJS({
|
|
|
34
34
|
if (name && url) {
|
|
35
35
|
const [repoUrl] = url.split(" ");
|
|
36
36
|
try {
|
|
37
|
-
const parsedUrl = new
|
|
37
|
+
const parsedUrl = new URL(repoUrl);
|
|
38
38
|
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
39
39
|
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
40
40
|
let repoPath = pathParts.join("/");
|
|
@@ -55,25 +55,20 @@ var require_utils = __commonJS({
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
58
|
+
function getArgs2(opts) {
|
|
59
|
+
if (opts) {
|
|
60
|
+
return minimistLib(process.argv.slice(2), opts);
|
|
62
61
|
}
|
|
63
|
-
return fullPath;
|
|
64
|
-
}
|
|
65
|
-
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
66
|
-
function getArgs2() {
|
|
67
62
|
return argv;
|
|
68
63
|
}
|
|
69
64
|
module2.exports.getArgs = getArgs2;
|
|
70
65
|
function del(fullPath) {
|
|
71
66
|
try {
|
|
72
|
-
if (!
|
|
73
|
-
const stat =
|
|
67
|
+
if (!fs.existsSync(fullPath)) return;
|
|
68
|
+
const stat = fs.lstatSync(fullPath);
|
|
74
69
|
if (stat.isSymbolicLink()) {
|
|
75
70
|
try {
|
|
76
|
-
|
|
71
|
+
fs.unlinkSync(fullPath);
|
|
77
72
|
console.log("deleted symlink", fullPath);
|
|
78
73
|
} catch (e) {
|
|
79
74
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -81,16 +76,16 @@ var require_utils = __commonJS({
|
|
|
81
76
|
return;
|
|
82
77
|
}
|
|
83
78
|
if (stat.isDirectory()) {
|
|
84
|
-
const subdir =
|
|
79
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
85
80
|
for (let i = 0; i < subdir.length; i++) {
|
|
86
81
|
del(subdir[i]);
|
|
87
82
|
}
|
|
88
83
|
try {
|
|
89
|
-
|
|
84
|
+
fs.rmdirSync(fullPath);
|
|
90
85
|
console.log("deleted", fullPath);
|
|
91
|
-
} catch (
|
|
86
|
+
} catch (_e) {
|
|
92
87
|
try {
|
|
93
|
-
|
|
88
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
94
89
|
console.log("deleted", fullPath);
|
|
95
90
|
} catch (ee) {
|
|
96
91
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -99,11 +94,11 @@ var require_utils = __commonJS({
|
|
|
99
94
|
return;
|
|
100
95
|
}
|
|
101
96
|
try {
|
|
102
|
-
|
|
97
|
+
fs.unlinkSync(fullPath);
|
|
103
98
|
console.log("deleted", fullPath);
|
|
104
|
-
} catch (
|
|
99
|
+
} catch (_e) {
|
|
105
100
|
try {
|
|
106
|
-
|
|
101
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
107
102
|
console.log("deleted", fullPath);
|
|
108
103
|
} catch (ee) {
|
|
109
104
|
console.log("failed delete", fullPath, ee && ee.message);
|
|
@@ -118,11 +113,11 @@ var require_utils = __commonJS({
|
|
|
118
113
|
globStream.stream().on("data", (result) => {
|
|
119
114
|
const fullPath = path2.resolve(process.cwd(), result);
|
|
120
115
|
try {
|
|
121
|
-
if (
|
|
122
|
-
const stat =
|
|
116
|
+
if (fs.existsSync(fullPath)) {
|
|
117
|
+
const stat = fs.lstatSync(fullPath);
|
|
123
118
|
if (stat.isSymbolicLink()) {
|
|
124
119
|
try {
|
|
125
|
-
|
|
120
|
+
fs.unlinkSync(fullPath);
|
|
126
121
|
console.log("deleted symlink", fullPath);
|
|
127
122
|
} catch (e) {
|
|
128
123
|
console.log("failed delete symlink", fullPath, e && e.message);
|
|
@@ -130,7 +125,7 @@ var require_utils = __commonJS({
|
|
|
130
125
|
return;
|
|
131
126
|
}
|
|
132
127
|
if (stat.isDirectory()) {
|
|
133
|
-
const subdir =
|
|
128
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
134
129
|
for (let i = 0; i < subdir.length; i++) {
|
|
135
130
|
del(subdir[i]);
|
|
136
131
|
}
|
|
@@ -190,7 +185,7 @@ var require_package = __commonJS({
|
|
|
190
185
|
"package.json"(exports2, module2) {
|
|
191
186
|
module2.exports = {
|
|
192
187
|
name: "binary-collections",
|
|
193
|
-
version: "2.0.
|
|
188
|
+
version: "2.0.13",
|
|
194
189
|
description: "Utility to clean any programming caches and more",
|
|
195
190
|
keywords: [
|
|
196
191
|
"cache",
|
|
@@ -226,29 +221,28 @@ var require_package = __commonJS({
|
|
|
226
221
|
files: [
|
|
227
222
|
"binaries",
|
|
228
223
|
"lib",
|
|
229
|
-
"
|
|
230
|
-
"docs-src/**/*.md",
|
|
224
|
+
"docs-src",
|
|
231
225
|
"readme.md",
|
|
232
|
-
".puppeterrc
|
|
226
|
+
".puppeterrc.cjs",
|
|
233
227
|
"requirements.txt"
|
|
234
228
|
],
|
|
235
229
|
scripts: {
|
|
236
|
-
build: "tsc -b tsconfig.build.json && npm run build
|
|
237
|
-
"build
|
|
238
|
-
"build
|
|
239
|
-
"build
|
|
230
|
+
build: "tsc -b tsconfig.build.json && npm run build-tsup && npm run build-exports",
|
|
231
|
+
"build-exports": "node -r ts-node/register -r dotenv/config build.mjs",
|
|
232
|
+
"build-packages": "yarn workspaces foreach --worktree --exclude=binary-collections --no-private run build",
|
|
233
|
+
"build-rollup": "rollup -c rollup.config.js",
|
|
234
|
+
"build-tsup": "node build.tsup.js",
|
|
240
235
|
clean: "rimraf lib tmp/dist binaries",
|
|
241
|
-
pack: "node
|
|
242
|
-
postbuild: "node -r ts-node/register -r dotenv/config build.exports.mjs && yarn run pack",
|
|
236
|
+
pack: "node package.cjs --yarn --filename=bin",
|
|
243
237
|
prepare: "husky",
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
"test
|
|
247
|
-
"test
|
|
248
|
-
"test
|
|
249
|
-
"
|
|
250
|
-
"update:
|
|
251
|
-
"
|
|
238
|
+
"puppeteer:browser": "npx -y puppeteer browsers install chrome",
|
|
239
|
+
test: "test-cjs",
|
|
240
|
+
"test-coverage": "npm test --coverage --detectOpenHandles",
|
|
241
|
+
"test-esm": "test-esm",
|
|
242
|
+
"test-nrs": "npm test -- nrs build-**",
|
|
243
|
+
"test-watch": "npm test --watch",
|
|
244
|
+
"update:ncu": "npx npm-check-updates -u --enginesNode --root -x jest -x @types/jest -x babel-jest -x @babel/core -x @babel/preset-env -x @babel/preset-typescript -x ts-jest -x eslint -x @eslint/eslintrc -x @eslint/js -x @typescript-eslint/eslint-plugin -x @typescript-eslint/parser -x eslint-config-prettier -x eslint-plugin-prettier -x typescript-eslint -x prettier -x typescript -x ts-node -x @yarnpkg/core",
|
|
245
|
+
"update:packer": "curl -L https://github.com/dimaslanjaka/nodejs-package-types/raw/main/packer.js > packer.cjs"
|
|
252
246
|
},
|
|
253
247
|
repository: {
|
|
254
248
|
type: "git",
|
|
@@ -257,67 +251,62 @@ var require_package = __commonJS({
|
|
|
257
251
|
dependencies: {
|
|
258
252
|
"@yarnpkg/core": "^4.7.0",
|
|
259
253
|
"ansi-colors": "^4.1.3",
|
|
260
|
-
axios: "^1.
|
|
254
|
+
axios: "^1.16.1",
|
|
255
|
+
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/78b09a1f799430fb251c1b438ec56ce7957674f4/release/cross-spawn.tgz",
|
|
256
|
+
"crypto-js": "^4.2.0",
|
|
261
257
|
dotenv: "^17.4.2",
|
|
262
|
-
|
|
263
|
-
"
|
|
264
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/refs/heads/pre-release/release/git-command-helper.tgz",
|
|
258
|
+
"fs-extra": "^11.3.5",
|
|
259
|
+
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/ed17f70eb7444d24bd8eb984a4afe9fd64652838/release/git-command-helper.tgz",
|
|
265
260
|
glob: "^13.0.6",
|
|
266
261
|
minimatch: "^10.2.5",
|
|
267
262
|
minimist: "^1.2.8",
|
|
268
263
|
"ps-node": "^0.1.6",
|
|
269
|
-
puppeteer: "^
|
|
264
|
+
puppeteer: "^25.0.4",
|
|
270
265
|
"puppeteer-extra": "^3.3.6",
|
|
271
266
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
272
|
-
|
|
273
|
-
"
|
|
267
|
+
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/44e5c7b79b4e60f8c2d34857c27b8ce677d7493e/packages/sbg-utility/release/sbg-utility.tgz",
|
|
268
|
+
"tar-stream": "^3.2.0",
|
|
274
269
|
upath: "^3.0.7",
|
|
275
|
-
|
|
276
|
-
|
|
270
|
+
which: "^7.0.0",
|
|
271
|
+
yaml: "^2.9.0",
|
|
272
|
+
yarn: "^1.22.22",
|
|
273
|
+
zlib: "^1.0.5"
|
|
277
274
|
},
|
|
278
275
|
devDependencies: {
|
|
279
276
|
"@babel/core": "^7.29.0",
|
|
277
|
+
"@babel/plugin-syntax-import-assertions": "^7.28.6",
|
|
280
278
|
"@babel/preset-env": "^7.29.2",
|
|
281
279
|
"@babel/preset-typescript": "^7.28.5",
|
|
282
|
-
"@eslint
|
|
283
|
-
"@eslint/js": "^10.0.1",
|
|
280
|
+
"@dimaslanjaka/eslint-base-config": "^1.0.1",
|
|
284
281
|
"@rollup/plugin-babel": "^7.0.0",
|
|
285
282
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
286
283
|
"@rollup/plugin-json": "^6.1.0",
|
|
287
284
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
288
285
|
"@types/babel__core": "^7",
|
|
289
286
|
"@types/babel__preset-env": "^7",
|
|
290
|
-
"@types/
|
|
287
|
+
"@types/crypto-js": "^4",
|
|
291
288
|
"@types/fs-extra": "^11",
|
|
292
289
|
"@types/jest": "^30.0.0",
|
|
293
290
|
"@types/minimist": "^1",
|
|
294
|
-
"@types/
|
|
295
|
-
"@types/
|
|
291
|
+
"@types/mocha": "^10.0.10",
|
|
292
|
+
"@types/node": "^25.9.1",
|
|
296
293
|
"@types/ps-node": "^0",
|
|
297
|
-
"@types/
|
|
298
|
-
"@
|
|
299
|
-
"@typescript-eslint/parser": "^8.59.0",
|
|
294
|
+
"@types/tar-stream": "^3",
|
|
295
|
+
"@types/which": "^3.0.4",
|
|
300
296
|
"babel-jest": "^30.4.1",
|
|
301
297
|
"browser-sync": "^3.0.4",
|
|
302
298
|
"cross-env": "^10.1.0",
|
|
303
|
-
|
|
304
|
-
eslint: "^10.2.1",
|
|
305
|
-
"eslint-config-prettier": "^10.1.8",
|
|
306
|
-
"eslint-plugin-prettier": "^5.5.5",
|
|
307
|
-
globals: "^17.5.0",
|
|
299
|
+
globals: "^17.6.0",
|
|
308
300
|
gulp: "^5.0.1",
|
|
309
301
|
husky: "^9.1.7",
|
|
310
302
|
jest: "^30.4.2",
|
|
311
|
-
"lint-staged": "^
|
|
312
|
-
marked: "^18.0.
|
|
313
|
-
prettier: "^3.8.3",
|
|
303
|
+
"lint-staged": "^17.0.5",
|
|
304
|
+
marked: "^18.0.4",
|
|
314
305
|
rimraf: "^6.1.3",
|
|
315
|
-
rollup: "^4.60.
|
|
306
|
+
rollup: "^4.60.4",
|
|
316
307
|
"ts-jest": "^29.4.9",
|
|
317
308
|
"ts-node": "^10.9.2",
|
|
318
309
|
tsup: "^8.5.1",
|
|
319
|
-
typedoc: "^0.28.19",
|
|
320
|
-
"typedoc-plugin-ga": "^1.1.1",
|
|
321
310
|
typescript: "^6.0.3"
|
|
322
311
|
},
|
|
323
312
|
directories: {
|
|
@@ -329,31 +318,45 @@ var require_package = __commonJS({
|
|
|
329
318
|
],
|
|
330
319
|
packageManager: "yarn@4.9.2",
|
|
331
320
|
resolutions: {
|
|
332
|
-
"
|
|
333
|
-
"
|
|
334
|
-
"
|
|
321
|
+
"@types/through2": "https://github.com/dimaslanjaka/nodejs-package-types/raw/refs/heads/through2/release/types-through2.tgz",
|
|
322
|
+
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/78b09a1f799430fb251c1b438ec56ce7957674f4/release/cross-spawn.tgz",
|
|
323
|
+
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/dd8c8ef596083f367c592f97a2439f9fc8ab33b2/release/git-command-helper.tgz",
|
|
324
|
+
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/44e5c7b79b4e60f8c2d34857c27b8ce677d7493e/packages/sbg-utility/release/sbg-utility.tgz",
|
|
325
|
+
"@dimaslanjaka/eslint-base-config": "https://github.com/dimaslanjaka/eslint-base-config/raw/9741b4feac89f303ea585e3ecac2b0e768434135/release/dimaslanjaka-eslint-base-config.tgz"
|
|
335
326
|
},
|
|
336
327
|
bin: {
|
|
337
328
|
"binary-collections": "lib/binary-collections.cjs",
|
|
338
329
|
"binary-executor": "binaries/binary-executor.cjs",
|
|
330
|
+
"build-package": "lib/node-package-packer-cli.cjs",
|
|
331
|
+
"build-package-tarball": "lib/node-package-packer-cli.cjs",
|
|
332
|
+
"build-tarball": "lib/node-package-packer-cli.cjs",
|
|
339
333
|
changelog: "lib/changelog.cjs",
|
|
340
334
|
chatgpt: "lib/free-chatgpt.cjs",
|
|
341
|
-
"clean-github-actions-cache": "lib/clean-github-actions-caches.cjs",
|
|
342
|
-
"clean-github-actions-caches": "lib/clean-github-actions-caches.cjs",
|
|
335
|
+
"clean-github-actions-cache": "lib/clean-github-actions-caches-cli.cjs",
|
|
336
|
+
"clean-github-actions-caches": "lib/clean-github-actions-caches-cli.cjs",
|
|
343
337
|
"clean-nodemodule": "binaries/clean-nodemodule.cjs",
|
|
344
338
|
"clean-nodemodules": "binaries/clean-nodemodules.cjs",
|
|
345
|
-
"clear-gh-caches": "lib/clean-github-actions-caches.cjs",
|
|
346
|
-
"clear-github-actions-cache": "lib/clean-github-actions-caches.cjs",
|
|
347
|
-
"clear-github-actions-caches": "lib/clean-github-actions-caches.cjs",
|
|
339
|
+
"clear-gh-caches": "lib/clean-github-actions-caches-cli.cjs",
|
|
340
|
+
"clear-github-actions-cache": "lib/clean-github-actions-caches-cli.cjs",
|
|
341
|
+
"clear-github-actions-caches": "lib/clean-github-actions-caches-cli.cjs",
|
|
342
|
+
copy: "lib/file/copy-cli.cjs",
|
|
343
|
+
"copy-file": "lib/file/copy-cli.cjs",
|
|
348
344
|
"del-gradle": "lib/del-gradle.cjs",
|
|
349
345
|
"del-node-modules": "lib/del-node-modules.cjs",
|
|
350
346
|
"del-nodemodules": "lib/del-node-modules.cjs",
|
|
351
|
-
"del-ps": "lib/del-ps.cjs",
|
|
347
|
+
"del-ps": "lib/del-ps-cli.cjs",
|
|
352
348
|
"del-yarn-caches": "lib/del-yarn-caches.cjs",
|
|
353
349
|
"del-yarncaches": "lib/del-yarn-caches.cjs",
|
|
354
350
|
dev: "binaries/dev.cjs",
|
|
355
351
|
"dir-tree": "lib/print-directory-tree.cjs",
|
|
352
|
+
download: "lib/downloader-cli.cjs",
|
|
353
|
+
"download-file": "lib/downloader-cli.cjs",
|
|
354
|
+
downloader: "lib/downloader-cli.cjs",
|
|
356
355
|
empty: "binaries/empty.cjs",
|
|
356
|
+
"exec-node": "lib/node-executor.cjs",
|
|
357
|
+
"execute-node": "lib/node-executor.cjs",
|
|
358
|
+
"fetch-file": "lib/downloader-cli.cjs",
|
|
359
|
+
"file-downloader": "lib/downloader-cli.cjs",
|
|
357
360
|
"find-node-modules": "lib/find-node-modules-cli.cjs",
|
|
358
361
|
"free-chatgpt": "lib/free-chatgpt.cjs",
|
|
359
362
|
"git-diff": "lib/git-diff-cli.cjs",
|
|
@@ -365,55 +368,216 @@ var require_package = __commonJS({
|
|
|
365
368
|
javakill: "binaries/javakill.cjs",
|
|
366
369
|
"kill-night-crows": "lib/kill-night-crows.cjs",
|
|
367
370
|
"kill-process": "binaries/kill-process.cjs",
|
|
371
|
+
move: "lib/file/move-cli.cjs",
|
|
372
|
+
"move-file": "lib/file/move-cli.cjs",
|
|
373
|
+
"node-cache-cleaner": "lib/node-cache-cleaner-cli.cjs",
|
|
374
|
+
"node-copy": "lib/file/copy-cli.cjs",
|
|
375
|
+
"node-exec": "lib/node-executor.cjs",
|
|
376
|
+
"node-executor": "lib/node-executor.cjs",
|
|
377
|
+
"node-move": "lib/file/move-cli.cjs",
|
|
378
|
+
"node-package-packer": "lib/node-package-packer-cli.cjs",
|
|
368
379
|
nodekill: "binaries/nodekill.cjs",
|
|
369
380
|
"npm-run-series": "lib/npm-run-series.cjs",
|
|
370
381
|
nrs: "lib/npm-run-series.cjs",
|
|
382
|
+
"pack-node-package": "lib/node-package-packer-cli.cjs",
|
|
383
|
+
"pack-tarball": "lib/node-package-packer-cli.cjs",
|
|
371
384
|
"package-resolutions-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
372
385
|
"php-cs-fixer-staged": "lib/php-cs-fixer-staged.cjs",
|
|
373
386
|
"pkg-res-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
374
387
|
"pkg-resolutions-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
375
388
|
"print-directory-tree": "lib/print-directory-tree.cjs",
|
|
389
|
+
"print-tarball-tree": "lib/print-tarball-tree.cjs",
|
|
376
390
|
"print-tree": "lib/print-directory-tree.cjs",
|
|
377
391
|
prod: "binaries/prod.cjs",
|
|
378
392
|
py: "binaries/py.cjs",
|
|
379
393
|
"remove-module": "lib/remove-module.cjs",
|
|
394
|
+
"remove-node-module": "lib/rm-node-module-cli.cjs",
|
|
395
|
+
"remove-node-modules": "lib/rm-node-module-cli.cjs",
|
|
396
|
+
"rm-node-module": "lib/rm-node-module-cli.cjs",
|
|
397
|
+
"rm-node-modules": "lib/rm-node-module-cli.cjs",
|
|
380
398
|
rmfind: "binaries/rmfind.cjs",
|
|
381
|
-
rmpath: "lib/rmpath.cjs",
|
|
399
|
+
rmpath: "lib/rmpath-cli.cjs",
|
|
382
400
|
rmx: "binaries/rmx.cjs",
|
|
401
|
+
"run-by-checksum": "lib/run-by-checksum-cli.cjs",
|
|
402
|
+
"run-c": "lib/run-by-checksum-cli.cjs",
|
|
403
|
+
"run-checksum": "lib/run-by-checksum-cli.cjs",
|
|
383
404
|
"run-s": "lib/npm-run-series.cjs",
|
|
384
405
|
"run-series": "lib/npm-run-series.cjs",
|
|
385
406
|
"submodule-install": "lib/submodule-install.cjs",
|
|
386
407
|
"submodule-remove": "lib/submodule-remove-cli.cjs",
|
|
387
408
|
"submodule-token": "binaries/submodule-token.cjs",
|
|
409
|
+
"tarball-packer": "lib/node-package-packer-cli.cjs",
|
|
410
|
+
"tarball-tree": "lib/print-tarball-tree.cjs",
|
|
388
411
|
"test-cjs": "binaries/test-cjs.cjs",
|
|
412
|
+
"test-esm": "binaries/test-esm.cjs",
|
|
389
413
|
"undo-commit": "lib/git/undo-commit.cjs",
|
|
390
414
|
"undo-last-commit": "lib/git/undo-commit.cjs",
|
|
391
415
|
"undo-staged": "lib/git/undo-staged.cjs",
|
|
416
|
+
"y-install": "lib/yarn-per-branch-lock-installer.cjs",
|
|
392
417
|
"yarn-clean": "binaries/yarn-clean.cjs",
|
|
393
|
-
"yarn-
|
|
418
|
+
"yarn-install": "lib/yarn-per-branch-lock-installer.cjs",
|
|
419
|
+
"yarn-per-branch-lock-installer": "lib/yarn-per-branch-lock-installer.cjs",
|
|
420
|
+
"yarn-reinstall": "lib/yarn-reinstall.cjs",
|
|
421
|
+
yc: "binaries/yc.cjs",
|
|
422
|
+
ycw: "binaries/ycw.cjs"
|
|
394
423
|
}
|
|
395
424
|
};
|
|
396
425
|
}
|
|
397
426
|
});
|
|
398
427
|
|
|
428
|
+
// src/binary-collections/findScript.cjs
|
|
429
|
+
var require_findScript = __commonJS({
|
|
430
|
+
"src/binary-collections/findScript.cjs"(exports2, module2) {
|
|
431
|
+
init_cjs_shims();
|
|
432
|
+
var { glob } = require("glob");
|
|
433
|
+
var path2 = require("upath");
|
|
434
|
+
var fs = require("fs-extra");
|
|
435
|
+
var pkgJson = require_package();
|
|
436
|
+
function findScript2(scriptName, searchDir = null) {
|
|
437
|
+
if (!searchDir) searchDir = path2.join(__dirname, "..");
|
|
438
|
+
let result;
|
|
439
|
+
const ignorePatterns = [
|
|
440
|
+
`**/*config*.{cjs,js,mjs}`,
|
|
441
|
+
`**/utils.{cjs,js,mjs}`,
|
|
442
|
+
`**/index.{cjs,js,mjs}`,
|
|
443
|
+
`**/chunk-*.{cjs,js,mjs}`,
|
|
444
|
+
`**/*.d.{ts,cts,mts}`
|
|
445
|
+
// ignore TypeScript declaration files
|
|
446
|
+
];
|
|
447
|
+
try {
|
|
448
|
+
const pattern = `${scriptName}.{cjs,js,mjs}`;
|
|
449
|
+
const files = glob.sync(pattern, {
|
|
450
|
+
cwd: searchDir,
|
|
451
|
+
ignore: ignorePatterns,
|
|
452
|
+
absolute: true
|
|
453
|
+
});
|
|
454
|
+
if (files.length > 0) {
|
|
455
|
+
result = files[0];
|
|
456
|
+
} else {
|
|
457
|
+
if (pkgJson.bin[scriptName]) {
|
|
458
|
+
const find = [
|
|
459
|
+
path2.join(searchDir, pkgJson.bin[scriptName]),
|
|
460
|
+
path2.join(process.cwd(), "node_modules/binary-collections", pkgJson.bin[scriptName]),
|
|
461
|
+
path2.join(__dirname, pkgJson.bin[scriptName]),
|
|
462
|
+
path2.join(path2.join(__dirname, ".."), pkgJson.bin[scriptName]),
|
|
463
|
+
path2.join(path2.join(__dirname, "../.."), pkgJson.bin[scriptName])
|
|
464
|
+
];
|
|
465
|
+
const filtered = find.filter((file) => fs.existsSync(file));
|
|
466
|
+
if (filtered.length > 0) {
|
|
467
|
+
result = filtered[0];
|
|
468
|
+
} else {
|
|
469
|
+
console.warn(`\u26A0\uFE0F Script "${scriptName}" not found in ${searchDir}.`);
|
|
470
|
+
console.warn(`\u{1F50D} Searched for: ${pattern} in ${searchDir}`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
} catch (error) {
|
|
475
|
+
console.error(`\u{1F50D} Error searching for script: ${error.message}`);
|
|
476
|
+
}
|
|
477
|
+
if (result && !result.includes("-cli")) {
|
|
478
|
+
const ext = path2.extname(result);
|
|
479
|
+
const filename = path2.basename(result, ext);
|
|
480
|
+
const cliFile = path2.join(path2.dirname(result), `${filename}-cli${ext}`);
|
|
481
|
+
if (fs.existsSync(cliFile)) {
|
|
482
|
+
result = cliFile;
|
|
483
|
+
console.log(`\u{1F50D} Found CLI version: ${cliFile}`);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
return result;
|
|
487
|
+
}
|
|
488
|
+
module2.exports = findScript2;
|
|
489
|
+
module2.exports.default = findScript2;
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
// src/binary-collections/executeScript.cjs
|
|
494
|
+
var require_executeScript = __commonJS({
|
|
495
|
+
"src/binary-collections/executeScript.cjs"(exports2, module2) {
|
|
496
|
+
init_cjs_shims();
|
|
497
|
+
var { spawn } = require("child_process");
|
|
498
|
+
function executeScript2(scriptPath, args) {
|
|
499
|
+
console.log(`\u{1F527} Executing script: ${scriptPath} args: ${args.join(" ")}
|
|
500
|
+
`);
|
|
501
|
+
const child = spawn("node", [scriptPath, ...args], {
|
|
502
|
+
stdio: "inherit",
|
|
503
|
+
shell: true
|
|
504
|
+
});
|
|
505
|
+
child.on("error", (error) => {
|
|
506
|
+
console.error(`\u274C Error executing script: ${error.message}`);
|
|
507
|
+
process.exit(1);
|
|
508
|
+
});
|
|
509
|
+
child.on("close", (code) => {
|
|
510
|
+
process.exit(code);
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
module2.exports = executeScript2;
|
|
514
|
+
module2.exports.default = executeScript2;
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
|
|
518
|
+
// src/binary-collections/listScript.cjs
|
|
519
|
+
var require_listScript = __commonJS({
|
|
520
|
+
"src/binary-collections/listScript.cjs"(exports2, module2) {
|
|
521
|
+
init_cjs_shims();
|
|
522
|
+
var pkgJson = require_package();
|
|
523
|
+
var path2 = require("upath");
|
|
524
|
+
var fs = require("fs-extra");
|
|
525
|
+
function listScript(verbose = false) {
|
|
526
|
+
const keys = Object.keys(pkgJson.bin);
|
|
527
|
+
const results = [];
|
|
528
|
+
for (const scriptName of keys) {
|
|
529
|
+
if (verbose) {
|
|
530
|
+
console.log(`\u{1F50D} Finding script "${scriptName}" -> "${pkgJson.bin[scriptName]}"`);
|
|
531
|
+
}
|
|
532
|
+
const searchDirs = [
|
|
533
|
+
path2.join(__dirname, ".."),
|
|
534
|
+
path2.join(__dirname, "../.."),
|
|
535
|
+
path2.join(process.cwd(), "node_modules/binary-collections"),
|
|
536
|
+
__dirname
|
|
537
|
+
];
|
|
538
|
+
let scriptPath;
|
|
539
|
+
for (const searchDir of searchDirs) {
|
|
540
|
+
scriptPath = path2.join(searchDir, pkgJson.bin[scriptName]);
|
|
541
|
+
if (fs.existsSync(scriptPath)) {
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
if (!fs.existsSync(scriptPath)) {
|
|
546
|
+
console.warn(`\u26A0\uFE0F Script "${scriptName}" defined in package.json not found at ${scriptPath}`);
|
|
547
|
+
} else {
|
|
548
|
+
if (verbose) {
|
|
549
|
+
console.log(`\u2705 Found script "${scriptName}" at ${scriptPath}`);
|
|
550
|
+
}
|
|
551
|
+
results.push({
|
|
552
|
+
name: scriptName,
|
|
553
|
+
path: path2.relative(process.cwd(), scriptPath),
|
|
554
|
+
absolutePath: path2.resolve(scriptPath)
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
return results;
|
|
559
|
+
}
|
|
560
|
+
module2.exports = listScript;
|
|
561
|
+
module2.exports.default = listScript;
|
|
562
|
+
}
|
|
563
|
+
});
|
|
564
|
+
|
|
399
565
|
// src/binary-collections.cjs
|
|
400
566
|
init_cjs_shims();
|
|
401
|
-
var { spawn } = require("child_process");
|
|
402
|
-
var { glob } = require("glob");
|
|
403
567
|
var path = require("upath");
|
|
404
568
|
var { getArgs } = require_utils();
|
|
405
|
-
var
|
|
406
|
-
var
|
|
569
|
+
var findScript = require_findScript();
|
|
570
|
+
var executeScript = require_executeScript();
|
|
407
571
|
function showHelp() {
|
|
408
572
|
console.log("\u{1F680} Binary Collections - Dynamic Script Runner");
|
|
409
573
|
console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
410
574
|
console.log("");
|
|
411
|
-
console.log("\u{1F4CB} Usage: npx binary-collections <script-name> [...args]");
|
|
575
|
+
console.log("\u{1F4CB} Usage: npx --legacy-peer-deps -y binary-collections <script-name> [...args]");
|
|
412
576
|
console.log("");
|
|
413
577
|
console.log("\u2728 Examples:");
|
|
414
|
-
console.log(" \u{1F4CA} npx binary-collections git-diff -s");
|
|
415
|
-
console.log(" \u{1F9F9} npx binary-collections del-node-modules");
|
|
416
|
-
console.log(" \u{1F50D} npx binary-collections find-node-modules --help");
|
|
578
|
+
console.log(" \u{1F4CA} npx --legacy-peer-deps -y binary-collections git-diff -s");
|
|
579
|
+
console.log(" \u{1F9F9} npx --legacy-peer-deps -y binary-collections del-node-modules");
|
|
580
|
+
console.log(" \u{1F50D} npx --legacy-peer-deps -y binary-collections find-node-modules --help");
|
|
417
581
|
console.log("");
|
|
418
582
|
console.log("\u2139\uFE0F This tool will search for <script-name>.{cjs,js,mjs} in the script's directory");
|
|
419
583
|
console.log(" and execute it with the provided arguments.");
|
|
@@ -422,79 +586,22 @@ function showHelp() {
|
|
|
422
586
|
console.log(" --help, -h Show this help message");
|
|
423
587
|
process.exit(0);
|
|
424
588
|
}
|
|
425
|
-
function findScript(scriptName, searchDir = null) {
|
|
426
|
-
if (!searchDir) searchDir = __dirname;
|
|
427
|
-
let result;
|
|
428
|
-
const ignorePatterns = [
|
|
429
|
-
`**/*config*.{cjs,js,mjs}`,
|
|
430
|
-
`**/utils.{cjs,js,mjs}`,
|
|
431
|
-
`**/index.{cjs,js,mjs}`,
|
|
432
|
-
`**/chunk-*.{cjs,js,mjs}`,
|
|
433
|
-
`**/*.d.{ts,cts,mts}`
|
|
434
|
-
// ignore TypeScript declaration files
|
|
435
|
-
];
|
|
436
|
-
try {
|
|
437
|
-
const pattern = `${scriptName}.{cjs,js,mjs}`;
|
|
438
|
-
const files = glob.sync(pattern, {
|
|
439
|
-
cwd: searchDir,
|
|
440
|
-
ignore: ignorePatterns,
|
|
441
|
-
absolute: true
|
|
442
|
-
});
|
|
443
|
-
if (files.length > 0) {
|
|
444
|
-
result = files[0];
|
|
445
|
-
} else {
|
|
446
|
-
if (pkgJson.bin[scriptName]) {
|
|
447
|
-
const find = [
|
|
448
|
-
path.join(searchDir, pkgJson.bin[scriptName]),
|
|
449
|
-
path.join(process.cwd(), "node_modules/binary-collections", pkgJson.bin[scriptName]),
|
|
450
|
-
path.join(__dirname, pkgJson.bin[scriptName]),
|
|
451
|
-
path.join(path.join(__dirname, ".."), pkgJson.bin[scriptName])
|
|
452
|
-
];
|
|
453
|
-
const filtered = find.filter((file) => fs.existsSync(file));
|
|
454
|
-
if (filtered.length > 0) {
|
|
455
|
-
result = filtered[0];
|
|
456
|
-
} else {
|
|
457
|
-
console.warn(`\u26A0\uFE0F Script "${scriptName}" not found in ${searchDir}.`);
|
|
458
|
-
console.warn(`\u{1F50D} Searched for: ${pattern} in ${searchDir}`);
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
} catch (error) {
|
|
463
|
-
console.error(`\u{1F50D} Error searching for script: ${error.message}`);
|
|
464
|
-
}
|
|
465
|
-
if (result && !result.includes("-cli")) {
|
|
466
|
-
const ext = path.extname(result);
|
|
467
|
-
const filename = path.basename(result, ext);
|
|
468
|
-
const cliFile = path.join(path.dirname(result), `${filename}-cli${ext}`);
|
|
469
|
-
if (fs.existsSync(cliFile)) {
|
|
470
|
-
result = cliFile;
|
|
471
|
-
console.log(`\u{1F50D} Found CLI version: ${cliFile}`);
|
|
472
|
-
}
|
|
473
|
-
}
|
|
474
|
-
return result;
|
|
475
|
-
}
|
|
476
|
-
function executeScript(scriptPath, args) {
|
|
477
|
-
console.log(`\u{1F527} Executing script: ${scriptPath} args: ${args.join(" ")}`);
|
|
478
|
-
const child = spawn("node", [scriptPath, ...args], {
|
|
479
|
-
stdio: "inherit",
|
|
480
|
-
shell: true
|
|
481
|
-
});
|
|
482
|
-
child.on("error", (error) => {
|
|
483
|
-
console.error(`\u274C Error executing script: ${error.message}`);
|
|
484
|
-
process.exit(1);
|
|
485
|
-
});
|
|
486
|
-
child.on("close", (code) => {
|
|
487
|
-
process.exit(code);
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
589
|
function main() {
|
|
491
590
|
const args = getArgs();
|
|
492
591
|
const positional = args._ || [];
|
|
493
|
-
console.log(`\u{1F50D} Parsed arguments: ${JSON.stringify(args)}`);
|
|
494
592
|
if (positional.length === 0) {
|
|
495
593
|
return showHelp();
|
|
496
594
|
}
|
|
497
595
|
const scriptName = positional[0];
|
|
596
|
+
if (scriptName === "list") {
|
|
597
|
+
const listScript = require_listScript();
|
|
598
|
+
const scripts = listScript();
|
|
599
|
+
console.log("\u{1F4CB} Available scripts:");
|
|
600
|
+
scripts.forEach((script) => {
|
|
601
|
+
console.log(` - ${path.basename(script.name)} -> ${script.path}`);
|
|
602
|
+
});
|
|
603
|
+
process.exit(0);
|
|
604
|
+
}
|
|
498
605
|
const scriptArgs = [];
|
|
499
606
|
scriptArgs.push(...positional.slice(1));
|
|
500
607
|
Object.keys(args).forEach((key) => {
|