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
package/binaries/py
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# --------------------------------------------------
|
|
5
|
+
# Detect OS and normalize platform
|
|
6
|
+
# --------------------------------------------------
|
|
7
|
+
UNAME="$(uname -s 2>/dev/null || echo unknown)"
|
|
8
|
+
|
|
9
|
+
case "$UNAME" in
|
|
10
|
+
Linux*) PLATFORM="linux" ;;
|
|
11
|
+
Darwin*) PLATFORM="macos" ;;
|
|
12
|
+
CYGWIN*|MINGW*|MSYS*) PLATFORM="windows" ;;
|
|
13
|
+
*)
|
|
14
|
+
echo "Unsupported OS: $UNAME"
|
|
15
|
+
exit 1
|
|
16
|
+
;;
|
|
17
|
+
esac
|
|
18
|
+
|
|
19
|
+
# --------------------------------------------------
|
|
20
|
+
# Resolve paths
|
|
21
|
+
# --------------------------------------------------
|
|
22
|
+
SCRIPT_DIR="$(dirname "$(realpath "$0")")"
|
|
23
|
+
CWD="$(dirname "$SCRIPT_DIR")"
|
|
24
|
+
|
|
25
|
+
if [ ! -d "$CWD" ]; then
|
|
26
|
+
echo "Directory $CWD does not exist."
|
|
27
|
+
exit 1
|
|
28
|
+
fi
|
|
29
|
+
|
|
30
|
+
# Prefer venv over .venv
|
|
31
|
+
if [ -d "$CWD/venv" ] || [ ! -d "$CWD/.venv" ]; then
|
|
32
|
+
VENV_PATH="$CWD/venv"
|
|
33
|
+
else
|
|
34
|
+
VENV_PATH="$CWD/.venv"
|
|
35
|
+
fi
|
|
36
|
+
|
|
37
|
+
USER="www-data"
|
|
38
|
+
|
|
39
|
+
# --------------------------------------------------
|
|
40
|
+
# Helpers
|
|
41
|
+
# --------------------------------------------------
|
|
42
|
+
ensure_python3_shim_unix() {
|
|
43
|
+
if [ -f "$VENV_PATH/bin/python" ] && [ ! -f "$VENV_PATH/bin/python3" ]; then
|
|
44
|
+
echo "Creating python3 symlink..."
|
|
45
|
+
ln -s python "$VENV_PATH/bin/python3"
|
|
46
|
+
fi
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
ensure_python3_shim_windows() {
|
|
50
|
+
if [ -f "$VENV_PATH/Scripts/python.exe" ] && [ ! -f "$VENV_PATH/Scripts/python3.exe" ]; then
|
|
51
|
+
echo "Creating python3.exe shim..."
|
|
52
|
+
cp "$VENV_PATH/Scripts/python.exe" "$VENV_PATH/Scripts/python3.exe"
|
|
53
|
+
fi
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
resolve_python_bin_unix() {
|
|
57
|
+
if [ -x "$VENV_PATH/bin/python3" ]; then
|
|
58
|
+
echo "$VENV_PATH/bin/python3"
|
|
59
|
+
else
|
|
60
|
+
echo "$VENV_PATH/bin/python"
|
|
61
|
+
fi
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
resolve_python_bin_windows() {
|
|
65
|
+
if [ -x "$VENV_PATH/Scripts/python3.exe" ]; then
|
|
66
|
+
echo "$VENV_PATH/Scripts/python3.exe"
|
|
67
|
+
else
|
|
68
|
+
echo "$VENV_PATH/Scripts/python.exe"
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# --------------------------------------------------
|
|
73
|
+
# Platform logic
|
|
74
|
+
# --------------------------------------------------
|
|
75
|
+
case "$PLATFORM" in
|
|
76
|
+
linux|macos)
|
|
77
|
+
if [ ! -d "$VENV_PATH" ] || [ ! -f "$VENV_PATH/bin/activate" ]; then
|
|
78
|
+
echo "Creating virtual environment..."
|
|
79
|
+
python3 -m venv "$VENV_PATH"
|
|
80
|
+
echo "Virtual environment created."
|
|
81
|
+
fi
|
|
82
|
+
|
|
83
|
+
ensure_python3_shim_unix
|
|
84
|
+
|
|
85
|
+
PYTHON_BIN="$(resolve_python_bin_unix)"
|
|
86
|
+
|
|
87
|
+
# Optional permissions fix (Linux + nginx only)
|
|
88
|
+
if [ "$PLATFORM" = "linux" ] && command -v nginx >/dev/null; then
|
|
89
|
+
if command -v sudo >/dev/null; then
|
|
90
|
+
sudo -n chown -R "$USER:$USER" "$VENV_PATH" >/dev/null 2>&1 || true
|
|
91
|
+
sudo -n chmod 755 "$VENV_PATH/bin"/* >/dev/null 2>&1 || true
|
|
92
|
+
fi
|
|
93
|
+
fi
|
|
94
|
+
|
|
95
|
+
"$PYTHON_BIN" "$@"
|
|
96
|
+
;;
|
|
97
|
+
|
|
98
|
+
windows)
|
|
99
|
+
if [ ! -d "$VENV_PATH" ] || [ ! -f "$VENV_PATH/Scripts/activate" ]; then
|
|
100
|
+
echo "Creating virtual environment..."
|
|
101
|
+
python3.exe -m venv "$VENV_PATH"
|
|
102
|
+
echo "Virtual environment created."
|
|
103
|
+
fi
|
|
104
|
+
|
|
105
|
+
ensure_python3_shim_windows
|
|
106
|
+
|
|
107
|
+
PYTHON_BIN="$(resolve_python_bin_windows)"
|
|
108
|
+
"$PYTHON_BIN" "$@"
|
|
109
|
+
;;
|
|
110
|
+
|
|
111
|
+
esac
|
package/binaries/py.cjs
ADDED
|
@@ -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);
|
package/binaries/py.cmd
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
@echo off
|
|
2
|
+
setlocal enabledelayedexpansion
|
|
3
|
+
|
|
4
|
+
REM Get the directory of the batch file
|
|
5
|
+
set "SCRIPT_DIR=%~dp0"
|
|
6
|
+
set "SCRIPT_DIR=%SCRIPT_DIR:~0,-1%"
|
|
7
|
+
|
|
8
|
+
REM Move up one level to get <project> root
|
|
9
|
+
for %%i in ("%SCRIPT_DIR%") do set "CWD=%%~dpi"
|
|
10
|
+
set "CWD=%CWD:~0,-1%"
|
|
11
|
+
|
|
12
|
+
REM Prefer venv over .venv for virtual environment path
|
|
13
|
+
set "VENV_DIR=%CWD%\venv"
|
|
14
|
+
set ".VENV_DIR=%CWD%\.venv"
|
|
15
|
+
set "VENV_PATH=%VENV_DIR%"
|
|
16
|
+
if not exist "%VENV_PATH%" (
|
|
17
|
+
if exist "%CWD%\.venv" (
|
|
18
|
+
set "VENV_PATH=%CWD%\.venv"
|
|
19
|
+
)
|
|
20
|
+
)
|
|
21
|
+
set "VENV_SCRIPTS=%VENV_PATH%\Scripts"
|
|
22
|
+
|
|
23
|
+
REM Check if venv exists
|
|
24
|
+
if not exist "%VENV_PATH%" (
|
|
25
|
+
echo Creating virtual environment...
|
|
26
|
+
call python -m venv "%VENV_PATH%"
|
|
27
|
+
if errorlevel 1 (
|
|
28
|
+
echo Failed to create virtual environment.
|
|
29
|
+
exit /b 1
|
|
30
|
+
)
|
|
31
|
+
echo Virtual environment created.
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
REM Ensure python3.exe shim exists
|
|
35
|
+
if exist "%VENV_SCRIPTS%\python.exe" (
|
|
36
|
+
if not exist "%VENV_SCRIPTS%\python3.exe" (
|
|
37
|
+
echo Creating python3.exe shim...
|
|
38
|
+
copy "%VENV_SCRIPTS%\python.exe" "%VENV_SCRIPTS%\python3.exe" >nul
|
|
39
|
+
echo python3.exe shim created.
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
REM Activate the virtual environment
|
|
44
|
+
call "%VENV_SCRIPTS%\activate.bat"
|
|
45
|
+
|
|
46
|
+
REM Run python with all forwarded arguments
|
|
47
|
+
call python %*
|
|
48
|
+
|
|
49
|
+
endlocal
|
package/binaries/rmfind.cjs
CHANGED
|
@@ -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);
|
package/binaries/rmx.cjs
CHANGED
|
@@ -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);
|