binary-collections 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/package.json +5 -0
- package/binaries/rmx +15 -1
- package/binaries/rmx.cmd +12 -0
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +178 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +110 -0
- package/binaries/yc.cjs +178 -0
- package/lib/binary-collections/config.cjs +126 -0
- package/lib/binary-collections/config.mjs +7 -0
- package/lib/binary-collections/executeScript.cjs +19 -0
- package/lib/binary-collections/executeScript.d.cts +12 -0
- package/lib/binary-collections/executeScript.mjs +6 -0
- package/lib/binary-collections/findScript.cjs +284 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +266 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +224 -137
- package/lib/binary-collections.mjs +22 -282
- package/lib/changelog.cjs +2 -2
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
- package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
- package/lib/chunk-6PU7BAHB.mjs +61 -0
- package/lib/chunk-C6D2TTYU.mjs +32 -0
- package/lib/chunk-FB2WKVJD.mjs +158 -0
- package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-NCZPTKDV.mjs +79 -0
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OGXVGBRI.mjs +29 -0
- package/lib/chunk-OXV52GD5.mjs +62 -0
- package/lib/chunk-PXBMHE7O.mjs +35 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-SPTECFE5.mjs +180 -0
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/chunk-V2IBPCEV.mjs +39 -0
- package/lib/chunk-XPJGCDOD.mjs +14 -0
- package/lib/chunk-ZOWVMII3.mjs +228 -0
- package/lib/clean-github-actions-caches-cli.cjs +465 -0
- package/lib/clean-github-actions-caches-cli.d.cts +1 -0
- package/lib/clean-github-actions-caches-cli.mjs +56 -0
- package/lib/clean-github-actions-caches.cjs +149 -205
- package/lib/clean-github-actions-caches.d.cts +15 -1
- package/lib/clean-github-actions-caches.mjs +4 -130
- package/lib/cross-env/command.cjs +63 -0
- package/lib/cross-env/command.d.ts +8 -0
- package/lib/cross-env/command.js +45 -0
- package/lib/cross-env/command.mjs +9 -0
- package/lib/cross-env/index.cjs +178 -0
- package/lib/cross-env/index.d.ts +8 -0
- package/lib/cross-env/index.js +102 -0
- package/lib/cross-env/index.mjs +101 -0
- package/lib/cross-env/variable.cjs +60 -0
- package/lib/cross-env/variable.d.ts +7 -0
- package/lib/cross-env/variable.js +59 -0
- package/lib/cross-env/variable.mjs +9 -0
- package/lib/del-gradle.cjs +2 -2
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.js +24 -24
- package/lib/del-ps.cjs +2 -2
- package/lib/del-ps.js +8 -8
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +2 -2
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/file/copy-cli.cjs +92 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +55 -0
- package/lib/file/copy.cjs +56 -0
- package/lib/file/copy.d.mts +1 -0
- package/lib/file/copy.mjs +8 -0
- package/lib/file/move-cli.cjs +91 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +55 -0
- package/lib/file/move.cjs +55 -0
- package/lib/file/move.d.mts +1 -0
- package/lib/file/move.mjs +8 -0
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/free-chatgpt.cjs +21 -15
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +2 -2
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +188 -42
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +188 -42
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +91 -34
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +2 -2
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +2 -2
- package/lib/git-purge.mjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/kill-night-crows.cjs +7 -7
- package/lib/kill-night-crows.mjs +7 -7
- package/lib/node-cache-cleaner/npm.cjs +65 -0
- package/lib/node-cache-cleaner/npm.d.ts +2 -0
- package/lib/node-cache-cleaner/npm.js +41 -0
- package/lib/node-cache-cleaner/npm.mjs +10 -0
- package/lib/node-cache-cleaner/npx.cjs +89 -0
- package/lib/node-cache-cleaner/npx.d.ts +4 -0
- package/lib/node-cache-cleaner/npx.js +82 -0
- package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
- package/lib/node-cache-cleaner/yarn.cjs +73 -0
- package/lib/node-cache-cleaner/yarn.d.ts +2 -0
- package/lib/node-cache-cleaner/yarn.js +62 -0
- package/lib/node-cache-cleaner/yarn.mjs +10 -0
- package/lib/node-cache-cleaner-cli.cjs +182 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +60 -0
- package/lib/node-cache-cleaner-cli.mjs +56 -0
- package/lib/node-executor.cjs +91 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +103 -0
- package/lib/npm-run-series.cjs +21 -28
- package/lib/npm-run-series.mjs +20 -6
- package/lib/package-resolutions-updater-cli.cjs +213 -128
- package/lib/package-resolutions-updater-cli.mjs +17 -39
- package/lib/package-resolutions-updater.cjs +204 -98
- package/lib/package-resolutions-updater.d.mts +20 -1
- package/lib/package-resolutions-updater.mjs +7 -5
- package/lib/print-directory-tree.cjs +2 -2
- package/lib/print-directory-tree.mjs +1 -1
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +1 -1
- package/lib/ps/index.mjs +177 -171
- package/lib/ps/isWin.js +1 -1
- package/lib/ps/table-parser.js +6 -6
- package/lib/remove-module.cjs +2 -2
- package/lib/remove-module.mjs +1 -1
- package/lib/rm-node-module-cli.cjs +222 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +89 -0
- package/lib/rm-node-modules.cjs +127 -0
- package/lib/rm-node-modules.d.cts +35 -0
- package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
- package/lib/rmpath.cjs +2 -2
- package/lib/rmpath.mjs +1 -1
- package/lib/submodule-install.cjs +47 -34
- package/lib/submodule-install.mjs +46 -33
- package/lib/submodule-remove-cli.cjs +1 -2
- package/lib/submodule-remove-cli.js +3 -3
- package/lib/submodule-remove-cli.mjs +1 -2
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +28 -46
- package/lib/utils/findEnvFiles.d.cts +19 -0
- package/lib/utils/findEnvFiles.mjs +3 -5
- package/lib/utils/findWorkspaceRoot.js +4 -4
- package/lib/utils/index.cjs +2 -2
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +8 -0
- package/lib/utils/runBash.cjs +53 -0
- package/lib/utils/runBash.d.cts +12 -0
- package/lib/utils/runBash.mjs +66 -0
- package/lib/yarn-per-branch-lock-installer.cjs +97 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +109 -0
- package/lib/yarn-reinstall.cjs +2 -2
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +61 -52
- package/readme.html +784 -0
- package/readme.md +106 -218
- package/releases/readme.md +1 -1
- package/test/README.md +2 -2
- package/test-project/package.json +8 -2
- package/test-project/workspaces/workspace-a/package.json +135 -0
- package/test-project/workspaces/workspace-a/readme.md +20 -0
- package/test-project/workspaces/workspace-a/release/readme.md +42 -0
- package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
- package/test-project/workspaces/workspace-a/test/readme.md +12 -0
- package/test-project/workspaces/workspace-b/package.json +139 -0
- package/test-project/workspaces/workspace-b/readme.md +94 -0
- package/test-project/workspaces/workspace-b/requirements.txt +1 -0
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/rm-node-modules-test-project/package.json +17 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo/package.json +13 -3
- package/docs-src/clean-github-actions-caches.md +0 -26
- package/docs-src/free-chatgpt.md +0 -26
- package/lib/binary-collections-config.cjs +0 -15
- package/lib/chunk-2CBJCW7E.mjs +0 -81
- package/lib/chunk-4UHL4WVN.mjs +0 -136
- package/lib/chunk-66PAU5PS.mjs +0 -31
- package/lib/chunk-6HHJRKFB.mjs +0 -59
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-FCDQGYBF.mjs +0 -136
- package/lib/chunk-GEYA2USY.mjs +0 -207
- package/lib/chunk-GJTGHXRA.mjs +0 -356
- package/lib/chunk-ID2WBTE2.mjs +0 -80
- package/lib/chunk-JXFOHKDM.mjs +0 -239
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- package/lib/chunk-RWLXRTYP.mjs +0 -109
- package/lib/chunk-TOIVAQF7.mjs +0 -136
- package/lib/chunk-V5SKYJUB.mjs +0 -136
- package/lib/chunk-WSRETQCA.mjs +0 -59
- package/lib/chunk-YYLIQQKF.mjs +0 -31
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_findEnvFiles
|
|
4
|
+
} from "./chunk-H44UWUFY.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__commonJS,
|
|
7
|
+
__require,
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
10
|
+
|
|
11
|
+
// src/clean-github-actions-caches.cjs
|
|
12
|
+
var require_clean_github_actions_caches = __commonJS({
|
|
13
|
+
"src/clean-github-actions-caches.cjs"(exports, module) {
|
|
14
|
+
init_esm_shims();
|
|
15
|
+
var axios = __require("axios");
|
|
16
|
+
var minimist = __require("minimist");
|
|
17
|
+
var { findEnvWithToken } = require_findEnvFiles();
|
|
18
|
+
__require("dotenv").config({
|
|
19
|
+
path: findEnvWithToken(),
|
|
20
|
+
quiet: true,
|
|
21
|
+
overwrite: true
|
|
22
|
+
});
|
|
23
|
+
var ACCESS_TOKEN = process.env.GITHUB_TOKEN || process.env.ACCESS_TOKEN;
|
|
24
|
+
if (!ACCESS_TOKEN) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
"Access token is not provided. Please set ACCESS_TOKEN or GITHUB_TOKEN in your environment variables."
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
function printHelp() {
|
|
30
|
+
console.log(`
|
|
31
|
+
GitHub Actions Cache Cleaner
|
|
32
|
+
|
|
33
|
+
Description:
|
|
34
|
+
Removes outdated GitHub Actions caches for a repository, keeping only the newest
|
|
35
|
+
cache for each cache-key prefix. Authenticates via ACCESS_TOKEN or GITHUB_TOKEN
|
|
36
|
+
from your environment or .env file.
|
|
37
|
+
|
|
38
|
+
Usage:
|
|
39
|
+
clean-github-actions-caches [options]
|
|
40
|
+
|
|
41
|
+
Options:
|
|
42
|
+
-h, --help Show this help message
|
|
43
|
+
-r, --repo <repo> GitHub repository (owner/repo). If omitted, the tool will
|
|
44
|
+
attempt to infer the repository from the current working
|
|
45
|
+
directory's git remotes.
|
|
46
|
+
|
|
47
|
+
Environment Variables:
|
|
48
|
+
ACCESS_TOKEN GitHub access token (preferred)
|
|
49
|
+
GITHUB_TOKEN GitHub access token (fallback)
|
|
50
|
+
|
|
51
|
+
Behavior & Safety:
|
|
52
|
+
- Groups caches by a derived prefix from the cache key and keeps the most
|
|
53
|
+
recently created cache for each group.
|
|
54
|
+
- Deletes only caches older than the latest per prefix to reduce risk of
|
|
55
|
+
removing needed artifacts.
|
|
56
|
+
|
|
57
|
+
Examples:
|
|
58
|
+
# Run against a specific repo (owner/repo)
|
|
59
|
+
clean-github-actions-caches --repo octocat/hello-world
|
|
60
|
+
|
|
61
|
+
# Run via npx without installing
|
|
62
|
+
npx -y binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz clean-github-actions-caches --repo owner/repo
|
|
63
|
+
|
|
64
|
+
# Run via yarn dlx
|
|
65
|
+
yarn dlx binary-collections@https://raw.githubusercontent.com/dimaslanjaka/bin/master/releases/bin.tgz clean-github-actions-caches
|
|
66
|
+
|
|
67
|
+
Notes:
|
|
68
|
+
- Ensure ACCESS_TOKEN or GITHUB_TOKEN is set and has permissions to manage Actions caches.
|
|
69
|
+
- Intended for repository maintainers with appropriate permissions.
|
|
70
|
+
`);
|
|
71
|
+
}
|
|
72
|
+
var argv = minimist(process.argv.slice(2), {
|
|
73
|
+
alias: {
|
|
74
|
+
h: "help",
|
|
75
|
+
r: "repo"
|
|
76
|
+
},
|
|
77
|
+
string: ["repo"],
|
|
78
|
+
boolean: ["help"]
|
|
79
|
+
});
|
|
80
|
+
if (argv.help) {
|
|
81
|
+
printHelp();
|
|
82
|
+
process.exit(0);
|
|
83
|
+
}
|
|
84
|
+
function deleteGitHubActionsCache(GH_REPO, cacheId) {
|
|
85
|
+
return new Promise((resolve, reject) => {
|
|
86
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches/${cacheId}`;
|
|
87
|
+
const token = ACCESS_TOKEN;
|
|
88
|
+
if (!token) {
|
|
89
|
+
return reject(new Error("Access token is not provided"));
|
|
90
|
+
}
|
|
91
|
+
axios.delete(url, {
|
|
92
|
+
headers: {
|
|
93
|
+
Authorization: `token ${token}`,
|
|
94
|
+
Accept: "application/vnd.github.v3+json"
|
|
95
|
+
}
|
|
96
|
+
}).then((response) => {
|
|
97
|
+
console.log(`Cache (${cacheId}) deleted successfully`, response.data);
|
|
98
|
+
resolve(response.data);
|
|
99
|
+
}).catch((error) => {
|
|
100
|
+
var _a;
|
|
101
|
+
console.error("Error deleting cache:", ((_a = error.response) == null ? void 0 : _a.data) || error.message || "Unknown error");
|
|
102
|
+
reject(error);
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
function get_caches(GH_REPO) {
|
|
107
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches`;
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
axios.get(url, {
|
|
110
|
+
headers: {
|
|
111
|
+
Accept: "application/vnd.github.v3+json",
|
|
112
|
+
Authorization: `token ${ACCESS_TOKEN}`
|
|
113
|
+
}
|
|
114
|
+
}).then((response) => {
|
|
115
|
+
const data = response.data.actions_caches;
|
|
116
|
+
const getPrefix = (key) => {
|
|
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
|
+
);
|
|
142
|
+
resolve(grouped);
|
|
143
|
+
}).catch((error) => {
|
|
144
|
+
console.error("Error fetching data:", error);
|
|
145
|
+
reject(error);
|
|
146
|
+
});
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
module.exports = {
|
|
150
|
+
deleteGitHubActionsCache,
|
|
151
|
+
get_caches
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
export {
|
|
157
|
+
require_clean_github_actions_caches
|
|
158
|
+
};
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_findEnvFiles
|
|
4
|
+
} from "./chunk-H44UWUFY.mjs";
|
|
2
5
|
import {
|
|
3
6
|
__commonJS,
|
|
4
7
|
__require,
|
|
5
8
|
init_esm_shims
|
|
6
9
|
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
10
|
|
|
8
|
-
// src/binary-collections
|
|
9
|
-
var
|
|
10
|
-
"src/binary-collections
|
|
11
|
+
// src/binary-collections/config.cjs
|
|
12
|
+
var require_config = __commonJS({
|
|
13
|
+
"src/binary-collections/config.cjs"(exports, module) {
|
|
11
14
|
init_esm_shims();
|
|
12
15
|
var path = __require("path");
|
|
13
|
-
|
|
16
|
+
var { findEnvWithToken } = require_findEnvFiles();
|
|
17
|
+
__require("dotenv").config({ path: findEnvWithToken(), quiet: true, overwrite: true });
|
|
14
18
|
function getTempDir() {
|
|
15
19
|
return process.env.TEMP_DIR || path.join(process.cwd(), "tmp");
|
|
16
20
|
}
|
|
@@ -27,5 +31,5 @@ var require_binary_collections_config = __commonJS({
|
|
|
27
31
|
});
|
|
28
32
|
|
|
29
33
|
export {
|
|
30
|
-
|
|
34
|
+
require_config
|
|
31
35
|
};
|
|
@@ -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,79 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_package
|
|
4
|
+
} from "./chunk-ZOWVMII3.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__commonJS,
|
|
7
|
+
__dirname,
|
|
8
|
+
__require,
|
|
9
|
+
init_esm_shims
|
|
10
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
11
|
+
|
|
12
|
+
// src/binary-collections/findScript.cjs
|
|
13
|
+
var require_findScript = __commonJS({
|
|
14
|
+
"src/binary-collections/findScript.cjs"(exports, module) {
|
|
15
|
+
init_esm_shims();
|
|
16
|
+
var { glob } = __require("glob");
|
|
17
|
+
var path = __require("upath");
|
|
18
|
+
var fs = __require("fs-extra");
|
|
19
|
+
var pkgJson = require_package();
|
|
20
|
+
function findScript(scriptName, searchDir = null) {
|
|
21
|
+
if (!searchDir) searchDir = path.join(__dirname, "..");
|
|
22
|
+
let result;
|
|
23
|
+
const ignorePatterns = [
|
|
24
|
+
`**/*config*.{cjs,js,mjs}`,
|
|
25
|
+
`**/utils.{cjs,js,mjs}`,
|
|
26
|
+
`**/index.{cjs,js,mjs}`,
|
|
27
|
+
`**/chunk-*.{cjs,js,mjs}`,
|
|
28
|
+
`**/*.d.{ts,cts,mts}`
|
|
29
|
+
// ignore TypeScript declaration files
|
|
30
|
+
];
|
|
31
|
+
try {
|
|
32
|
+
const pattern = `${scriptName}.{cjs,js,mjs}`;
|
|
33
|
+
const files = glob.sync(pattern, {
|
|
34
|
+
cwd: searchDir,
|
|
35
|
+
ignore: ignorePatterns,
|
|
36
|
+
absolute: true
|
|
37
|
+
});
|
|
38
|
+
if (files.length > 0) {
|
|
39
|
+
result = files[0];
|
|
40
|
+
} else {
|
|
41
|
+
if (pkgJson.bin[scriptName]) {
|
|
42
|
+
const find = [
|
|
43
|
+
path.join(searchDir, pkgJson.bin[scriptName]),
|
|
44
|
+
path.join(process.cwd(), "node_modules/binary-collections", pkgJson.bin[scriptName]),
|
|
45
|
+
path.join(__dirname, pkgJson.bin[scriptName]),
|
|
46
|
+
path.join(path.join(__dirname, ".."), pkgJson.bin[scriptName]),
|
|
47
|
+
path.join(path.join(__dirname, "../.."), pkgJson.bin[scriptName])
|
|
48
|
+
];
|
|
49
|
+
const filtered = find.filter((file) => fs.existsSync(file));
|
|
50
|
+
if (filtered.length > 0) {
|
|
51
|
+
result = filtered[0];
|
|
52
|
+
} else {
|
|
53
|
+
console.warn(`\u26A0\uFE0F Script "${scriptName}" not found in ${searchDir}.`);
|
|
54
|
+
console.warn(`\u{1F50D} Searched for: ${pattern} in ${searchDir}`);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
} catch (error) {
|
|
59
|
+
console.error(`\u{1F50D} Error searching for script: ${error.message}`);
|
|
60
|
+
}
|
|
61
|
+
if (result && !result.includes("-cli")) {
|
|
62
|
+
const ext = path.extname(result);
|
|
63
|
+
const filename = path.basename(result, ext);
|
|
64
|
+
const cliFile = path.join(path.dirname(result), `${filename}-cli${ext}`);
|
|
65
|
+
if (fs.existsSync(cliFile)) {
|
|
66
|
+
result = cliFile;
|
|
67
|
+
console.log(`\u{1F50D} Found CLI version: ${cliFile}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
module.exports = findScript;
|
|
73
|
+
module.exports.default = findScript;
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
export {
|
|
78
|
+
require_findScript
|
|
79
|
+
};
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,143 @@
|
|
|
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/rm-node-modules.cjs
|
|
9
|
+
var require_rm_node_modules = __commonJS({
|
|
10
|
+
"src/rm-node-modules.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var fs = __require("fs-extra");
|
|
13
|
+
var path = __require("upath");
|
|
14
|
+
var ansiColors = __require("ansi-colors");
|
|
15
|
+
var child_process = __require("child_process");
|
|
16
|
+
var os = __require("os");
|
|
17
|
+
function generateBashScript(options = {}) {
|
|
18
|
+
const { dryRun = true } = options;
|
|
19
|
+
return `
|
|
20
|
+
#!/bin/bash
|
|
21
|
+
|
|
22
|
+
set -u
|
|
23
|
+
|
|
24
|
+
cwd="$(pwd)"
|
|
25
|
+
max_jobs=4
|
|
26
|
+
DRY_RUN=${dryRun ? "true" : "false"}
|
|
27
|
+
|
|
28
|
+
cleanup_letter() {
|
|
29
|
+
local letter="$1"
|
|
30
|
+
|
|
31
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
32
|
+
echo "Would remove: node_modules/\${letter}*"
|
|
33
|
+
echo "Would remove: node_modules/@types/\${letter}*"
|
|
34
|
+
echo "Would remove: node_modules/@\${letter}*"
|
|
35
|
+
else
|
|
36
|
+
rm -rf "\${cwd}/node_modules/\${letter}"*
|
|
37
|
+
echo "Removed: node_modules/\${letter}*"
|
|
38
|
+
|
|
39
|
+
rm -rf "\${cwd}/node_modules/@types/\${letter}"*
|
|
40
|
+
echo "Removed: node_modules/@types/\${letter}*"
|
|
41
|
+
|
|
42
|
+
rm -rf "\${cwd}/node_modules/@\${letter}"*
|
|
43
|
+
echo "Removed: node_modules/@\${letter}*"
|
|
44
|
+
fi
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export -f cleanup_letter
|
|
48
|
+
export cwd
|
|
49
|
+
export DRY_RUN
|
|
50
|
+
|
|
51
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
52
|
+
echo "Dry-run mode (pass --force to actually delete)"
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
echo "Cleaning \${cwd}/node_modules..."
|
|
56
|
+
|
|
57
|
+
running=0
|
|
58
|
+
|
|
59
|
+
for letter in {a..z}; do
|
|
60
|
+
cleanup_letter "$letter" &
|
|
61
|
+
|
|
62
|
+
((running++))
|
|
63
|
+
|
|
64
|
+
# limit concurrent jobs
|
|
65
|
+
if (( running >= max_jobs )); then
|
|
66
|
+
wait -n
|
|
67
|
+
((running--))
|
|
68
|
+
fi
|
|
69
|
+
done
|
|
70
|
+
|
|
71
|
+
wait
|
|
72
|
+
|
|
73
|
+
# final full cleanup (ensure nothing left behind)
|
|
74
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
75
|
+
echo "Would remove: node_modules (final cleanup)"
|
|
76
|
+
else
|
|
77
|
+
rm -rf "\${cwd}/node_modules"
|
|
78
|
+
echo "Removed: node_modules (final cleanup)"
|
|
79
|
+
fi
|
|
80
|
+
|
|
81
|
+
if [ "$DRY_RUN" = "true" ]; then
|
|
82
|
+
echo "Done (dry-run). Run with --force to delete for real."
|
|
83
|
+
else
|
|
84
|
+
echo "Done cleaning node_modules."
|
|
85
|
+
fi
|
|
86
|
+
`.trim();
|
|
87
|
+
}
|
|
88
|
+
async function cleanUp(rootDir, options = {}) {
|
|
89
|
+
const { dryRun = true } = options;
|
|
90
|
+
const nodeModulesDir = path.join(rootDir, "node_modules");
|
|
91
|
+
const script = generateBashScript({ dryRun });
|
|
92
|
+
const tmpDir = os.tmpdir();
|
|
93
|
+
const name = `rm-node-modules-${Date.now()}-${Math.random().toString(36).slice(2)}.sh`;
|
|
94
|
+
const scriptPath = path.join(tmpDir, name);
|
|
95
|
+
try {
|
|
96
|
+
fs.writeFileSync(scriptPath, script, { encoding: "utf8" });
|
|
97
|
+
try {
|
|
98
|
+
fs.chmodSync(scriptPath, 493);
|
|
99
|
+
} catch {
|
|
100
|
+
}
|
|
101
|
+
const result = child_process.spawnSync("bash", [scriptPath], {
|
|
102
|
+
cwd: rootDir,
|
|
103
|
+
env: process.env,
|
|
104
|
+
encoding: "utf8",
|
|
105
|
+
shell: false
|
|
106
|
+
});
|
|
107
|
+
if (result.stdout) process.stdout.write(result.stdout);
|
|
108
|
+
if (result.stderr) process.stderr.write(result.stderr);
|
|
109
|
+
if (result.error) {
|
|
110
|
+
try {
|
|
111
|
+
console.warn(
|
|
112
|
+
ansiColors.yellow(`bash execution failed: ${result.error.message}. Falling back to Node removal.`)
|
|
113
|
+
);
|
|
114
|
+
console.log(`Cleaning ${ansiColors.cyan(nodeModulesDir)}...`);
|
|
115
|
+
fs.rmSync(nodeModulesDir, { recursive: true, force: true });
|
|
116
|
+
console.log(`Removed: ${ansiColors.green("node_modules (final cleanup)")}`);
|
|
117
|
+
console.log("Done cleaning node_modules.");
|
|
118
|
+
return {
|
|
119
|
+
code: 0,
|
|
120
|
+
stdout: result.stdout || "",
|
|
121
|
+
stderr: (result.stderr || "") + `
|
|
122
|
+
${result.error.stack || result.error.message}`
|
|
123
|
+
};
|
|
124
|
+
} catch (e) {
|
|
125
|
+
return { code: 1, stdout: result.stdout || "", stderr: (result.stderr || "") + `
|
|
126
|
+
${e.stack || e.message}` };
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return { code: result.status ?? 0, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
130
|
+
} finally {
|
|
131
|
+
try {
|
|
132
|
+
if (fs.existsSync(scriptPath)) fs.unlinkSync(scriptPath);
|
|
133
|
+
} catch {
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
module.exports = { generateBashScript, cleanUp };
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
export {
|
|
142
|
+
require_rm_node_modules
|
|
143
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
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/copy.mjs
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import path from "upath";
|
|
10
|
+
async function copy(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 destExists = await fs.pathExists(dest);
|
|
18
|
+
const destStat = destExists ? await fs.stat(dest) : null;
|
|
19
|
+
if (destStat && destStat.isDirectory()) {
|
|
20
|
+
finalDest = path.join(dest, path.basename(src));
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
await fs.ensureDir(path.dirname(finalDest));
|
|
24
|
+
await fs.copy(src, finalDest, { overwrite: true });
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
copy
|
|
29
|
+
};
|
|
@@ -0,0 +1,62 @@
|
|
|
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/node-cache-cleaner/npx.ts
|
|
7
|
+
init_esm_shims();
|
|
8
|
+
import fs from "fs-extra";
|
|
9
|
+
import upath from "upath";
|
|
10
|
+
import os from "os";
|
|
11
|
+
import { spawn } from "cross-spawn";
|
|
12
|
+
function getNpmCacheDir() {
|
|
13
|
+
return new Promise((resolve, reject) => {
|
|
14
|
+
var _a, _b;
|
|
15
|
+
const child = spawn("npm", ["config", "get", "cache"], {
|
|
16
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
17
|
+
shell: true
|
|
18
|
+
});
|
|
19
|
+
let output = "";
|
|
20
|
+
let error = "";
|
|
21
|
+
(_a = child.stdout) == null ? void 0 : _a.on("data", (data) => {
|
|
22
|
+
output += data.toString();
|
|
23
|
+
});
|
|
24
|
+
(_b = child.stderr) == null ? void 0 : _b.on("data", (data) => {
|
|
25
|
+
error += data.toString();
|
|
26
|
+
});
|
|
27
|
+
child.on("close", (code) => {
|
|
28
|
+
if (code === 0) {
|
|
29
|
+
resolve(output.trim());
|
|
30
|
+
} else {
|
|
31
|
+
reject(new Error(`Failed to get npm cache directory (code ${code}): ${error}`));
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async function removeDir(target) {
|
|
37
|
+
try {
|
|
38
|
+
const exists = await fs.pathExists(target);
|
|
39
|
+
if (exists) {
|
|
40
|
+
console.log(`Removing: ${target}`);
|
|
41
|
+
await fs.remove(target);
|
|
42
|
+
} else {
|
|
43
|
+
console.log(`Not found: ${target}`);
|
|
44
|
+
}
|
|
45
|
+
} catch (err) {
|
|
46
|
+
console.error(`Failed to remove ${target}:`, err);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function cleanNpxCache() {
|
|
50
|
+
const cacheDir = await getNpmCacheDir();
|
|
51
|
+
console.log("Detected npm cache:", cacheDir);
|
|
52
|
+
console.log("\nCleaning npm/npx cache...\n");
|
|
53
|
+
const npxCache = upath.join(cacheDir, "_npx");
|
|
54
|
+
const npmCache = upath.join(cacheDir, "_cacache");
|
|
55
|
+
const altNpxLinux = upath.join(os.homedir(), ".cache", "npx");
|
|
56
|
+
await Promise.all([removeDir(npxCache), removeDir(npmCache), removeDir(altNpxLinux)]);
|
|
57
|
+
console.log("\nDone \u2714\uFE0F");
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export {
|
|
61
|
+
cleanNpxCache
|
|
62
|
+
};
|