binary-collections 2.0.10 → 2.0.11
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/.puppeterrc.cjs +25 -0
- package/binaries/binary-executor.cjs +138 -3
- package/binaries/clean-nodemodule.cjs +138 -3
- package/binaries/clean-nodemodules.cjs +138 -3
- package/binaries/dev.cjs +138 -3
- package/binaries/empty.cjs +138 -3
- package/binaries/git-reduce-size.cjs +138 -3
- package/binaries/javakill.cjs +138 -3
- package/binaries/kill-night-crows.bat +7 -0
- package/binaries/kill-night-crows.ps1 +172 -0
- package/binaries/kill-process.cjs +138 -3
- package/binaries/nodekill.cjs +138 -3
- package/binaries/prod.cjs +138 -3
- package/binaries/py +111 -0
- package/binaries/py.cjs +178 -0
- package/binaries/py.cmd +49 -0
- package/binaries/rmfind.cjs +138 -3
- package/binaries/rmx.cjs +138 -3
- package/binaries/submodule-token.cjs +138 -3
- package/binaries/test-cjs +10 -0
- package/binaries/test-cjs.cjs +178 -0
- package/binaries/test-cjs.cmd +11 -0
- package/binaries/yarn-clean +32 -0
- package/binaries/yarn-clean.cjs +178 -0
- package/binaries/yarn-clean.cmd +30 -0
- package/binaries/yarn-clean.py +148 -0
- package/lib/binary-collections-config.cjs +1 -1
- package/lib/binary-collections-config.mjs +1 -1
- package/lib/binary-collections.cjs +167 -106
- package/lib/binary-collections.mjs +108 -94
- package/lib/changelog.cjs +61 -13
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-AI4CVPJ7.mjs → chunk-2CBJCW7E.mjs} +4 -4
- package/lib/chunk-34IQDTLZ.mjs +27 -0
- package/lib/chunk-3HFFECCI.mjs +27 -0
- package/lib/{chunk-SBNDSKG5.mjs → chunk-4UHL4WVN.mjs} +1 -1
- package/lib/chunk-7XTEJHOE.mjs +193 -0
- package/lib/chunk-AJDD5DZM.mjs +109 -0
- package/lib/chunk-BZWVHODJ.mjs +62 -0
- package/lib/{chunk-BEZKJ25G.mjs → chunk-FCDQGYBF.mjs} +5 -9
- package/lib/chunk-GEYA2USY.mjs +207 -0
- package/lib/chunk-ID2WBTE2.mjs +80 -0
- package/lib/chunk-JXFOHKDM.mjs +239 -0
- package/lib/{chunk-DI5MDPSN.mjs → chunk-N436BNBK.mjs} +192 -64
- package/lib/chunk-NCXAP7AA.mjs +31 -0
- package/lib/chunk-PDN26I7O.mjs +188 -0
- package/lib/{chunk-E6FDDAOO.mjs → chunk-RWLXRTYP.mjs} +1 -1
- package/lib/{chunk-BDCHCWHD.mjs → chunk-TOIVAQF7.mjs} +4 -4
- package/lib/chunk-V5SKYJUB.mjs +136 -0
- package/lib/{chunk-HMRMTYZM.mjs → chunk-WSRETQCA.mjs} +21 -2
- package/lib/chunk-XA3SNBPA.mjs +184 -0
- package/lib/chunk-YYLIQQKF.mjs +31 -0
- package/lib/{chunk-V3N3JEUF.mjs → chunk-Z6JLYU2J.mjs} +60 -13
- package/lib/{chunk-O6SWBEOQ.mjs → chunk-ZDMWBSYF.mjs} +2 -2
- package/lib/clean-github-actions-caches.cjs +63 -15
- package/lib/clean-github-actions-caches.mjs +3 -3
- package/lib/del-gradle.cjs +61 -13
- package/lib/del-gradle.js +1 -0
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +143 -148
- package/lib/del-node-modules.js +210 -14
- package/lib/del-node-modules.mjs +148 -17
- package/lib/del-ps.cjs +61 -13
- package/lib/del-ps.js +1 -0
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +61 -13
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/find-node-modules-cli.js +1 -0
- package/lib/free-chatgpt.cjs +253 -47
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/gitattributes.cjs +1 -0
- package/lib/git/gitattributes.d.cts +7 -2
- package/lib/git/gitattributes.mjs +1 -1
- package/lib/git/line-endings.cjs +2 -1
- package/lib/git/line-endings.mjs +2 -2
- package/lib/git/undo-commit-cli.cjs +110 -0
- package/lib/git/undo-commit-cli.d.ts +1 -0
- package/lib/git/undo-commit-cli.js +4 -0
- package/lib/git/undo-commit-cli.mjs +14 -0
- package/lib/git/undo-commit.cjs +81 -0
- package/lib/git/undo-commit.d.cts +1 -0
- package/lib/git/undo-commit.mjs +7 -0
- package/lib/git/undo-staged-cli.cjs +110 -0
- package/lib/git/undo-staged-cli.d.ts +1 -0
- package/lib/git/undo-staged-cli.js +4 -0
- package/lib/git/undo-staged-cli.mjs +14 -0
- package/lib/git/undo-staged.cjs +81 -0
- package/lib/git/undo-staged.d.cts +1 -0
- package/lib/git/undo-staged.mjs +7 -0
- package/lib/git/user-config.cjs +61 -14
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +255 -49
- package/lib/git-diff-cli.d.ts +1 -0
- package/lib/git-diff-cli.js +1 -0
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +254 -49
- package/lib/git-diff.mjs +4 -4
- package/lib/git-fix.cjs +64 -16
- package/lib/git-fix.mjs +10 -10
- package/lib/git-purge.cjs +61 -13
- package/lib/git-purge.mjs +1 -1
- package/lib/kill-night-crows.cjs +87 -0
- package/lib/kill-night-crows.d.mts +1 -0
- package/lib/kill-night-crows.mjs +65 -0
- package/lib/npm-run-series.cjs +60 -13
- package/lib/npm-run-series.mjs +1 -1
- package/lib/package-resolutions-updater-cli.cjs +560 -0
- package/lib/package-resolutions-updater-cli.d.mts +1 -0
- package/lib/package-resolutions-updater-cli.mjs +124 -0
- package/lib/package-resolutions-updater.cjs +174 -154
- package/lib/package-resolutions-updater.d.mts +32 -1
- package/lib/package-resolutions-updater.mjs +16 -294
- package/lib/php-cs-fixer-staged.cjs +105 -0
- package/lib/php-cs-fixer-staged.d.cts +2 -0
- package/lib/php-cs-fixer-staged.mjs +117 -0
- package/lib/print-directory-tree.cjs +62 -14
- package/lib/print-directory-tree.mjs +2 -2
- package/lib/ps/connected-domain.d.ts +1 -1
- package/lib/ps/index.js +1 -0
- package/lib/remove-module.cjs +61 -13
- package/lib/remove-module.mjs +1 -1
- package/lib/rmpath.cjs +63 -15
- package/lib/rmpath.mjs +2 -2
- package/lib/submodule-install.cjs +62 -15
- package/lib/submodule-install.mjs +3 -3
- package/lib/submodule-remove-cli.cjs +5 -1
- package/lib/submodule-remove-cli.mjs +1 -1
- package/lib/submodule-remove.cjs +4 -1
- package/lib/submodule-remove.mjs +1 -1
- package/lib/utils/chatgpt.cjs +192 -34
- package/lib/utils/chatgpt.js +210 -43
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +107 -0
- package/lib/utils/findEnvFiles.d.ts +8 -0
- package/lib/utils/findEnvFiles.js +121 -0
- package/lib/utils/findEnvFiles.mjs +8 -0
- package/lib/utils/findWorkspaceRoot.cjs +70 -0
- package/lib/utils/findWorkspaceRoot.d.ts +9 -0
- package/lib/utils/findWorkspaceRoot.js +57 -0
- package/lib/utils/findWorkspaceRoot.mjs +40 -0
- package/lib/utils/index.cjs +60 -13
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.cjs +64 -0
- package/lib/utils/isGithubTokenValid.d.ts +7 -0
- package/lib/utils/isGithubTokenValid.js +48 -0
- package/lib/utils/isGithubTokenValid.mjs +36 -0
- package/lib/yarn-reinstall.cjs +61 -13
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +107 -93
- package/readme.md +33 -34
- package/releases/readme.md +1 -1
- package/requirements.txt +1 -0
- package/lib/chunk-4EWQC6GZ.mjs +0 -382
- package/lib/chunk-4ZI7BQKQ.mjs +0 -381
- package/lib/chunk-5J2BEPY5.mjs +0 -83
- package/lib/chunk-AGZYRDC2.mjs +0 -323
- package/lib/chunk-HN52G2YL.mjs +0 -305
- package/lib/chunk-HO6GHCOB.mjs +0 -385
- package/lib/chunk-LEM5OMRP.mjs +0 -384
- package/lib/chunk-RCP7DHVY.mjs +0 -190
- package/lib/chunk-U6SO4QEV.mjs +0 -320
- package/lib/chunk-XD6BJK6Q.mjs +0 -351
- package/lib/chunk-YXSFGA2D.mjs +0 -383
- package/lib/git/gitattributes.d.ts +0 -33
- package/lib/git/gitattributes.js +0 -223
|
@@ -1,43 +1,178 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Node.js modules:
|
|
5
|
+
*
|
|
6
|
+
* - child_process:
|
|
7
|
+
* Used to launch external scripts/programs.
|
|
8
|
+
*
|
|
9
|
+
* - path:
|
|
10
|
+
* Safely handles file paths across operating systems.
|
|
11
|
+
*
|
|
12
|
+
* - fs:
|
|
13
|
+
* Used to check whether files exist.
|
|
14
|
+
*/
|
|
2
15
|
const { spawnSync } = require("child_process");
|
|
3
16
|
const path = require("path");
|
|
4
17
|
const fs = require("fs");
|
|
5
18
|
|
|
19
|
+
/**
|
|
20
|
+
* __dirname
|
|
21
|
+
* Absolute directory path of this launcher script.
|
|
22
|
+
*
|
|
23
|
+
* __filename
|
|
24
|
+
* Absolute path of this launcher file itself.
|
|
25
|
+
*
|
|
26
|
+
* base
|
|
27
|
+
* Filename without extension.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* File = "/tools/mytool.js"
|
|
31
|
+
*
|
|
32
|
+
* binDir = "/tools"
|
|
33
|
+
* base = "mytool"
|
|
34
|
+
*/
|
|
6
35
|
const binDir = __dirname;
|
|
7
36
|
const base = path.basename(__filename, path.extname(__filename));
|
|
8
37
|
|
|
9
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Determine which script extensions to search for
|
|
40
|
+
* based on the current operating system.
|
|
41
|
+
*
|
|
42
|
+
* Windows:
|
|
43
|
+
* .cmd
|
|
44
|
+
* .bat
|
|
45
|
+
* .ps1
|
|
46
|
+
* .vbs
|
|
47
|
+
*
|
|
48
|
+
* Linux/macOS:
|
|
49
|
+
* .sh
|
|
50
|
+
* executable file without extension
|
|
51
|
+
*/
|
|
10
52
|
const candidates = process.platform === "win32" ? [".cmd", ".bat", ".ps1", ".vbs"] : [".sh", ""];
|
|
11
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Search for the first matching script
|
|
56
|
+
* in the same directory as this launcher.
|
|
57
|
+
*
|
|
58
|
+
* Example:
|
|
59
|
+
* If base = "mytool"
|
|
60
|
+
*
|
|
61
|
+
* Windows checks:
|
|
62
|
+
* mytool.cmd
|
|
63
|
+
* mytool.bat
|
|
64
|
+
* mytool.ps1
|
|
65
|
+
* mytool.vbs
|
|
66
|
+
*
|
|
67
|
+
* Linux/macOS checks:
|
|
68
|
+
* mytool.sh
|
|
69
|
+
* mytool
|
|
70
|
+
*/
|
|
12
71
|
let found = null;
|
|
72
|
+
|
|
13
73
|
for (const ext of candidates) {
|
|
14
74
|
const script = path.join(binDir, base + ext);
|
|
75
|
+
|
|
15
76
|
if (fs.existsSync(script)) {
|
|
16
77
|
found = script;
|
|
17
78
|
break;
|
|
18
79
|
}
|
|
19
80
|
}
|
|
20
81
|
|
|
82
|
+
/**
|
|
83
|
+
* If no matching script was found,
|
|
84
|
+
* print an error and exit with failure code 1.
|
|
85
|
+
*/
|
|
21
86
|
if (!found) {
|
|
22
87
|
console.error(`No script found for ${base} in ${binDir}`);
|
|
23
88
|
process.exit(1);
|
|
24
89
|
}
|
|
25
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Detect special script types
|
|
93
|
+
* that require a shell/interpreter.
|
|
94
|
+
*/
|
|
26
95
|
const isPs1 = found.endsWith(".ps1");
|
|
27
96
|
const isCmd = found.endsWith(".cmd");
|
|
28
|
-
// const isSh = found.endsWith(".sh") || (found === found && process.platform !== "win32");
|
|
29
97
|
|
|
98
|
+
/**
|
|
99
|
+
* cmd
|
|
100
|
+
* The executable program to launch.
|
|
101
|
+
*
|
|
102
|
+
* args
|
|
103
|
+
* Arguments passed to the executable.
|
|
104
|
+
*/
|
|
30
105
|
let cmd, args;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* PowerShell scripts:
|
|
109
|
+
*
|
|
110
|
+
* Run through powershell.exe because .ps1 files
|
|
111
|
+
* are not directly executable like binaries.
|
|
112
|
+
*
|
|
113
|
+
* Flags:
|
|
114
|
+
* -NoProfile
|
|
115
|
+
* Prevent loading user profile scripts.
|
|
116
|
+
*
|
|
117
|
+
* -ExecutionPolicy Bypass
|
|
118
|
+
* Allow script execution even if policy blocks it.
|
|
119
|
+
*
|
|
120
|
+
* -File
|
|
121
|
+
* Specifies the script to execute.
|
|
122
|
+
*
|
|
123
|
+
* process.argv.slice(2)
|
|
124
|
+
* Forward all user-provided command-line arguments.
|
|
125
|
+
*/
|
|
31
126
|
if (isPs1) {
|
|
32
127
|
cmd = "powershell.exe";
|
|
128
|
+
|
|
33
129
|
args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", found, ...process.argv.slice(2)];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* CMD batch files:
|
|
133
|
+
*
|
|
134
|
+
* Run through cmd.exe using:
|
|
135
|
+
* /c
|
|
136
|
+
* which means:
|
|
137
|
+
* "execute command and terminate"
|
|
138
|
+
*/
|
|
34
139
|
} else if (isCmd) {
|
|
35
140
|
cmd = "cmd.exe";
|
|
141
|
+
|
|
36
142
|
args = ["/c", found, ...process.argv.slice(2)];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Other scripts:
|
|
146
|
+
*
|
|
147
|
+
* Usually:
|
|
148
|
+
* - shell scripts (.sh)
|
|
149
|
+
* - executable binaries
|
|
150
|
+
*
|
|
151
|
+
* These can be executed directly.
|
|
152
|
+
*/
|
|
37
153
|
} else {
|
|
38
154
|
cmd = found;
|
|
39
155
|
args = process.argv.slice(2);
|
|
40
156
|
}
|
|
41
157
|
|
|
42
|
-
|
|
158
|
+
/**
|
|
159
|
+
* Execute the selected script synchronously.
|
|
160
|
+
*
|
|
161
|
+
* stdio: "inherit"
|
|
162
|
+
* Shares the current terminal with the child process,
|
|
163
|
+
* so stdout/stderr/input behave normally.
|
|
164
|
+
*
|
|
165
|
+
* spawnSync waits until the child process exits.
|
|
166
|
+
*/
|
|
167
|
+
const result = spawnSync(cmd, args, {
|
|
168
|
+
stdio: "inherit"
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Exit using the same exit code
|
|
173
|
+
* returned by the child process.
|
|
174
|
+
*
|
|
175
|
+
* If result.status is null/undefined,
|
|
176
|
+
* default to exit code 1.
|
|
177
|
+
*/
|
|
43
178
|
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Node.js modules:
|
|
5
|
+
*
|
|
6
|
+
* - child_process:
|
|
7
|
+
* Used to launch external scripts/programs.
|
|
8
|
+
*
|
|
9
|
+
* - path:
|
|
10
|
+
* Safely handles file paths across operating systems.
|
|
11
|
+
*
|
|
12
|
+
* - fs:
|
|
13
|
+
* Used to check whether files exist.
|
|
14
|
+
*/
|
|
15
|
+
const { spawnSync } = require("child_process");
|
|
16
|
+
const path = require("path");
|
|
17
|
+
const fs = require("fs");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* __dirname
|
|
21
|
+
* Absolute directory path of this launcher script.
|
|
22
|
+
*
|
|
23
|
+
* __filename
|
|
24
|
+
* Absolute path of this launcher file itself.
|
|
25
|
+
*
|
|
26
|
+
* base
|
|
27
|
+
* Filename without extension.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* File = "/tools/mytool.js"
|
|
31
|
+
*
|
|
32
|
+
* binDir = "/tools"
|
|
33
|
+
* base = "mytool"
|
|
34
|
+
*/
|
|
35
|
+
const binDir = __dirname;
|
|
36
|
+
const base = path.basename(__filename, path.extname(__filename));
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determine which script extensions to search for
|
|
40
|
+
* based on the current operating system.
|
|
41
|
+
*
|
|
42
|
+
* Windows:
|
|
43
|
+
* .cmd
|
|
44
|
+
* .bat
|
|
45
|
+
* .ps1
|
|
46
|
+
* .vbs
|
|
47
|
+
*
|
|
48
|
+
* Linux/macOS:
|
|
49
|
+
* .sh
|
|
50
|
+
* executable file without extension
|
|
51
|
+
*/
|
|
52
|
+
const candidates = process.platform === "win32" ? [".cmd", ".bat", ".ps1", ".vbs"] : [".sh", ""];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Search for the first matching script
|
|
56
|
+
* in the same directory as this launcher.
|
|
57
|
+
*
|
|
58
|
+
* Example:
|
|
59
|
+
* If base = "mytool"
|
|
60
|
+
*
|
|
61
|
+
* Windows checks:
|
|
62
|
+
* mytool.cmd
|
|
63
|
+
* mytool.bat
|
|
64
|
+
* mytool.ps1
|
|
65
|
+
* mytool.vbs
|
|
66
|
+
*
|
|
67
|
+
* Linux/macOS checks:
|
|
68
|
+
* mytool.sh
|
|
69
|
+
* mytool
|
|
70
|
+
*/
|
|
71
|
+
let found = null;
|
|
72
|
+
|
|
73
|
+
for (const ext of candidates) {
|
|
74
|
+
const script = path.join(binDir, base + ext);
|
|
75
|
+
|
|
76
|
+
if (fs.existsSync(script)) {
|
|
77
|
+
found = script;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* If no matching script was found,
|
|
84
|
+
* print an error and exit with failure code 1.
|
|
85
|
+
*/
|
|
86
|
+
if (!found) {
|
|
87
|
+
console.error(`No script found for ${base} in ${binDir}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Detect special script types
|
|
93
|
+
* that require a shell/interpreter.
|
|
94
|
+
*/
|
|
95
|
+
const isPs1 = found.endsWith(".ps1");
|
|
96
|
+
const isCmd = found.endsWith(".cmd");
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* cmd
|
|
100
|
+
* The executable program to launch.
|
|
101
|
+
*
|
|
102
|
+
* args
|
|
103
|
+
* Arguments passed to the executable.
|
|
104
|
+
*/
|
|
105
|
+
let cmd, args;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* PowerShell scripts:
|
|
109
|
+
*
|
|
110
|
+
* Run through powershell.exe because .ps1 files
|
|
111
|
+
* are not directly executable like binaries.
|
|
112
|
+
*
|
|
113
|
+
* Flags:
|
|
114
|
+
* -NoProfile
|
|
115
|
+
* Prevent loading user profile scripts.
|
|
116
|
+
*
|
|
117
|
+
* -ExecutionPolicy Bypass
|
|
118
|
+
* Allow script execution even if policy blocks it.
|
|
119
|
+
*
|
|
120
|
+
* -File
|
|
121
|
+
* Specifies the script to execute.
|
|
122
|
+
*
|
|
123
|
+
* process.argv.slice(2)
|
|
124
|
+
* Forward all user-provided command-line arguments.
|
|
125
|
+
*/
|
|
126
|
+
if (isPs1) {
|
|
127
|
+
cmd = "powershell.exe";
|
|
128
|
+
|
|
129
|
+
args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", found, ...process.argv.slice(2)];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* CMD batch files:
|
|
133
|
+
*
|
|
134
|
+
* Run through cmd.exe using:
|
|
135
|
+
* /c
|
|
136
|
+
* which means:
|
|
137
|
+
* "execute command and terminate"
|
|
138
|
+
*/
|
|
139
|
+
} else if (isCmd) {
|
|
140
|
+
cmd = "cmd.exe";
|
|
141
|
+
|
|
142
|
+
args = ["/c", found, ...process.argv.slice(2)];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Other scripts:
|
|
146
|
+
*
|
|
147
|
+
* Usually:
|
|
148
|
+
* - shell scripts (.sh)
|
|
149
|
+
* - executable binaries
|
|
150
|
+
*
|
|
151
|
+
* These can be executed directly.
|
|
152
|
+
*/
|
|
153
|
+
} else {
|
|
154
|
+
cmd = found;
|
|
155
|
+
args = process.argv.slice(2);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Execute the selected script synchronously.
|
|
160
|
+
*
|
|
161
|
+
* stdio: "inherit"
|
|
162
|
+
* Shares the current terminal with the child process,
|
|
163
|
+
* so stdout/stderr/input behave normally.
|
|
164
|
+
*
|
|
165
|
+
* spawnSync waits until the child process exits.
|
|
166
|
+
*/
|
|
167
|
+
const result = spawnSync(cmd, args, {
|
|
168
|
+
stdio: "inherit"
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Exit using the same exit code
|
|
173
|
+
* returned by the child process.
|
|
174
|
+
*
|
|
175
|
+
* If result.status is null/undefined,
|
|
176
|
+
* default to exit code 1.
|
|
177
|
+
*/
|
|
178
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
|
|
3
|
+
:: Run the specific Jest test file while ignoring .mjs files.
|
|
4
|
+
:: Use caret (^) for line continuation in Windows CMD.
|
|
5
|
+
npx jest ^
|
|
6
|
+
--runInBand ^
|
|
7
|
+
--forceExit ^
|
|
8
|
+
--testTimeout=120000 ^
|
|
9
|
+
--testPathIgnorePatterns="\\.mjs$" ^
|
|
10
|
+
--detectOpenHandles ^
|
|
11
|
+
%*
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
|
|
3
|
+
set -euo pipefail
|
|
4
|
+
|
|
5
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
+
|
|
7
|
+
CURRENT_FILE_PATH="$(realpath "$0")"
|
|
8
|
+
echo "Current file path: $CURRENT_FILE_PATH"
|
|
9
|
+
|
|
10
|
+
CANDIDATES=(
|
|
11
|
+
"$SCRIPT_DIR/../bin/yarn-clean.py"
|
|
12
|
+
"$SCRIPT_DIR/../binaries/yarn-clean.py"
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
TARGET=""
|
|
16
|
+
|
|
17
|
+
for f in "${CANDIDATES[@]}"; do
|
|
18
|
+
if [[ -f "$f" ]]; then
|
|
19
|
+
TARGET="$f"
|
|
20
|
+
break
|
|
21
|
+
fi
|
|
22
|
+
done
|
|
23
|
+
|
|
24
|
+
if [[ -z "$TARGET" ]]; then
|
|
25
|
+
echo "Error: yarn-clean.py not found in expected locations:" >&2
|
|
26
|
+
printf ' - %s\n' "${CANDIDATES[@]}" >&2
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
echo "Using script: $TARGET"
|
|
31
|
+
|
|
32
|
+
python "$TARGET" "$@"
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Built-in Node.js modules:
|
|
5
|
+
*
|
|
6
|
+
* - child_process:
|
|
7
|
+
* Used to launch external scripts/programs.
|
|
8
|
+
*
|
|
9
|
+
* - path:
|
|
10
|
+
* Safely handles file paths across operating systems.
|
|
11
|
+
*
|
|
12
|
+
* - fs:
|
|
13
|
+
* Used to check whether files exist.
|
|
14
|
+
*/
|
|
15
|
+
const { spawnSync } = require("child_process");
|
|
16
|
+
const path = require("path");
|
|
17
|
+
const fs = require("fs");
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* __dirname
|
|
21
|
+
* Absolute directory path of this launcher script.
|
|
22
|
+
*
|
|
23
|
+
* __filename
|
|
24
|
+
* Absolute path of this launcher file itself.
|
|
25
|
+
*
|
|
26
|
+
* base
|
|
27
|
+
* Filename without extension.
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* File = "/tools/mytool.js"
|
|
31
|
+
*
|
|
32
|
+
* binDir = "/tools"
|
|
33
|
+
* base = "mytool"
|
|
34
|
+
*/
|
|
35
|
+
const binDir = __dirname;
|
|
36
|
+
const base = path.basename(__filename, path.extname(__filename));
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Determine which script extensions to search for
|
|
40
|
+
* based on the current operating system.
|
|
41
|
+
*
|
|
42
|
+
* Windows:
|
|
43
|
+
* .cmd
|
|
44
|
+
* .bat
|
|
45
|
+
* .ps1
|
|
46
|
+
* .vbs
|
|
47
|
+
*
|
|
48
|
+
* Linux/macOS:
|
|
49
|
+
* .sh
|
|
50
|
+
* executable file without extension
|
|
51
|
+
*/
|
|
52
|
+
const candidates = process.platform === "win32" ? [".cmd", ".bat", ".ps1", ".vbs"] : [".sh", ""];
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Search for the first matching script
|
|
56
|
+
* in the same directory as this launcher.
|
|
57
|
+
*
|
|
58
|
+
* Example:
|
|
59
|
+
* If base = "mytool"
|
|
60
|
+
*
|
|
61
|
+
* Windows checks:
|
|
62
|
+
* mytool.cmd
|
|
63
|
+
* mytool.bat
|
|
64
|
+
* mytool.ps1
|
|
65
|
+
* mytool.vbs
|
|
66
|
+
*
|
|
67
|
+
* Linux/macOS checks:
|
|
68
|
+
* mytool.sh
|
|
69
|
+
* mytool
|
|
70
|
+
*/
|
|
71
|
+
let found = null;
|
|
72
|
+
|
|
73
|
+
for (const ext of candidates) {
|
|
74
|
+
const script = path.join(binDir, base + ext);
|
|
75
|
+
|
|
76
|
+
if (fs.existsSync(script)) {
|
|
77
|
+
found = script;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* If no matching script was found,
|
|
84
|
+
* print an error and exit with failure code 1.
|
|
85
|
+
*/
|
|
86
|
+
if (!found) {
|
|
87
|
+
console.error(`No script found for ${base} in ${binDir}`);
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Detect special script types
|
|
93
|
+
* that require a shell/interpreter.
|
|
94
|
+
*/
|
|
95
|
+
const isPs1 = found.endsWith(".ps1");
|
|
96
|
+
const isCmd = found.endsWith(".cmd");
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* cmd
|
|
100
|
+
* The executable program to launch.
|
|
101
|
+
*
|
|
102
|
+
* args
|
|
103
|
+
* Arguments passed to the executable.
|
|
104
|
+
*/
|
|
105
|
+
let cmd, args;
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* PowerShell scripts:
|
|
109
|
+
*
|
|
110
|
+
* Run through powershell.exe because .ps1 files
|
|
111
|
+
* are not directly executable like binaries.
|
|
112
|
+
*
|
|
113
|
+
* Flags:
|
|
114
|
+
* -NoProfile
|
|
115
|
+
* Prevent loading user profile scripts.
|
|
116
|
+
*
|
|
117
|
+
* -ExecutionPolicy Bypass
|
|
118
|
+
* Allow script execution even if policy blocks it.
|
|
119
|
+
*
|
|
120
|
+
* -File
|
|
121
|
+
* Specifies the script to execute.
|
|
122
|
+
*
|
|
123
|
+
* process.argv.slice(2)
|
|
124
|
+
* Forward all user-provided command-line arguments.
|
|
125
|
+
*/
|
|
126
|
+
if (isPs1) {
|
|
127
|
+
cmd = "powershell.exe";
|
|
128
|
+
|
|
129
|
+
args = ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", found, ...process.argv.slice(2)];
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* CMD batch files:
|
|
133
|
+
*
|
|
134
|
+
* Run through cmd.exe using:
|
|
135
|
+
* /c
|
|
136
|
+
* which means:
|
|
137
|
+
* "execute command and terminate"
|
|
138
|
+
*/
|
|
139
|
+
} else if (isCmd) {
|
|
140
|
+
cmd = "cmd.exe";
|
|
141
|
+
|
|
142
|
+
args = ["/c", found, ...process.argv.slice(2)];
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Other scripts:
|
|
146
|
+
*
|
|
147
|
+
* Usually:
|
|
148
|
+
* - shell scripts (.sh)
|
|
149
|
+
* - executable binaries
|
|
150
|
+
*
|
|
151
|
+
* These can be executed directly.
|
|
152
|
+
*/
|
|
153
|
+
} else {
|
|
154
|
+
cmd = found;
|
|
155
|
+
args = process.argv.slice(2);
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Execute the selected script synchronously.
|
|
160
|
+
*
|
|
161
|
+
* stdio: "inherit"
|
|
162
|
+
* Shares the current terminal with the child process,
|
|
163
|
+
* so stdout/stderr/input behave normally.
|
|
164
|
+
*
|
|
165
|
+
* spawnSync waits until the child process exits.
|
|
166
|
+
*/
|
|
167
|
+
const result = spawnSync(cmd, args, {
|
|
168
|
+
stdio: "inherit"
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* Exit using the same exit code
|
|
173
|
+
* returned by the child process.
|
|
174
|
+
*
|
|
175
|
+
* If result.status is null/undefined,
|
|
176
|
+
* default to exit code 1.
|
|
177
|
+
*/
|
|
178
|
+
process.exit(result.status ?? 1);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal enabledelayedexpansion
|
|
3
|
+
|
|
4
|
+
REM Get directory of this .bat file
|
|
5
|
+
set "SCRIPT_DIR=%~dp0"
|
|
6
|
+
|
|
7
|
+
echo Current file path: %~f0
|
|
8
|
+
|
|
9
|
+
set "TARGET="
|
|
10
|
+
|
|
11
|
+
set "CANDIDATE1=%SCRIPT_DIR%..\bin\yarn-clean.py"
|
|
12
|
+
set "CANDIDATE2=%SCRIPT_DIR%..\binaries\yarn-clean.py"
|
|
13
|
+
|
|
14
|
+
if exist "%CANDIDATE1%" (
|
|
15
|
+
set "TARGET=%CANDIDATE1%"
|
|
16
|
+
) else if exist "%CANDIDATE2%" (
|
|
17
|
+
set "TARGET=%CANDIDATE2%"
|
|
18
|
+
)
|
|
19
|
+
|
|
20
|
+
if "%TARGET%"=="" (
|
|
21
|
+
echo Error: yarn-clean.py not found in expected locations:
|
|
22
|
+
echo - %CANDIDATE1%
|
|
23
|
+
echo - %CANDIDATE2%
|
|
24
|
+
exit /b 1
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
echo Using script: %TARGET%
|
|
28
|
+
|
|
29
|
+
REM Run Python script with all arguments
|
|
30
|
+
python "%TARGET%" %*
|