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
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_isWindows,
|
|
4
|
+
isWindows
|
|
5
|
+
} from "./chunk-QII2EKCS.mjs";
|
|
6
|
+
import {
|
|
7
|
+
init_esm_shims
|
|
8
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
9
|
+
|
|
10
|
+
// src/cross-env/variable.ts
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
init_isWindows();
|
|
13
|
+
var pathLikeEnvVarWhitelist = /* @__PURE__ */ new Set(["PATH", "NODE_PATH"]);
|
|
14
|
+
function replaceListDelimiters(varValue, varName = "") {
|
|
15
|
+
const targetSeparator = isWindows() ? ";" : ":";
|
|
16
|
+
if (!pathLikeEnvVarWhitelist.has(varName)) {
|
|
17
|
+
return varValue;
|
|
18
|
+
}
|
|
19
|
+
return varValue.replace(/(\\*):/g, (match, backslashes) => {
|
|
20
|
+
if (backslashes.length % 2) {
|
|
21
|
+
return match.substring(1);
|
|
22
|
+
}
|
|
23
|
+
return backslashes + targetSeparator;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function resolveEnvVars(varValue) {
|
|
27
|
+
const envUnixRegex = /(\\*)(\$(\w+)|\${(\w+)})/g;
|
|
28
|
+
return varValue.replace(envUnixRegex, (_, escapeChars, varNameWithDollarSign, varName, altVarName) => {
|
|
29
|
+
if (escapeChars.length % 2 === 1) {
|
|
30
|
+
return varNameWithDollarSign;
|
|
31
|
+
}
|
|
32
|
+
return escapeChars.substring(0, escapeChars.length / 2) + (process.env[varName || altVarName] || "");
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function varValueConvert(originalValue, originalName) {
|
|
36
|
+
return resolveEnvVars(replaceListDelimiters(originalValue, originalName));
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
varValueConvert
|
|
41
|
+
};
|
|
@@ -11,9 +11,9 @@ var require_utils = __commonJS({
|
|
|
11
11
|
init_esm_shims();
|
|
12
12
|
var fs = __require("fs");
|
|
13
13
|
var path = __require("upath");
|
|
14
|
-
var
|
|
14
|
+
var minimistLib = __require("minimist");
|
|
15
|
+
var argv = minimistLib(process.argv.slice(2));
|
|
15
16
|
var { exec } = __require("child_process");
|
|
16
|
-
var { URL } = __require("url");
|
|
17
17
|
var { promisify } = __require("util");
|
|
18
18
|
var execAsync = promisify(exec);
|
|
19
19
|
async function parseGitRemotes() {
|
|
@@ -47,15 +47,10 @@ var require_utils = __commonJS({
|
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
49
|
module.exports.parseGitRemotes = parseGitRemotes;
|
|
50
|
-
function
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
50
|
+
function getArgs(opts) {
|
|
51
|
+
if (opts) {
|
|
52
|
+
return minimistLib(process.argv.slice(2), opts);
|
|
54
53
|
}
|
|
55
|
-
return fullPath;
|
|
56
|
-
}
|
|
57
|
-
module.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
58
|
-
function getArgs() {
|
|
59
54
|
return argv;
|
|
60
55
|
}
|
|
61
56
|
module.exports.getArgs = getArgs;
|
|
@@ -80,7 +75,7 @@ var require_utils = __commonJS({
|
|
|
80
75
|
try {
|
|
81
76
|
fs.rmdirSync(fullPath);
|
|
82
77
|
console.log("deleted", fullPath);
|
|
83
|
-
} catch (
|
|
78
|
+
} catch (_e) {
|
|
84
79
|
try {
|
|
85
80
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
86
81
|
console.log("deleted", fullPath);
|
|
@@ -93,7 +88,7 @@ var require_utils = __commonJS({
|
|
|
93
88
|
try {
|
|
94
89
|
fs.unlinkSync(fullPath);
|
|
95
90
|
console.log("deleted", fullPath);
|
|
96
|
-
} catch (
|
|
91
|
+
} catch (_e) {
|
|
97
92
|
try {
|
|
98
93
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
99
94
|
console.log("deleted", fullPath);
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_findEnvFiles
|
|
4
|
+
} from "./chunk-H44UWUFY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
require_utils
|
|
7
|
+
} from "./chunk-6RK5UCTP.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__commonJS,
|
|
10
|
+
__require,
|
|
11
|
+
init_esm_shims
|
|
12
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
13
|
+
|
|
14
|
+
// src/clean-github-actions-caches.cjs
|
|
15
|
+
var require_clean_github_actions_caches = __commonJS({
|
|
16
|
+
"src/clean-github-actions-caches.cjs"(exports, module) {
|
|
17
|
+
init_esm_shims();
|
|
18
|
+
var axios = __require("axios");
|
|
19
|
+
var { getArgs } = require_utils();
|
|
20
|
+
var { findEnvWithToken } = require_findEnvFiles();
|
|
21
|
+
__require("dotenv").config({
|
|
22
|
+
path: findEnvWithToken(),
|
|
23
|
+
quiet: true,
|
|
24
|
+
overwrite: true
|
|
25
|
+
});
|
|
26
|
+
var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
|
|
27
|
+
if (!ACCESS_TOKEN) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
"Access token is not provided. Please set ACCESS_TOKEN or GITHUB_TOKEN in your environment variables."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function printHelp() {
|
|
33
|
+
console.log(`
|
|
34
|
+
GitHub Actions Cache Cleaner
|
|
35
|
+
|
|
36
|
+
Description:
|
|
37
|
+
Removes outdated GitHub Actions caches for a repository, keeping only the newest
|
|
38
|
+
cache for each cache-key prefix. Authenticates via ACCESS_TOKEN or GITHUB_TOKEN
|
|
39
|
+
from your environment or .env file.
|
|
40
|
+
|
|
41
|
+
Usage:
|
|
42
|
+
clean-github-actions-caches [options]
|
|
43
|
+
|
|
44
|
+
Options:
|
|
45
|
+
-h, --help Show this help message
|
|
46
|
+
-r, --repo <repo> GitHub repository (owner/repo). If omitted, the tool will
|
|
47
|
+
attempt to infer the repository from the current working
|
|
48
|
+
directory's git remotes.
|
|
49
|
+
-p, --prefix-depth <n>
|
|
50
|
+
Number of leading cache key segments to use as the
|
|
51
|
+
grouping prefix when splitting on /[-_]/. Default: 3.
|
|
52
|
+
|
|
53
|
+
Environment Variables:
|
|
54
|
+
ACCESS_TOKEN GitHub access token (preferred)
|
|
55
|
+
GITHUB_TOKEN GitHub access token (fallback)
|
|
56
|
+
|
|
57
|
+
Behavior & Safety:
|
|
58
|
+
- Groups caches by a derived prefix from the cache key and keeps the most
|
|
59
|
+
recently created cache for each group.
|
|
60
|
+
- Deletes only caches older than the latest per prefix to reduce risk of
|
|
61
|
+
removing needed artifacts.
|
|
62
|
+
|
|
63
|
+
Examples:
|
|
64
|
+
# Run against a specific repo (owner/repo)
|
|
65
|
+
clean-github-actions-caches --repo octocat/hello-world
|
|
66
|
+
|
|
67
|
+
# Run via npx without installing
|
|
68
|
+
npx --legacy-peer-deps -y binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz clean-github-actions-caches --repo owner/repo --prefix-depth 3
|
|
69
|
+
|
|
70
|
+
# Run via yarn dlx
|
|
71
|
+
yarn dlx binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz clean-github-actions-caches --prefix-depth 3
|
|
72
|
+
|
|
73
|
+
Notes:
|
|
74
|
+
- Ensure ACCESS_TOKEN or GITHUB_TOKEN is set and has permissions to manage Actions caches.
|
|
75
|
+
- Intended for repository maintainers with appropriate permissions.
|
|
76
|
+
`);
|
|
77
|
+
}
|
|
78
|
+
var argv = getArgs({
|
|
79
|
+
alias: {
|
|
80
|
+
h: "help",
|
|
81
|
+
p: "prefix-depth",
|
|
82
|
+
r: "repo"
|
|
83
|
+
},
|
|
84
|
+
string: ["prefix-depth", "repo"],
|
|
85
|
+
boolean: ["help"]
|
|
86
|
+
});
|
|
87
|
+
if (argv.help) {
|
|
88
|
+
printHelp();
|
|
89
|
+
process.exit(0);
|
|
90
|
+
}
|
|
91
|
+
function deleteGitHubActionsCache(GH_REPO, cacheId) {
|
|
92
|
+
return new Promise((resolve, reject) => {
|
|
93
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches/${cacheId}`;
|
|
94
|
+
const token = ACCESS_TOKEN;
|
|
95
|
+
if (!token) {
|
|
96
|
+
return reject(new Error("Access token is not provided"));
|
|
97
|
+
}
|
|
98
|
+
axios.delete(url, {
|
|
99
|
+
headers: {
|
|
100
|
+
Authorization: `token ${token}`,
|
|
101
|
+
Accept: "application/vnd.github.v3+json"
|
|
102
|
+
}
|
|
103
|
+
}).then((response) => {
|
|
104
|
+
console.log(`Cache (${cacheId}) deleted successfully`, response.data);
|
|
105
|
+
resolve(response.data);
|
|
106
|
+
}).catch((error) => {
|
|
107
|
+
var _a;
|
|
108
|
+
console.error("Error deleting cache:", ((_a = error.response) == null ? void 0 : _a.data) || error.message || "Unknown error");
|
|
109
|
+
reject(error);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function normalizePrefixDepth(prefixDepth) {
|
|
114
|
+
const parsed = Number(prefixDepth);
|
|
115
|
+
if (!Number.isFinite(parsed) || parsed < 1) {
|
|
116
|
+
return 3;
|
|
117
|
+
}
|
|
118
|
+
return Math.floor(parsed);
|
|
119
|
+
}
|
|
120
|
+
function isChecksumSegment(segment) {
|
|
121
|
+
return /^[a-f0-9]{32,}$/i.test(segment);
|
|
122
|
+
}
|
|
123
|
+
function getMeaningfulCacheKeyParts(key) {
|
|
124
|
+
return String(key).split(/[-_]/).filter(Boolean).filter((segment) => !isChecksumSegment(segment));
|
|
125
|
+
}
|
|
126
|
+
function getCachePrefix(key, prefixDepth = 3) {
|
|
127
|
+
const normalizedDepth = normalizePrefixDepth(prefixDepth);
|
|
128
|
+
const parts = String(key).split(/[-_]/).filter(Boolean);
|
|
129
|
+
const meaningfulParts = getMeaningfulCacheKeyParts(key);
|
|
130
|
+
if (meaningfulParts.length !== parts.length) {
|
|
131
|
+
if (meaningfulParts.length < normalizedDepth) {
|
|
132
|
+
return `${meaningfulParts.join("-")}-`;
|
|
133
|
+
}
|
|
134
|
+
return meaningfulParts.join("-");
|
|
135
|
+
}
|
|
136
|
+
if (parts.length <= normalizedDepth) {
|
|
137
|
+
return parts.join("-");
|
|
138
|
+
}
|
|
139
|
+
return parts.slice(0, normalizedDepth).join("-");
|
|
140
|
+
}
|
|
141
|
+
function groupCachesByPrefix(caches, prefixDepth = 3) {
|
|
142
|
+
return caches.reduce(
|
|
143
|
+
/**
|
|
144
|
+
* @param {Record<string, Record<string, any>[]>} acc
|
|
145
|
+
* @param {Record<string, any>} item
|
|
146
|
+
* @returns {Record<string, Record<string, any>[]>}
|
|
147
|
+
*/
|
|
148
|
+
(acc, item) => {
|
|
149
|
+
const prefix = getCachePrefix(item.key, prefixDepth);
|
|
150
|
+
if (!acc[prefix]) {
|
|
151
|
+
acc[prefix] = [];
|
|
152
|
+
}
|
|
153
|
+
acc[prefix].push(item);
|
|
154
|
+
return acc;
|
|
155
|
+
},
|
|
156
|
+
{}
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
function get_caches(GH_REPO, prefixDepth = 3) {
|
|
160
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches`;
|
|
161
|
+
return new Promise((resolve, reject) => {
|
|
162
|
+
axios.get(url, {
|
|
163
|
+
headers: {
|
|
164
|
+
Accept: "application/vnd.github.v3+json",
|
|
165
|
+
Authorization: `token ${ACCESS_TOKEN}`
|
|
166
|
+
}
|
|
167
|
+
}).then((response) => {
|
|
168
|
+
const data = response.data.actions_caches;
|
|
169
|
+
const grouped = groupCachesByPrefix(data, prefixDepth);
|
|
170
|
+
resolve(grouped);
|
|
171
|
+
}).catch((error) => {
|
|
172
|
+
reject(error);
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
module.exports = {
|
|
177
|
+
deleteGitHubActionsCache,
|
|
178
|
+
getCachePrefix,
|
|
179
|
+
getMeaningfulCacheKeyParts,
|
|
180
|
+
get_caches,
|
|
181
|
+
groupCachesByPrefix,
|
|
182
|
+
isChecksumSegment,
|
|
183
|
+
normalizePrefixDepth
|
|
184
|
+
};
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
export {
|
|
189
|
+
require_clean_github_actions_caches
|
|
190
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_package
|
|
4
|
+
} from "./chunk-NQXUYO67.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__commonJS,
|
|
7
|
+
__dirname,
|
|
8
|
+
__require,
|
|
9
|
+
init_esm_shims
|
|
10
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
11
|
+
|
|
12
|
+
// src/binary-collections/listScript.cjs
|
|
13
|
+
var require_listScript = __commonJS({
|
|
14
|
+
"src/binary-collections/listScript.cjs"(exports, module) {
|
|
15
|
+
init_esm_shims();
|
|
16
|
+
var pkgJson = require_package();
|
|
17
|
+
var path = __require("upath");
|
|
18
|
+
var fs = __require("fs-extra");
|
|
19
|
+
function listScript(verbose = false) {
|
|
20
|
+
const keys = Object.keys(pkgJson.bin);
|
|
21
|
+
const results = [];
|
|
22
|
+
for (const scriptName of keys) {
|
|
23
|
+
if (verbose) {
|
|
24
|
+
console.log(`\u{1F50D} Finding script "${scriptName}" -> "${pkgJson.bin[scriptName]}"`);
|
|
25
|
+
}
|
|
26
|
+
const searchDirs = [
|
|
27
|
+
path.join(__dirname, ".."),
|
|
28
|
+
path.join(__dirname, "../.."),
|
|
29
|
+
path.join(process.cwd(), "node_modules/binary-collections"),
|
|
30
|
+
__dirname
|
|
31
|
+
];
|
|
32
|
+
let scriptPath;
|
|
33
|
+
for (const searchDir of searchDirs) {
|
|
34
|
+
scriptPath = path.join(searchDir, pkgJson.bin[scriptName]);
|
|
35
|
+
if (fs.existsSync(scriptPath)) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (!fs.existsSync(scriptPath)) {
|
|
40
|
+
console.warn(`\u26A0\uFE0F Script "${scriptName}" defined in package.json not found at ${scriptPath}`);
|
|
41
|
+
} else {
|
|
42
|
+
if (verbose) {
|
|
43
|
+
console.log(`\u2705 Found script "${scriptName}" at ${scriptPath}`);
|
|
44
|
+
}
|
|
45
|
+
results.push({
|
|
46
|
+
name: scriptName,
|
|
47
|
+
path: path.relative(process.cwd(), scriptPath),
|
|
48
|
+
absolutePath: path.resolve(scriptPath)
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return results;
|
|
53
|
+
}
|
|
54
|
+
module.exports = listScript;
|
|
55
|
+
module.exports.default = listScript;
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
require_listScript
|
|
61
|
+
};
|
|
@@ -120,7 +120,10 @@ async function writeQuestion(page, question) {
|
|
|
120
120
|
async function clickSubmitButton(page) {
|
|
121
121
|
console.log("Attempting to click the submit button...");
|
|
122
122
|
try {
|
|
123
|
-
const userMessageCountBefore = await page.$$eval(
|
|
123
|
+
const userMessageCountBefore = await page.$$eval(
|
|
124
|
+
'[data-message-author-role="user"]',
|
|
125
|
+
(elements) => elements.length
|
|
126
|
+
);
|
|
124
127
|
const waitForSubmit = async (timeout = 5e3) => {
|
|
125
128
|
try {
|
|
126
129
|
await page.waitForFunction(
|
|
@@ -136,18 +139,21 @@ async function clickSubmitButton(page) {
|
|
|
136
139
|
return false;
|
|
137
140
|
}
|
|
138
141
|
};
|
|
139
|
-
await page.waitForFunction(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
142
|
+
await page.waitForFunction(
|
|
143
|
+
() => {
|
|
144
|
+
const candidates = [
|
|
145
|
+
document.querySelector('[data-testid="fruitjuice-send-button"]'),
|
|
146
|
+
document.querySelector("#composer-submit-button"),
|
|
147
|
+
document.querySelector('[data-testid="send-button"]')
|
|
148
|
+
].filter(Boolean);
|
|
149
|
+
return candidates.some((button) => {
|
|
150
|
+
const isDisabled = button.disabled || button.getAttribute("aria-disabled") === "true";
|
|
151
|
+
const isVisible = button.offsetParent !== null;
|
|
152
|
+
return !isDisabled && isVisible;
|
|
153
|
+
});
|
|
154
|
+
},
|
|
155
|
+
{ timeout: 5e3 }
|
|
156
|
+
).catch(() => {
|
|
151
157
|
});
|
|
152
158
|
const buttonDetails = await page.evaluate(() => {
|
|
153
159
|
const selectors = [
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
+
|
|
8
|
+
// src/utils/findEnvFiles.cjs
|
|
9
|
+
var require_findEnvFiles = __commonJS({
|
|
10
|
+
"src/utils/findEnvFiles.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var fs = __require("fs");
|
|
13
|
+
var path = __require("path");
|
|
14
|
+
var glob = __require("glob");
|
|
15
|
+
var DEFAULT_IGNORES = [
|
|
16
|
+
"**/node_modules/**",
|
|
17
|
+
"**/.git/**",
|
|
18
|
+
"**/.yarn/**",
|
|
19
|
+
"**/.pnpm/**",
|
|
20
|
+
"**/dist/**",
|
|
21
|
+
"**/build/**",
|
|
22
|
+
"**/coverage/**",
|
|
23
|
+
"**/vendor/**",
|
|
24
|
+
"**/tmp/**",
|
|
25
|
+
"**/.cache/**",
|
|
26
|
+
"**/assets/**",
|
|
27
|
+
"**/logs/**",
|
|
28
|
+
"**/output/**",
|
|
29
|
+
"**/public/**",
|
|
30
|
+
"**/static/**",
|
|
31
|
+
"**/temp/**",
|
|
32
|
+
"**/backup/**",
|
|
33
|
+
"**/backups/**",
|
|
34
|
+
"**/examples/**",
|
|
35
|
+
"**/docs/**",
|
|
36
|
+
"**/tests/**",
|
|
37
|
+
"**/__tests__/**",
|
|
38
|
+
"**/spec/**",
|
|
39
|
+
"**/__specs__/**",
|
|
40
|
+
"**/scripts/**",
|
|
41
|
+
"**/bin/**",
|
|
42
|
+
"**/hooks/**",
|
|
43
|
+
"**/config/**",
|
|
44
|
+
"**/configs/**",
|
|
45
|
+
"**/settings/**",
|
|
46
|
+
"**/.vscode/**",
|
|
47
|
+
"**/.idea/**"
|
|
48
|
+
];
|
|
49
|
+
function findEnvFiles(startDir = process.cwd(), filter) {
|
|
50
|
+
const found = /* @__PURE__ */ new Set();
|
|
51
|
+
function addFile(file) {
|
|
52
|
+
const normalized = path.normalize(file);
|
|
53
|
+
if (typeof filter === "function" && !filter(normalized)) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
found.add(normalized);
|
|
57
|
+
}
|
|
58
|
+
let current = path.resolve(startDir);
|
|
59
|
+
while (true) {
|
|
60
|
+
const envPath = path.join(current, ".env");
|
|
61
|
+
if (fs.existsSync(envPath)) {
|
|
62
|
+
addFile(envPath);
|
|
63
|
+
}
|
|
64
|
+
const parent = path.dirname(current);
|
|
65
|
+
if (parent === current) {
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
current = parent;
|
|
69
|
+
}
|
|
70
|
+
const files = glob.globSync("**/.env*", {
|
|
71
|
+
cwd: startDir,
|
|
72
|
+
absolute: true,
|
|
73
|
+
nodir: true,
|
|
74
|
+
ignore: DEFAULT_IGNORES
|
|
75
|
+
});
|
|
76
|
+
for (const file of files) {
|
|
77
|
+
addFile(file);
|
|
78
|
+
}
|
|
79
|
+
return [...found];
|
|
80
|
+
}
|
|
81
|
+
function findEnvWithToken(startDir = process.cwd(), tokenName = "GITHUB_TOKEN") {
|
|
82
|
+
const envFiles = findEnvFiles(startDir);
|
|
83
|
+
return envFiles.find((file) => {
|
|
84
|
+
try {
|
|
85
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
86
|
+
const regex = new RegExp(`^\\s*${tokenName}\\s*=`, "m");
|
|
87
|
+
return regex.test(content);
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.warn(`Failed to read ${file}: ${err instanceof Error ? err.message : String(err)}`);
|
|
90
|
+
return false;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
module.exports = {
|
|
95
|
+
DEFAULT_IGNORES,
|
|
96
|
+
findEnvFiles,
|
|
97
|
+
findEnvWithToken,
|
|
98
|
+
default: findEnvFiles
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
export {
|
|
104
|
+
require_findEnvFiles
|
|
105
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
__commonJS,
|
|
4
|
+
__require,
|
|
5
|
+
init_esm_shims
|
|
6
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
|
+
|
|
8
|
+
// src/utils/fetchResponse.cjs
|
|
9
|
+
var require_fetchResponse = __commonJS({
|
|
10
|
+
"src/utils/fetchResponse.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var axios = __require("axios");
|
|
13
|
+
async function fetchResponse(url, options = {}) {
|
|
14
|
+
var _a, _b, _c;
|
|
15
|
+
const response = await axios.get(url, {
|
|
16
|
+
maxRedirects: 5,
|
|
17
|
+
responseType: "arraybuffer",
|
|
18
|
+
validateStatus: () => true,
|
|
19
|
+
...options
|
|
20
|
+
});
|
|
21
|
+
const finalUrl = ((_b = (_a = response.request) == null ? void 0 : _a.res) == null ? void 0 : _b.responseUrl) ?? ((_c = response.request) == null ? void 0 : _c.responseURL) ?? url;
|
|
22
|
+
return {
|
|
23
|
+
finalUrl,
|
|
24
|
+
status: response.status,
|
|
25
|
+
statusText: response.statusText,
|
|
26
|
+
contentType: response.headers["content-type"],
|
|
27
|
+
contentLength: response.headers["content-length"],
|
|
28
|
+
dataLength: Buffer.isBuffer(response.data) ? response.data.length : void 0,
|
|
29
|
+
data: response.data
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
module.exports = fetchResponse;
|
|
33
|
+
module.exports.fetchResponse = fetchResponse;
|
|
34
|
+
module.exports.default = fetchResponse;
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
export {
|
|
39
|
+
require_fetchResponse
|
|
40
|
+
};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getCacheFile,
|
|
4
|
+
loadCache,
|
|
5
|
+
saveCache
|
|
6
|
+
} from "./chunk-QD4T255Z.mjs";
|
|
7
|
+
import {
|
|
8
|
+
buildChecksum,
|
|
9
|
+
getAllFiles
|
|
10
|
+
} from "./chunk-WSHVPGNM.mjs";
|
|
11
|
+
import {
|
|
12
|
+
init_esm_shims
|
|
13
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
14
|
+
|
|
15
|
+
// src/run-by-checksum/run.js
|
|
16
|
+
init_esm_shims();
|
|
17
|
+
import { spawn } from "child_process";
|
|
18
|
+
async function runChecksum({
|
|
19
|
+
patterns = [],
|
|
20
|
+
ignore = [],
|
|
21
|
+
exec,
|
|
22
|
+
cwd = process.env.INIT_CWD || process.cwd(),
|
|
23
|
+
dryRun = false
|
|
24
|
+
}) {
|
|
25
|
+
if (!patterns.length && !exec) {
|
|
26
|
+
console.log("No patterns or command provided, skipping checksum runner.");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
}
|
|
29
|
+
if (!exec) {
|
|
30
|
+
console.log("No command provided, skipping checksum runner.");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
if (!patterns.length) {
|
|
34
|
+
console.log("No patterns provided, skipping checksum runner.");
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
const files = getAllFiles({ patterns, ignore, cwd });
|
|
38
|
+
const checksum = buildChecksum(files);
|
|
39
|
+
const cacheFile = getCacheFile({ patterns, ignore, cwd });
|
|
40
|
+
const cache = loadCache(cacheFile);
|
|
41
|
+
if ((cache == null ? void 0 : cache.checksum) === checksum) {
|
|
42
|
+
return {
|
|
43
|
+
changed: false,
|
|
44
|
+
cacheFile,
|
|
45
|
+
files
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
if (dryRun) {
|
|
49
|
+
return {
|
|
50
|
+
changed: true,
|
|
51
|
+
cacheFile,
|
|
52
|
+
files,
|
|
53
|
+
skipped: true
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
await runCommand(exec, cwd);
|
|
57
|
+
saveCache(cacheFile, {
|
|
58
|
+
checksum,
|
|
59
|
+
files,
|
|
60
|
+
patterns,
|
|
61
|
+
ignore,
|
|
62
|
+
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
changed: true,
|
|
66
|
+
cacheFile,
|
|
67
|
+
files
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function runCommand(command, cwd) {
|
|
71
|
+
return new Promise((resolve, reject) => {
|
|
72
|
+
const child = spawn(command, {
|
|
73
|
+
shell: true,
|
|
74
|
+
stdio: "inherit",
|
|
75
|
+
cwd
|
|
76
|
+
});
|
|
77
|
+
child.on("exit", (code) => {
|
|
78
|
+
if (code === 0 || code === null) resolve();
|
|
79
|
+
else reject(new Error(`Command failed: ${code}`));
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export {
|
|
85
|
+
runChecksum
|
|
86
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./chunk-A3VUZEJK.mjs";
|
|
5
5
|
import {
|
|
6
6
|
require_utils
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-6RK5UCTP.mjs";
|
|
8
8
|
import {
|
|
9
9
|
__commonJS,
|
|
10
10
|
__require,
|
|
@@ -18,7 +18,7 @@ var require_user_config = __commonJS({
|
|
|
18
18
|
var gch = __require("git-command-helper");
|
|
19
19
|
var { runGitCommand, runGitCommandOutput } = require_utils2();
|
|
20
20
|
var { getArgs } = require_utils();
|
|
21
|
-
__require("dotenv").config({ path: __require("
|
|
21
|
+
__require("dotenv").config({ path: __require("upath").join(process.cwd(), ".env"), quiet: true });
|
|
22
22
|
function configureGitUser(cliUser = null, cliEmail = null, options = {}) {
|
|
23
23
|
console.log("\n=== Configuring Git User ===");
|
|
24
24
|
let username, email;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
init_esm_shims
|
|
4
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
+
|
|
6
|
+
// src/file/move.mjs
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import path from "upath";
|
|
10
|
+
async function move(src, dest) {
|
|
11
|
+
if (!await fs.pathExists(src)) {
|
|
12
|
+
throw new Error(`Source file does not exist: ${src}`);
|
|
13
|
+
}
|
|
14
|
+
const srcStat = await fs.stat(src);
|
|
15
|
+
let finalDest = dest;
|
|
16
|
+
if (srcStat.isFile()) {
|
|
17
|
+
const destStat = await fs.pathExists(dest) ? await fs.stat(dest) : null;
|
|
18
|
+
if (destStat && destStat.isDirectory()) {
|
|
19
|
+
finalDest = path.join(dest, path.basename(src));
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
await fs.ensureDir(path.dirname(finalDest));
|
|
23
|
+
await fs.move(src, finalDest, { overwrite: true });
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
move
|
|
28
|
+
};
|