binary-collections 2.0.12 → 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.cjs +89 -13
- package/binaries/submodule-token.cjs +89 -13
- package/binaries/test-cjs.cjs +89 -13
- package/binaries/test-esm.cjs +89 -13
- package/binaries/yarn-clean.cjs +89 -13
- package/binaries/yc +22 -1
- package/binaries/yc.cjs +89 -13
- 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 +115 -0
- 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/free-chatgpt.md +26 -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 +1 -1
- package/lib/binary-collections/config.mjs +1 -1
- package/lib/binary-collections/findScript.cjs +35 -10
- package/lib/binary-collections/findScript.mjs +2 -2
- package/lib/binary-collections/listScript.cjs +35 -10
- package/lib/binary-collections/listScript.mjs +2 -2
- package/lib/binary-collections.cjs +45 -25
- package/lib/binary-collections.mjs +11 -11
- package/lib/changelog.cjs +7 -12
- package/lib/changelog.mjs +2 -2
- package/lib/{chunk-SPTECFE5.mjs → chunk-2MN4VPV2.mjs} +86 -20
- package/lib/{chunk-V2IBPCEV.mjs → chunk-6C7KTYGZ.mjs} +3 -1
- package/lib/{chunk-5RTXZVCW.mjs → chunk-6RK5UCTP.mjs} +5 -10
- package/lib/{chunk-FB2WKVJD.mjs → chunk-CD3HF3LK.mjs} +67 -35
- package/lib/{chunk-6PU7BAHB.mjs → chunk-FLYSZFLW.mjs} +1 -1
- package/lib/chunk-KLKAIFKI.mjs +40 -0
- package/lib/chunk-LVSPEFU2.mjs +86 -0
- package/lib/{chunk-2LSRSEXF.mjs → chunk-MGPYPKIE.mjs} +2 -2
- package/lib/{chunk-ZOWVMII3.mjs → chunk-NQXUYO67.mjs} +35 -10
- package/lib/{chunk-C6D2TTYU.mjs → chunk-OBXLTXFJ.mjs} +4 -2
- package/lib/chunk-QD4T255Z.mjs +40 -0
- package/lib/{chunk-XPJGCDOD.mjs → chunk-QII2EKCS.mjs} +14 -2
- package/lib/chunk-RDGDLSPD.mjs +76 -0
- package/lib/{chunk-NCZPTKDV.mjs → chunk-RDN6HF5Z.mjs} +1 -1
- package/lib/chunk-RJKTSUAX.mjs +123 -0
- package/lib/{chunk-66KDU4TX.mjs → chunk-TBWXE7ST.mjs} +36 -61
- package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
- package/lib/chunk-WSHVPGNM.mjs +44 -0
- package/lib/{chunk-G5UUEWUO.mjs → chunk-X2B3X7D4.mjs} +1 -1
- package/lib/clean-github-actions-caches-cli.cjs +255 -213
- package/lib/clean-github-actions-caches-cli.mjs +25 -7
- package/lib/clean-github-actions-caches.cjs +231 -35
- package/lib/clean-github-actions-caches.d.cts +39 -1
- package/lib/clean-github-actions-caches.mjs +2 -1
- package/lib/cross-env/command.cjs +2 -2
- package/lib/cross-env/command.js +2 -2
- package/lib/cross-env/command.mjs +2 -2
- package/lib/cross-env/index.cjs +2 -2
- package/lib/cross-env/index.mjs +3 -3
- package/lib/cross-env/variable.mjs +2 -2
- package/lib/del-gradle.cjs +6 -11
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +185 -3
- package/lib/del-node-modules.js +3 -3
- package/lib/del-node-modules.mjs +6 -3
- package/lib/{del-ps.cjs → del-ps-cli.cjs} +36 -41
- package/lib/del-ps-cli.mjs +44 -0
- package/lib/del-yarn-caches.cjs +6 -11
- 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 +183 -2
- package/lib/file/copy-cli.mjs +6 -2
- package/lib/file/move-cli.cjs +183 -2
- package/lib/file/move-cli.mjs +6 -2
- package/lib/find-node-modules-cli.cjs +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 +6 -11
- package/lib/free-chatgpt.mjs +1 -1
- package/lib/git/user-config.cjs +7 -12
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +91 -30
- package/lib/git-diff-cli.mjs +3 -3
- package/lib/git-diff.cjs +91 -30
- package/lib/git-diff.js +85 -28
- package/lib/git-diff.mjs +3 -3
- package/lib/git-fix.cjs +7 -12
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +7 -12
- package/lib/git-purge.mjs +2 -2
- package/lib/index.cjs +1 -1
- package/lib/index.mjs +1 -1
- package/lib/node-cache-cleaner-cli.cjs +185 -2
- package/lib/node-cache-cleaner-cli.js +2 -5
- package/lib/node-cache-cleaner-cli.mjs +8 -4
- package/lib/node-executor.cjs +183 -2
- package/lib/node-executor.mjs +5 -2
- 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 +7 -12
- package/lib/npm-run-series.mjs +2 -2
- package/lib/package-resolutions-updater-cli.cjs +73 -76
- package/lib/package-resolutions-updater-cli.mjs +4 -3
- package/lib/package-resolutions-updater.cjs +71 -74
- package/lib/package-resolutions-updater.d.mts +34 -0
- package/lib/package-resolutions-updater.mjs +3 -2
- package/lib/php-cs-fixer-staged.cjs +1 -1
- package/lib/php-cs-fixer-staged.mjs +1 -1
- package/lib/print-directory-tree.cjs +16 -18
- 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/index.cjs +10 -10
- package/lib/ps/index.mjs +4 -4
- package/lib/ps/table-parser.d.ts +3 -4
- package/lib/ps/table-parser.js +9 -16
- package/lib/remove-module.cjs +17 -22
- package/lib/remove-module.mjs +2 -2
- package/lib/rm-node-module-cli.cjs +171 -4
- package/lib/rm-node-module-cli.mjs +7 -4
- 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/{ps/isWin.mjs → run-by-checksum/hash.mjs} +5 -5
- 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 +8 -13
- package/lib/submodule-install.mjs +3 -3
- package/lib/submodule-remove-cli.cjs +169 -2
- package/lib/submodule-remove-cli.js +2 -2
- package/lib/submodule-remove-cli.mjs +5 -2
- 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/index.cjs +5 -10
- package/lib/utils/index.d.cts +2 -9
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isWindows.mjs +3 -1
- package/lib/utils/runBash.cjs +1 -1
- package/lib/utils/runBash.mjs +1 -1
- package/lib/yarn-per-branch-lock-installer.cjs +202 -11
- package/lib/yarn-per-branch-lock-installer.mjs +24 -11
- package/lib/yarn-reinstall.cjs +6 -11
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +35 -10
- package/readme.html +2 -2
- package/readme.md +5 -5
- package/releases/readme.md +6 -3
- 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/.opencode/package.json +0 -5
- package/lib/chunk-6S4NXESK.mjs +0 -26
- package/lib/del-ps.js +0 -32
- package/lib/del-ps.mjs +0 -43
- package/lib/ps/isWin.cjs +0 -26
- package/lib/ps/isWin.d.ts +0 -2
- package/lib/ps/isWin.js +0 -4
- package/test/package.json +0 -20
- package/test-project/package.json +0 -22
- package/test-project/workspaces/workspace-a/package.json +0 -135
- package/test-project/workspaces/workspace-a/test/demo/package.json +0 -25
- package/test-project/workspaces/workspace-b/package.json +0 -139
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +0 -7
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +0 -96
- package/tmp/rm-node-modules-test-project/package.json +0 -17
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +0 -16
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +0 -16
- package/tmp/test-repo/package.json +0 -17
- /package/lib/{del-ps.d.ts → del-ps-cli.d.mts} +0 -0
|
@@ -2,6 +2,9 @@ import { createRequire } from 'module'; const require = createRequire(import.met
|
|
|
2
2
|
import {
|
|
3
3
|
require_findEnvFiles
|
|
4
4
|
} from "./chunk-H44UWUFY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
require_utils
|
|
7
|
+
} from "./chunk-6RK5UCTP.mjs";
|
|
5
8
|
import {
|
|
6
9
|
__commonJS,
|
|
7
10
|
__require,
|
|
@@ -13,14 +16,14 @@ var require_clean_github_actions_caches = __commonJS({
|
|
|
13
16
|
"src/clean-github-actions-caches.cjs"(exports, module) {
|
|
14
17
|
init_esm_shims();
|
|
15
18
|
var axios = __require("axios");
|
|
16
|
-
var
|
|
19
|
+
var { getArgs } = require_utils();
|
|
17
20
|
var { findEnvWithToken } = require_findEnvFiles();
|
|
18
21
|
__require("dotenv").config({
|
|
19
22
|
path: findEnvWithToken(),
|
|
20
23
|
quiet: true,
|
|
21
24
|
overwrite: true
|
|
22
25
|
});
|
|
23
|
-
var ACCESS_TOKEN = process.env.
|
|
26
|
+
var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
|
|
24
27
|
if (!ACCESS_TOKEN) {
|
|
25
28
|
throw new Error(
|
|
26
29
|
"Access token is not provided. Please set ACCESS_TOKEN or GITHUB_TOKEN in your environment variables."
|
|
@@ -43,6 +46,9 @@ Options:
|
|
|
43
46
|
-r, --repo <repo> GitHub repository (owner/repo). If omitted, the tool will
|
|
44
47
|
attempt to infer the repository from the current working
|
|
45
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.
|
|
46
52
|
|
|
47
53
|
Environment Variables:
|
|
48
54
|
ACCESS_TOKEN GitHub access token (preferred)
|
|
@@ -59,22 +65,23 @@ Examples:
|
|
|
59
65
|
clean-github-actions-caches --repo octocat/hello-world
|
|
60
66
|
|
|
61
67
|
# Run via npx without installing
|
|
62
|
-
|
|
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
|
|
63
69
|
|
|
64
70
|
# Run via yarn dlx
|
|
65
|
-
|
|
71
|
+
yarn dlx binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz clean-github-actions-caches --prefix-depth 3
|
|
66
72
|
|
|
67
73
|
Notes:
|
|
68
74
|
- Ensure ACCESS_TOKEN or GITHUB_TOKEN is set and has permissions to manage Actions caches.
|
|
69
75
|
- Intended for repository maintainers with appropriate permissions.
|
|
70
76
|
`);
|
|
71
77
|
}
|
|
72
|
-
var argv =
|
|
78
|
+
var argv = getArgs({
|
|
73
79
|
alias: {
|
|
74
80
|
h: "help",
|
|
81
|
+
p: "prefix-depth",
|
|
75
82
|
r: "repo"
|
|
76
83
|
},
|
|
77
|
-
string: ["repo"],
|
|
84
|
+
string: ["prefix-depth", "repo"],
|
|
78
85
|
boolean: ["help"]
|
|
79
86
|
});
|
|
80
87
|
if (argv.help) {
|
|
@@ -103,7 +110,53 @@ Notes:
|
|
|
103
110
|
});
|
|
104
111
|
});
|
|
105
112
|
}
|
|
106
|
-
function
|
|
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) {
|
|
107
160
|
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches`;
|
|
108
161
|
return new Promise((resolve, reject) => {
|
|
109
162
|
axios.get(url, {
|
|
@@ -113,42 +166,21 @@ Notes:
|
|
|
113
166
|
}
|
|
114
167
|
}).then((response) => {
|
|
115
168
|
const data = response.data.actions_caches;
|
|
116
|
-
const
|
|
117
|
-
const split = key.split(/[-_]/);
|
|
118
|
-
if (split.length === 3) {
|
|
119
|
-
return `${split[0]}-${split[1]}`;
|
|
120
|
-
}
|
|
121
|
-
if (split.length > 3) {
|
|
122
|
-
return `${split[0]}-${split[1]}-${split[2]}`;
|
|
123
|
-
}
|
|
124
|
-
return split[0];
|
|
125
|
-
};
|
|
126
|
-
const grouped = data.reduce(
|
|
127
|
-
/**
|
|
128
|
-
* @param {Record<string, Record<string, any>[]>} acc
|
|
129
|
-
* @param {Record<string, any>} item
|
|
130
|
-
* @returns {Record<string, Record<string, any>[]>}
|
|
131
|
-
*/
|
|
132
|
-
(acc, item) => {
|
|
133
|
-
const prefix = getPrefix(item.key);
|
|
134
|
-
if (!acc[prefix]) {
|
|
135
|
-
acc[prefix] = [];
|
|
136
|
-
}
|
|
137
|
-
acc[prefix].push(item);
|
|
138
|
-
return acc;
|
|
139
|
-
},
|
|
140
|
-
{}
|
|
141
|
-
);
|
|
169
|
+
const grouped = groupCachesByPrefix(data, prefixDepth);
|
|
142
170
|
resolve(grouped);
|
|
143
171
|
}).catch((error) => {
|
|
144
|
-
console.error("Error fetching data:", error);
|
|
145
172
|
reject(error);
|
|
146
173
|
});
|
|
147
174
|
});
|
|
148
175
|
}
|
|
149
176
|
module.exports = {
|
|
150
177
|
deleteGitHubActionsCache,
|
|
151
|
-
|
|
178
|
+
getCachePrefix,
|
|
179
|
+
getMeaningfulCacheKeyParts,
|
|
180
|
+
get_caches,
|
|
181
|
+
groupCachesByPrefix,
|
|
182
|
+
isChecksumSegment,
|
|
183
|
+
normalizePrefixDepth
|
|
152
184
|
};
|
|
153
185
|
}
|
|
154
186
|
});
|
|
@@ -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;
|
|
@@ -8,7 +8,7 @@ var require_package = __commonJS({
|
|
|
8
8
|
"package.json"(exports, module) {
|
|
9
9
|
module.exports = {
|
|
10
10
|
name: "binary-collections",
|
|
11
|
-
version: "2.0.
|
|
11
|
+
version: "2.0.13",
|
|
12
12
|
description: "Utility to clean any programming caches and more",
|
|
13
13
|
keywords: [
|
|
14
14
|
"cache",
|
|
@@ -44,19 +44,19 @@ var require_package = __commonJS({
|
|
|
44
44
|
files: [
|
|
45
45
|
"binaries",
|
|
46
46
|
"lib",
|
|
47
|
-
"
|
|
47
|
+
"docs-src",
|
|
48
48
|
"readme.md",
|
|
49
49
|
".puppeterrc.cjs",
|
|
50
50
|
"requirements.txt"
|
|
51
51
|
],
|
|
52
52
|
scripts: {
|
|
53
53
|
build: "tsc -b tsconfig.build.json && npm run build-tsup && npm run build-exports",
|
|
54
|
-
"build-exports": "node -r ts-node/register -r dotenv/config build.
|
|
54
|
+
"build-exports": "node -r ts-node/register -r dotenv/config build.mjs",
|
|
55
55
|
"build-packages": "yarn workspaces foreach --worktree --exclude=binary-collections --no-private run build",
|
|
56
56
|
"build-rollup": "rollup -c rollup.config.js",
|
|
57
57
|
"build-tsup": "node build.tsup.js",
|
|
58
58
|
clean: "rimraf lib tmp/dist binaries",
|
|
59
|
-
pack: "node
|
|
59
|
+
pack: "node package.cjs --yarn --filename=bin",
|
|
60
60
|
prepare: "husky",
|
|
61
61
|
"puppeteer:browser": "npx -y puppeteer browsers install chrome",
|
|
62
62
|
test: "test-cjs",
|
|
@@ -76,6 +76,7 @@ var require_package = __commonJS({
|
|
|
76
76
|
"ansi-colors": "^4.1.3",
|
|
77
77
|
axios: "^1.16.1",
|
|
78
78
|
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/78b09a1f799430fb251c1b438ec56ce7957674f4/release/cross-spawn.tgz",
|
|
79
|
+
"crypto-js": "^4.2.0",
|
|
79
80
|
dotenv: "^17.4.2",
|
|
80
81
|
"fs-extra": "^11.3.5",
|
|
81
82
|
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/ed17f70eb7444d24bd8eb984a4afe9fd64652838/release/git-command-helper.tgz",
|
|
@@ -87,9 +88,12 @@ var require_package = __commonJS({
|
|
|
87
88
|
"puppeteer-extra": "^3.3.6",
|
|
88
89
|
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
89
90
|
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/44e5c7b79b4e60f8c2d34857c27b8ce677d7493e/packages/sbg-utility/release/sbg-utility.tgz",
|
|
91
|
+
"tar-stream": "^3.2.0",
|
|
90
92
|
upath: "^3.0.7",
|
|
93
|
+
which: "^7.0.0",
|
|
91
94
|
yaml: "^2.9.0",
|
|
92
|
-
yarn: "^1.22.22"
|
|
95
|
+
yarn: "^1.22.22",
|
|
96
|
+
zlib: "^1.0.5"
|
|
93
97
|
},
|
|
94
98
|
devDependencies: {
|
|
95
99
|
"@babel/core": "^7.29.0",
|
|
@@ -103,12 +107,15 @@ var require_package = __commonJS({
|
|
|
103
107
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
104
108
|
"@types/babel__core": "^7",
|
|
105
109
|
"@types/babel__preset-env": "^7",
|
|
110
|
+
"@types/crypto-js": "^4",
|
|
106
111
|
"@types/fs-extra": "^11",
|
|
107
112
|
"@types/jest": "^30.0.0",
|
|
108
113
|
"@types/minimist": "^1",
|
|
109
114
|
"@types/mocha": "^10.0.10",
|
|
110
115
|
"@types/node": "^25.9.1",
|
|
111
116
|
"@types/ps-node": "^0",
|
|
117
|
+
"@types/tar-stream": "^3",
|
|
118
|
+
"@types/which": "^3.0.4",
|
|
112
119
|
"babel-jest": "^30.4.1",
|
|
113
120
|
"browser-sync": "^3.0.4",
|
|
114
121
|
"cross-env": "^10.1.0",
|
|
@@ -136,13 +143,16 @@ var require_package = __commonJS({
|
|
|
136
143
|
resolutions: {
|
|
137
144
|
"@types/through2": "https://github.com/dimaslanjaka/nodejs-package-types/raw/refs/heads/through2/release/types-through2.tgz",
|
|
138
145
|
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/78b09a1f799430fb251c1b438ec56ce7957674f4/release/cross-spawn.tgz",
|
|
139
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/
|
|
146
|
+
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/dd8c8ef596083f367c592f97a2439f9fc8ab33b2/release/git-command-helper.tgz",
|
|
140
147
|
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/44e5c7b79b4e60f8c2d34857c27b8ce677d7493e/packages/sbg-utility/release/sbg-utility.tgz",
|
|
141
|
-
"@dimaslanjaka/eslint-base-config": "https://github.com/dimaslanjaka/eslint-base-config/raw/
|
|
148
|
+
"@dimaslanjaka/eslint-base-config": "https://github.com/dimaslanjaka/eslint-base-config/raw/9741b4feac89f303ea585e3ecac2b0e768434135/release/dimaslanjaka-eslint-base-config.tgz"
|
|
142
149
|
},
|
|
143
150
|
bin: {
|
|
144
151
|
"binary-collections": "lib/binary-collections.cjs",
|
|
145
152
|
"binary-executor": "binaries/binary-executor.cjs",
|
|
153
|
+
"build-package": "lib/node-package-packer-cli.cjs",
|
|
154
|
+
"build-package-tarball": "lib/node-package-packer-cli.cjs",
|
|
155
|
+
"build-tarball": "lib/node-package-packer-cli.cjs",
|
|
146
156
|
changelog: "lib/changelog.cjs",
|
|
147
157
|
chatgpt: "lib/free-chatgpt.cjs",
|
|
148
158
|
"clean-github-actions-cache": "lib/clean-github-actions-caches-cli.cjs",
|
|
@@ -157,14 +167,19 @@ var require_package = __commonJS({
|
|
|
157
167
|
"del-gradle": "lib/del-gradle.cjs",
|
|
158
168
|
"del-node-modules": "lib/del-node-modules.cjs",
|
|
159
169
|
"del-nodemodules": "lib/del-node-modules.cjs",
|
|
160
|
-
"del-ps": "lib/del-ps.cjs",
|
|
170
|
+
"del-ps": "lib/del-ps-cli.cjs",
|
|
161
171
|
"del-yarn-caches": "lib/del-yarn-caches.cjs",
|
|
162
172
|
"del-yarncaches": "lib/del-yarn-caches.cjs",
|
|
163
173
|
dev: "binaries/dev.cjs",
|
|
164
174
|
"dir-tree": "lib/print-directory-tree.cjs",
|
|
175
|
+
download: "lib/downloader-cli.cjs",
|
|
176
|
+
"download-file": "lib/downloader-cli.cjs",
|
|
177
|
+
downloader: "lib/downloader-cli.cjs",
|
|
165
178
|
empty: "binaries/empty.cjs",
|
|
166
179
|
"exec-node": "lib/node-executor.cjs",
|
|
167
180
|
"execute-node": "lib/node-executor.cjs",
|
|
181
|
+
"fetch-file": "lib/downloader-cli.cjs",
|
|
182
|
+
"file-downloader": "lib/downloader-cli.cjs",
|
|
168
183
|
"find-node-modules": "lib/find-node-modules-cli.cjs",
|
|
169
184
|
"free-chatgpt": "lib/free-chatgpt.cjs",
|
|
170
185
|
"git-diff": "lib/git-diff-cli.cjs",
|
|
@@ -183,14 +198,18 @@ var require_package = __commonJS({
|
|
|
183
198
|
"node-exec": "lib/node-executor.cjs",
|
|
184
199
|
"node-executor": "lib/node-executor.cjs",
|
|
185
200
|
"node-move": "lib/file/move-cli.cjs",
|
|
201
|
+
"node-package-packer": "lib/node-package-packer-cli.cjs",
|
|
186
202
|
nodekill: "binaries/nodekill.cjs",
|
|
187
203
|
"npm-run-series": "lib/npm-run-series.cjs",
|
|
188
204
|
nrs: "lib/npm-run-series.cjs",
|
|
205
|
+
"pack-node-package": "lib/node-package-packer-cli.cjs",
|
|
206
|
+
"pack-tarball": "lib/node-package-packer-cli.cjs",
|
|
189
207
|
"package-resolutions-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
190
208
|
"php-cs-fixer-staged": "lib/php-cs-fixer-staged.cjs",
|
|
191
209
|
"pkg-res-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
192
210
|
"pkg-resolutions-updater": "lib/package-resolutions-updater-cli.cjs",
|
|
193
211
|
"print-directory-tree": "lib/print-directory-tree.cjs",
|
|
212
|
+
"print-tarball-tree": "lib/print-tarball-tree.cjs",
|
|
194
213
|
"print-tree": "lib/print-directory-tree.cjs",
|
|
195
214
|
prod: "binaries/prod.cjs",
|
|
196
215
|
py: "binaries/py.cjs",
|
|
@@ -200,13 +219,18 @@ var require_package = __commonJS({
|
|
|
200
219
|
"rm-node-module": "lib/rm-node-module-cli.cjs",
|
|
201
220
|
"rm-node-modules": "lib/rm-node-module-cli.cjs",
|
|
202
221
|
rmfind: "binaries/rmfind.cjs",
|
|
203
|
-
rmpath: "lib/rmpath.cjs",
|
|
222
|
+
rmpath: "lib/rmpath-cli.cjs",
|
|
204
223
|
rmx: "binaries/rmx.cjs",
|
|
224
|
+
"run-by-checksum": "lib/run-by-checksum-cli.cjs",
|
|
225
|
+
"run-c": "lib/run-by-checksum-cli.cjs",
|
|
226
|
+
"run-checksum": "lib/run-by-checksum-cli.cjs",
|
|
205
227
|
"run-s": "lib/npm-run-series.cjs",
|
|
206
228
|
"run-series": "lib/npm-run-series.cjs",
|
|
207
229
|
"submodule-install": "lib/submodule-install.cjs",
|
|
208
230
|
"submodule-remove": "lib/submodule-remove-cli.cjs",
|
|
209
231
|
"submodule-token": "binaries/submodule-token.cjs",
|
|
232
|
+
"tarball-packer": "lib/node-package-packer-cli.cjs",
|
|
233
|
+
"tarball-tree": "lib/print-tarball-tree.cjs",
|
|
210
234
|
"test-cjs": "binaries/test-cjs.cjs",
|
|
211
235
|
"test-esm": "binaries/test-esm.cjs",
|
|
212
236
|
"undo-commit": "lib/git/undo-commit.cjs",
|
|
@@ -217,7 +241,8 @@ var require_package = __commonJS({
|
|
|
217
241
|
"yarn-install": "lib/yarn-per-branch-lock-installer.cjs",
|
|
218
242
|
"yarn-per-branch-lock-installer": "lib/yarn-per-branch-lock-installer.cjs",
|
|
219
243
|
"yarn-reinstall": "lib/yarn-reinstall.cjs",
|
|
220
|
-
yc: "binaries/yc.cjs"
|
|
244
|
+
yc: "binaries/yc.cjs",
|
|
245
|
+
ycw: "binaries/ycw.cjs"
|
|
221
246
|
}
|
|
222
247
|
};
|
|
223
248
|
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
init_isWindows,
|
|
3
4
|
isWindows
|
|
4
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-QII2EKCS.mjs";
|
|
5
6
|
import {
|
|
6
7
|
init_esm_shims
|
|
7
8
|
} from "./chunk-QQ4A6DLD.mjs";
|
|
8
9
|
|
|
9
10
|
// src/cross-env/command.ts
|
|
10
11
|
init_esm_shims();
|
|
11
|
-
|
|
12
|
+
init_isWindows();
|
|
13
|
+
import path from "upath";
|
|
12
14
|
function commandConvert(command, env, normalize = false) {
|
|
13
15
|
if (!isWindows()) {
|
|
14
16
|
return command;
|
|
@@ -0,0 +1,40 @@
|
|
|
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/run-by-checksum/cache.js
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import path from "upath";
|
|
10
|
+
import crypto from "crypto";
|
|
11
|
+
function md5(str) {
|
|
12
|
+
return crypto.createHash("md5").update(str).digest("hex");
|
|
13
|
+
}
|
|
14
|
+
function getCacheFile({ patterns, ignore, cwd }) {
|
|
15
|
+
const root = cwd || process.env.INIT_CWD || process.cwd();
|
|
16
|
+
const key = md5(
|
|
17
|
+
JSON.stringify({
|
|
18
|
+
patterns: [...patterns].sort(),
|
|
19
|
+
ignore: [...ignore].sort()
|
|
20
|
+
})
|
|
21
|
+
);
|
|
22
|
+
return path.join(root, "tmp", ".checksum", `${key}.json`);
|
|
23
|
+
}
|
|
24
|
+
function loadCache(file) {
|
|
25
|
+
try {
|
|
26
|
+
return fs.readJsonSync(file);
|
|
27
|
+
} catch {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
function saveCache(file, data) {
|
|
32
|
+
fs.ensureDirSync(path.dirname(file));
|
|
33
|
+
fs.writeJsonSync(file, data, { spaces: 2 });
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
getCacheFile,
|
|
38
|
+
loadCache,
|
|
39
|
+
saveCache
|
|
40
|
+
};
|
|
@@ -1,14 +1,26 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
|
+
__esm,
|
|
4
|
+
__export,
|
|
3
5
|
init_esm_shims
|
|
4
6
|
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
7
|
|
|
6
8
|
// src/utils/isWindows.js
|
|
7
|
-
|
|
9
|
+
var isWindows_exports = {};
|
|
10
|
+
__export(isWindows_exports, {
|
|
11
|
+
isWindows: () => isWindows
|
|
12
|
+
});
|
|
8
13
|
function isWindows() {
|
|
9
14
|
return process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE || "");
|
|
10
15
|
}
|
|
16
|
+
var init_isWindows = __esm({
|
|
17
|
+
"src/utils/isWindows.js"() {
|
|
18
|
+
init_esm_shims();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
11
21
|
|
|
12
22
|
export {
|
|
13
|
-
isWindows
|
|
23
|
+
isWindows,
|
|
24
|
+
isWindows_exports,
|
|
25
|
+
init_isWindows
|
|
14
26
|
};
|
|
@@ -0,0 +1,76 @@
|
|
|
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/rmpath.mjs
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import dotenv from "dotenv";
|
|
9
|
+
import fs from "fs-extra";
|
|
10
|
+
import * as glob from "glob";
|
|
11
|
+
import path from "upath";
|
|
12
|
+
import { fileURLToPath } from "url";
|
|
13
|
+
var __filename = fileURLToPath(import.meta.url);
|
|
14
|
+
var __dirname = path.dirname(__filename);
|
|
15
|
+
var dotenvPath = path.resolve(process.cwd(), ".env");
|
|
16
|
+
if (fs.existsSync(dotenvPath)) {
|
|
17
|
+
dotenv.config({ path: dotenvPath, override: true, quiet: true });
|
|
18
|
+
}
|
|
19
|
+
var deletePatterns = [];
|
|
20
|
+
function resolveDeletePatterns(targetPath) {
|
|
21
|
+
if (fs.existsSync(targetPath) && fs.lstatSync(targetPath).isFile()) {
|
|
22
|
+
deletePatterns.push(targetPath);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const vowels = ["a", "i", "u", "e", "o", "A", "I", "U", "E", "O"];
|
|
26
|
+
const letters = [];
|
|
27
|
+
for (let i = 97; i <= 122; i++) letters.push(String.fromCharCode(i));
|
|
28
|
+
for (let i = 65; i <= 90; i++) letters.push(String.fromCharCode(i));
|
|
29
|
+
for (const letter of letters) {
|
|
30
|
+
for (const vowel of vowels) {
|
|
31
|
+
deletePatterns.push(
|
|
32
|
+
`.${letter}*`,
|
|
33
|
+
`@${letter}*`,
|
|
34
|
+
`${letter}*`,
|
|
35
|
+
`@${letter}${vowel}*`,
|
|
36
|
+
`.${letter}${vowel}*`,
|
|
37
|
+
`${letter}${vowel}*`
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
async function deleteMatchingFiles(baseDir) {
|
|
43
|
+
for (const pattern of deletePatterns) {
|
|
44
|
+
if (fs.existsSync(pattern)) {
|
|
45
|
+
fs.rmSync(pattern, { recursive: true, force: true });
|
|
46
|
+
continue;
|
|
47
|
+
}
|
|
48
|
+
const matches = glob.sync(path.join(baseDir, pattern), { dot: true, nocase: true });
|
|
49
|
+
for (const fpath of matches) {
|
|
50
|
+
try {
|
|
51
|
+
console.log(`deleting ${fpath}`);
|
|
52
|
+
fs.rmSync(fpath, { recursive: true, force: true });
|
|
53
|
+
} catch (_e) {
|
|
54
|
+
console.error(`cannot delete ${fpath}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
async function deleteMainScript(targetPath) {
|
|
60
|
+
if (!fs.existsSync(targetPath)) {
|
|
61
|
+
targetPath = path.resolve(process.cwd(), targetPath);
|
|
62
|
+
}
|
|
63
|
+
resolveDeletePatterns(targetPath);
|
|
64
|
+
await deleteMatchingFiles(targetPath);
|
|
65
|
+
console.log(`cleaning ${targetPath}`);
|
|
66
|
+
try {
|
|
67
|
+
fs.rmSync(targetPath, { recursive: true, force: true });
|
|
68
|
+
} catch (_e) {
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export {
|
|
73
|
+
resolveDeletePatterns,
|
|
74
|
+
deleteMatchingFiles,
|
|
75
|
+
deleteMainScript
|
|
76
|
+
};
|