binary-collections 2.0.6 → 2.0.8

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.
Files changed (183) hide show
  1. package/bin/dir-tree.cmd +7 -0
  2. package/bin/git-diff +4 -0
  3. package/bin/git-diff.cmd +7 -0
  4. package/bin/{git-fix-encoding → git-fix} +1 -4
  5. package/bin/git-fix.cmd +7 -0
  6. package/bin/nodekill +0 -0
  7. package/bin/nodekill.cmd +0 -0
  8. package/bin/{submodule-install → submodule-install.txt} +0 -0
  9. package/bin/{submodule → submodule.txt} +0 -0
  10. package/lib/binary-collections-config.cjs +14 -0
  11. package/lib/binary-collections-config.d.mts +18 -0
  12. package/lib/binary-collections-config.d.ts +16 -0
  13. package/lib/binary-collections-config.js +39 -0
  14. package/lib/binary-collections-config.mjs +6 -0
  15. package/lib/binary-collections.cjs +105 -0
  16. package/lib/binary-collections.d.cts +2 -0
  17. package/lib/binary-collections.d.mts +121 -0
  18. package/lib/binary-collections.d.ts +121 -0
  19. package/lib/binary-collections.mjs +108 -0
  20. package/lib/chunk-4BYBVEYC.mjs +30 -0
  21. package/lib/chunk-AASHBCRW.mjs +57 -0
  22. package/lib/chunk-APBWENF6.mjs +135 -0
  23. package/lib/{chunk-M4IBUK4H.mjs → chunk-DPKAJKFO.mjs} +2 -4
  24. package/lib/chunk-EGSSKVDH.mjs +66 -0
  25. package/lib/{chunk-GA4DDV65.mjs → chunk-G3THLIDT.mjs} +3 -5
  26. package/lib/chunk-JGR2NW6D.mjs +187 -0
  27. package/lib/chunk-ONIBBBQ3.mjs +108 -0
  28. package/lib/chunk-SH3L6HHV.mjs +27 -0
  29. package/lib/chunk-VVEZVNIV.mjs +81 -0
  30. package/lib/{chunk-E75HJFJO.mjs → chunk-W3ENOM53.mjs} +2 -4
  31. package/lib/chunk-YV7DO3YV.mjs +48 -0
  32. package/lib/chunk-YX5U7XDR.mjs +58 -0
  33. package/lib/chunk-ZYAQRPUL.mjs +28 -0
  34. package/lib/clean-github-actions-caches.cjs +162 -0
  35. package/lib/clean-github-actions-caches.d.cts +1 -0
  36. package/lib/clean-github-actions-caches.d.mts +169 -0
  37. package/lib/clean-github-actions-caches.d.ts +169 -0
  38. package/lib/clean-github-actions-caches.mjs +132 -0
  39. package/lib/del-gradle.cjs +99 -15
  40. package/lib/del-gradle.d.ts +1 -2
  41. package/lib/del-gradle.js +12 -69
  42. package/lib/del-gradle.mjs +4 -6
  43. package/lib/del-node-modules.cjs +98 -14
  44. package/lib/del-node-modules.d.ts +1 -2
  45. package/lib/del-node-modules.js +11 -68
  46. package/lib/del-node-modules.mjs +3 -5
  47. package/lib/del-ps.cjs +98 -627
  48. package/lib/del-ps.d.ts +1 -2
  49. package/lib/del-ps.js +27 -702
  50. package/lib/del-ps.mjs +7 -12
  51. package/lib/del-yarn-caches.cjs +98 -14
  52. package/lib/del-yarn-caches.d.ts +1 -2
  53. package/lib/del-yarn-caches.js +6 -63
  54. package/lib/del-yarn-caches.mjs +3 -5
  55. package/lib/find-node-modules-cli.cjs +67 -0
  56. package/lib/find-node-modules-cli.d.mts +1 -0
  57. package/lib/find-node-modules-cli.d.ts +2 -0
  58. package/lib/find-node-modules-cli.js +3 -0
  59. package/lib/find-node-modules-cli.mjs +13 -0
  60. package/lib/find-node-modules.cjs +39 -9
  61. package/lib/find-node-modules.d.mts +12 -1
  62. package/lib/find-node-modules.d.ts +12 -2
  63. package/lib/find-node-modules.js +53 -12
  64. package/lib/find-node-modules.mjs +4 -19
  65. package/lib/git/gitattributes.cjs +171 -0
  66. package/lib/git/gitattributes.d.mts +35 -0
  67. package/lib/git/gitattributes.d.ts +33 -0
  68. package/lib/git/gitattributes.js +223 -0
  69. package/lib/git/gitattributes.mjs +6 -0
  70. package/lib/git/line-endings.cjs +74 -0
  71. package/lib/git/line-endings.d.cts +7 -0
  72. package/lib/git/line-endings.d.mts +83 -0
  73. package/lib/git/line-endings.d.ts +83 -0
  74. package/lib/git/line-endings.mjs +8 -0
  75. package/lib/git/normalize.cjs +42 -0
  76. package/lib/git/normalize.d.cts +6 -0
  77. package/lib/git/normalize.d.mts +43 -0
  78. package/lib/git/normalize.d.ts +43 -0
  79. package/lib/git/normalize.mjs +6 -0
  80. package/lib/git/permissions.cjs +15 -0
  81. package/lib/git/permissions.d.cts +6 -0
  82. package/lib/git/permissions.d.mts +17 -0
  83. package/lib/git/permissions.d.ts +17 -0
  84. package/lib/git/permissions.mjs +7 -0
  85. package/lib/git/pull-strategy.cjs +13 -0
  86. package/lib/git/pull-strategy.d.cts +5 -0
  87. package/lib/git/pull-strategy.d.mts +15 -0
  88. package/lib/git/pull-strategy.d.ts +15 -0
  89. package/lib/git/pull-strategy.mjs +7 -0
  90. package/lib/git/user-config.cjs +100 -0
  91. package/lib/git/user-config.d.cts +10 -0
  92. package/lib/git/user-config.d.mts +105 -0
  93. package/lib/git/user-config.d.ts +105 -0
  94. package/lib/git/user-config.mjs +8 -0
  95. package/lib/git/utils.cjs +70 -0
  96. package/lib/git/utils.d.cts +20 -0
  97. package/lib/git/utils.d.mts +69 -0
  98. package/lib/git/utils.d.ts +69 -0
  99. package/lib/git/utils.mjs +6 -0
  100. package/lib/git-diff.cjs +73 -0
  101. package/lib/git-diff.d.cts +2 -0
  102. package/lib/git-diff.d.mts +84 -0
  103. package/lib/git-diff.d.ts +84 -0
  104. package/lib/git-diff.mjs +88 -0
  105. package/lib/git-fix.cjs +129 -0
  106. package/lib/git-fix.d.cts +2 -0
  107. package/lib/git-fix.d.mts +141 -0
  108. package/lib/git-fix.d.ts +141 -0
  109. package/lib/git-fix.mjs +151 -0
  110. package/lib/git-purge.cjs +92 -621
  111. package/lib/git-purge.d.ts +1 -2
  112. package/lib/git-purge.js +53 -698
  113. package/lib/git-purge.mjs +4 -9
  114. package/lib/index.cjs +99 -1
  115. package/lib/index.d.mts +1 -2
  116. package/lib/index.d.ts +2 -2
  117. package/lib/index.js +8 -2
  118. package/lib/index.mjs +10 -3
  119. package/lib/npm-run-series.cjs +140 -1
  120. package/lib/npm-run-series.d.ts +1 -0
  121. package/lib/npm-run-series.js +81 -56
  122. package/lib/npm-run-series.mjs +7 -5
  123. package/lib/package-resolutions-updater.cjs +274 -0
  124. package/lib/package-resolutions-updater.d.mts +1 -0
  125. package/lib/package-resolutions-updater.d.ts +326 -0
  126. package/lib/package-resolutions-updater.mjs +316 -0
  127. package/lib/print-directory-tree.cjs +241 -0
  128. package/lib/print-directory-tree.d.cts +1 -0
  129. package/lib/print-directory-tree.d.mts +234 -0
  130. package/lib/print-directory-tree.d.ts +234 -0
  131. package/lib/print-directory-tree.mjs +182 -0
  132. package/lib/ps/connected-domain.cjs +0 -0
  133. package/lib/ps/connected-domain.d.ts +1 -2
  134. package/lib/ps/connected-domain.js +196 -150
  135. package/lib/ps/connected-domain.mjs +2 -3
  136. package/lib/ps/index.cjs +3 -3
  137. package/lib/ps/index.d.mjs +1 -2
  138. package/lib/ps/index.d.ts +2 -26
  139. package/lib/ps/index.js +233 -535
  140. package/lib/ps/index.mjs +9 -11
  141. package/lib/ps/isWin.cjs +0 -0
  142. package/lib/ps/isWin.d.ts +1 -2
  143. package/lib/ps/isWin.js +1 -2
  144. package/lib/ps/isWin.mjs +2 -3
  145. package/lib/ps/table-parser.cjs +0 -0
  146. package/lib/ps/table-parser.d.ts +1 -3
  147. package/lib/ps/table-parser.js +254 -345
  148. package/lib/ps/table-parser.mjs +3 -4
  149. package/lib/submodule-install.cjs +100 -0
  150. package/lib/submodule-install.d.cts +2 -0
  151. package/lib/submodule-install.d.mts +121 -0
  152. package/lib/submodule-install.d.ts +121 -0
  153. package/lib/submodule-install.mjs +107 -0
  154. package/lib/utils.cjs +98 -14
  155. package/lib/utils.d.mts +29 -9
  156. package/lib/utils.d.ts +30 -14
  157. package/lib/utils.js +173 -27
  158. package/lib/utils.mjs +2 -3
  159. package/lib/yarn-reinstall.cjs +44 -0
  160. package/lib/yarn-reinstall.d.cts +1 -0
  161. package/lib/yarn-reinstall.d.mts +49 -0
  162. package/lib/yarn-reinstall.d.ts +49 -0
  163. package/lib/yarn-reinstall.mjs +54 -0
  164. package/package.json +126 -99
  165. package/readme.md +238 -50
  166. package/src/package-resolutions-updater.mjs +325 -0
  167. package/src/print-directory-tree.cjs +234 -0
  168. package/src/ps/index.js +4 -3
  169. package/src/yarn-reinstall.cjs +49 -0
  170. package/test-project/package.json +16 -0
  171. package/tmp/test-repo/package.json +7 -0
  172. package/bin/git-fix-encoding.cmd +0 -6
  173. package/eslint.config.cjs +0 -97
  174. package/lib/chunk-7MSZ52XC.mjs +0 -14
  175. package/lib/chunk-AVDT32AY.mjs +0 -20
  176. package/lib/chunk-LPLPQBYP.mjs +0 -53
  177. package/lib/chunk-S4SJ7SDW.mjs +0 -625
  178. package/lib/package-resolutions.cjs +0 -28
  179. package/lib/package-resolutions.d.mts +0 -25
  180. package/lib/package-resolutions.d.ts +0 -25
  181. package/lib/package-resolutions.js +0 -28
  182. package/lib/package-resolutions.mjs +0 -31
  183. package/lib/ps/index.d.js +0 -17
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+ set SCRIPT_DIR=%~dp0
4
+
5
+ echo Running script: %~f0
6
+
7
+ node "%SCRIPT_DIR%..\lib\print-directory-tree.cjs" %*
package/bin/git-diff ADDED
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env bash
2
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
3
+
4
+ node "$SCRIPT_DIR/../lib/git-diff.cjs" "$@"
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+ set SCRIPT_DIR=%~dp0
4
+
5
+ echo Running script: %~f0
6
+
7
+ node "%SCRIPT_DIR%..\lib\git-diff.cjs" %*
@@ -33,7 +33,4 @@ if [ -f ".env" ]; then
33
33
  export $(egrep -v '^#' .env | xargs)
34
34
  fi
35
35
 
36
- echo "fix auto rebase"
37
- git config config.pull false
38
- echo "force LF end of line"
39
- git config core.autocrlf false
36
+ node "$basedir/../lib/git-fix.cjs" "$@"
@@ -0,0 +1,7 @@
1
+ @echo off
2
+ setlocal
3
+ set SCRIPT_DIR=%~dp0
4
+
5
+ echo Running script: %~f0
6
+
7
+ node "%SCRIPT_DIR%..\lib\git-fix.cjs" %*
package/bin/nodekill CHANGED
File without changes
package/bin/nodekill.cmd CHANGED
File without changes
File without changes
File without changes
@@ -0,0 +1,14 @@
1
+ // src/binary-collections-config.js
2
+ var path = require("path");
3
+ function getTempDir() {
4
+ return process.env.TEMP_DIR || "tmp";
5
+ }
6
+ function getTempPath(...segments) {
7
+ return path.join(getTempDir(), ...segments);
8
+ }
9
+ var TEMP_BASE_DIR = getTempDir();
10
+ module.exports = {
11
+ getTempDir,
12
+ getTempPath,
13
+ TEMP_BASE_DIR
14
+ };
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Get the base temporary directory path
3
+ * Can be overridden via TEMP_DIR environment variable
4
+ * @returns {string} The base temporary directory path
5
+ */
6
+ declare function getTempDir(): string;
7
+ /**
8
+ * Get a temporary file or directory path
9
+ * @param {...string} segments - Path segments to join with the temp directory
10
+ * @returns {string} The full temporary path
11
+ */
12
+ declare function getTempPath(...segments: string[]): string;
13
+ /**
14
+ * Legacy aliases for backward compatibility
15
+ */
16
+ declare const TEMP_BASE_DIR: string;
17
+
18
+ export { TEMP_BASE_DIR, getTempDir, getTempPath };
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Get the base temporary directory path
3
+ * Can be overridden via TEMP_DIR environment variable
4
+ * @returns {string} The base temporary directory path
5
+ */
6
+ export function getTempDir(): string;
7
+ /**
8
+ * Get a temporary file or directory path
9
+ * @param {...string} segments - Path segments to join with the temp directory
10
+ * @returns {string} The full temporary path
11
+ */
12
+ export function getTempPath(...segments: string[]): string;
13
+ /**
14
+ * Legacy aliases for backward compatibility
15
+ */
16
+ export const TEMP_BASE_DIR: string;
@@ -0,0 +1,39 @@
1
+ /**
2
+ * Centralized configuration for binary-collections
3
+ * This module provides a consistent way to handle temporary directories and other configuration across the project.
4
+ *
5
+ * Usage:
6
+ * const { getTempDir, getTempPath } = require('./binary-collections-config');
7
+ *
8
+ * // Get base temp directory
9
+ * const tempDir = getTempDir();
10
+ *
11
+ * // Get specific temp path
12
+ * const myTempPath = getTempPath('my-module', 'output.txt');
13
+ */
14
+ const path = require("path");
15
+ /**
16
+ * Get the base temporary directory path
17
+ * Can be overridden via TEMP_DIR environment variable
18
+ * @returns {string} The base temporary directory path
19
+ */
20
+ function getTempDir() {
21
+ return process.env.TEMP_DIR || "tmp";
22
+ }
23
+ /**
24
+ * Get a temporary file or directory path
25
+ * @param {...string} segments - Path segments to join with the temp directory
26
+ * @returns {string} The full temporary path
27
+ */
28
+ function getTempPath(...segments) {
29
+ return path.join(getTempDir(), ...segments);
30
+ }
31
+ /**
32
+ * Legacy aliases for backward compatibility
33
+ */
34
+ const TEMP_BASE_DIR = getTempDir();
35
+ module.exports = {
36
+ getTempDir,
37
+ getTempPath,
38
+ TEMP_BASE_DIR
39
+ };
@@ -0,0 +1,6 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ require_binary_collections_config
4
+ } from "./chunk-4BYBVEYC.mjs";
5
+ import "./chunk-AASHBCRW.mjs";
6
+ export default require_binary_collections_config();
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ const { spawn } = require("child_process");
4
+ const { glob } = require("glob");
5
+ const path = require("path");
6
+ const { getArgs } = require("./utils.js");
7
+ /**
8
+ * Main binary-collections script that dynamically finds and executes other scripts
9
+ * Usage: npx binary-collections <script-name> [...args]
10
+ * Example: npx binary-collections git-diff -s
11
+ */
12
+ function showHelp() {
13
+ console.log("🚀 Binary Collections - Dynamic Script Runner");
14
+ console.log("═══════════════════════════════════════════════");
15
+ console.log("");
16
+ console.log("📋 Usage: npx binary-collections <script-name> [...args]");
17
+ console.log("");
18
+ console.log("✨ Examples:");
19
+ console.log(" 📊 npx binary-collections git-diff -s");
20
+ console.log(" 🧹 npx binary-collections del-node-modules");
21
+ console.log(" 🔍 npx binary-collections find-node-modules --help");
22
+ console.log("");
23
+ console.log("ℹ️ This tool will search for <script-name>.{cjs,js,mjs} in the script's directory");
24
+ console.log(" and execute it with the provided arguments.");
25
+ console.log("");
26
+ console.log("⚙️ Options:");
27
+ console.log(" --help, -h Show this help message");
28
+ process.exit(0);
29
+ }
30
+ function findScript(scriptName, searchDir = null) {
31
+ if (!searchDir)
32
+ searchDir = __dirname;
33
+ // Define ignore patterns for library config and utils
34
+ const ignorePatterns = [
35
+ `**/*config*.{cjs,js,mjs}`,
36
+ `**/utils.{cjs,js,mjs}`,
37
+ `**/index.{cjs,js,mjs}`,
38
+ `**/chunk-*.{cjs,js,mjs}`,
39
+ `**/*.d.{ts,cts,mts}` // ignore TypeScript declaration files
40
+ ];
41
+ try {
42
+ // Use glob to find script files, excluding ignored patterns
43
+ // Use cwd option for better path handling
44
+ const pattern = `${scriptName}.{cjs,js,mjs}`;
45
+ const files = glob.sync(pattern, {
46
+ cwd: searchDir,
47
+ ignore: ignorePatterns,
48
+ absolute: true
49
+ });
50
+ // Return the first match if found
51
+ if (files.length > 0) {
52
+ return files[0];
53
+ }
54
+ }
55
+ catch (error) {
56
+ console.error(`🔍 Error searching for script: ${error.message}`);
57
+ }
58
+ return null;
59
+ }
60
+ function executeScript(scriptPath, args) {
61
+ const child = spawn("node", [scriptPath, ...args], {
62
+ stdio: "inherit",
63
+ shell: true
64
+ });
65
+ child.on("error", (error) => {
66
+ console.error(`❌ Error executing script: ${error.message}`);
67
+ process.exit(1);
68
+ });
69
+ child.on("close", (code) => {
70
+ process.exit(code);
71
+ });
72
+ }
73
+ function main() {
74
+ const args = getArgs();
75
+ const positional = args._ || [];
76
+ // Show help if no arguments or if help is requested without a script name
77
+ if (positional.length === 0 || (positional.length === 1 && (args.help || args.h))) {
78
+ showHelp();
79
+ }
80
+ const scriptName = positional[0];
81
+ const scriptArgs = positional.slice(1);
82
+ // Find the script in current directory
83
+ const scriptPath = findScript(scriptName);
84
+ if (!scriptPath) {
85
+ console.error(`❌ Error: Script "${scriptName}" not found.`);
86
+ console.error(`🔍 Searched for: ${scriptName}.{cjs,js,mjs} in ${__dirname}`);
87
+ console.error("");
88
+ console.error("📝 Available extensions: .cjs, .js, .mjs");
89
+ process.exit(1);
90
+ }
91
+ // Show relative path from current working directory
92
+ const relativePath = path.relative(process.cwd(), scriptPath);
93
+ console.log(`✅ Found script: ${relativePath}`);
94
+ executeScript(scriptPath, scriptArgs);
95
+ }
96
+ // Handle uncaught exceptions
97
+ process.on("uncaughtException", (error) => {
98
+ console.error("💥 Uncaught Exception:", error.message);
99
+ process.exit(1);
100
+ });
101
+ process.on("unhandledRejection", (reason, promise) => {
102
+ console.error("⚠️ Unhandled Rejection at:", promise, "reason:", reason);
103
+ process.exit(1);
104
+ });
105
+ main();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require("child_process");
3
+ const { glob } = require("glob");
4
+ const path = require("path");
5
+ const { getArgs } = require("./utils.js");
6
+
7
+ /**
8
+ * Main binary-collections script that dynamically finds and executes other scripts
9
+ * Usage: npx binary-collections <script-name> [...args]
10
+ * Example: npx binary-collections git-diff -s
11
+ */
12
+
13
+ function showHelp() {
14
+ console.log("🚀 Binary Collections - Dynamic Script Runner");
15
+ console.log("═══════════════════════════════════════════════");
16
+ console.log("");
17
+ console.log("📋 Usage: npx binary-collections <script-name> [...args]");
18
+ console.log("");
19
+ console.log("✨ Examples:");
20
+ console.log(" 📊 npx binary-collections git-diff -s");
21
+ console.log(" 🧹 npx binary-collections del-node-modules");
22
+ console.log(" 🔍 npx binary-collections find-node-modules --help");
23
+ console.log("");
24
+ console.log("ℹ️ This tool will search for <script-name>.{cjs,js,mjs} in the script's directory");
25
+ console.log(" and execute it with the provided arguments.");
26
+ console.log("");
27
+ console.log("⚙️ Options:");
28
+ console.log(" --help, -h Show this help message");
29
+ process.exit(0);
30
+ }
31
+
32
+ function findScript(scriptName, searchDir = null) {
33
+ if (!searchDir) searchDir = __dirname;
34
+
35
+ // Define ignore patterns for library config and utils
36
+ const ignorePatterns = [
37
+ `**/*config*.{cjs,js,mjs}`,
38
+ `**/utils.{cjs,js,mjs}`,
39
+ `**/index.{cjs,js,mjs}`,
40
+ `**/chunk-*.{cjs,js,mjs}`,
41
+ `**/*.d.{ts,cts,mts}` // ignore TypeScript declaration files
42
+ ];
43
+
44
+ try {
45
+ // Use glob to find script files, excluding ignored patterns
46
+ // Use cwd option for better path handling
47
+ const pattern = `${scriptName}.{cjs,js,mjs}`;
48
+ const files = glob.sync(pattern, {
49
+ cwd: searchDir,
50
+ ignore: ignorePatterns,
51
+ absolute: true
52
+ });
53
+
54
+ // Return the first match if found
55
+ if (files.length > 0) {
56
+ return files[0];
57
+ }
58
+ } catch (error) {
59
+ console.error(`🔍 Error searching for script: ${error.message}`);
60
+ }
61
+
62
+ return null;
63
+ }
64
+
65
+ function executeScript(scriptPath, args) {
66
+ const child = spawn("node", [scriptPath, ...args], {
67
+ stdio: "inherit",
68
+ shell: true
69
+ });
70
+
71
+ child.on("error", (error) => {
72
+ console.error(`❌ Error executing script: ${error.message}`);
73
+ process.exit(1);
74
+ });
75
+
76
+ child.on("close", (code) => {
77
+ process.exit(code);
78
+ });
79
+ }
80
+
81
+ function main() {
82
+ const args = getArgs();
83
+ const positional = args._ || [];
84
+
85
+ // Show help if no arguments or if help is requested without a script name
86
+ if (positional.length === 0 || (positional.length === 1 && (args.help || args.h))) {
87
+ showHelp();
88
+ }
89
+
90
+ const scriptName = positional[0];
91
+ const scriptArgs = positional.slice(1);
92
+
93
+ // Find the script in current directory
94
+ const scriptPath = findScript(scriptName);
95
+
96
+ if (!scriptPath) {
97
+ console.error(`❌ Error: Script "${scriptName}" not found.`);
98
+ console.error(`🔍 Searched for: ${scriptName}.{cjs,js,mjs} in ${__dirname}`);
99
+ console.error("");
100
+ console.error("📝 Available extensions: .cjs, .js, .mjs");
101
+ process.exit(1);
102
+ }
103
+
104
+ // Show relative path from current working directory
105
+ const relativePath = path.relative(process.cwd(), scriptPath);
106
+ console.log(`✅ Found script: ${relativePath}`);
107
+ executeScript(scriptPath, scriptArgs);
108
+ }
109
+
110
+ // Handle uncaught exceptions
111
+ process.on("uncaughtException", (error) => {
112
+ console.error("💥 Uncaught Exception:", error.message);
113
+ process.exit(1);
114
+ });
115
+
116
+ process.on("unhandledRejection", (reason, promise) => {
117
+ console.error("⚠️ Unhandled Rejection at:", promise, "reason:", reason);
118
+ process.exit(1);
119
+ });
120
+
121
+ main();
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ const { spawn } = require("child_process");
3
+ const { glob } = require("glob");
4
+ const path = require("path");
5
+ const { getArgs } = require("./utils.js");
6
+
7
+ /**
8
+ * Main binary-collections script that dynamically finds and executes other scripts
9
+ * Usage: npx binary-collections <script-name> [...args]
10
+ * Example: npx binary-collections git-diff -s
11
+ */
12
+
13
+ function showHelp() {
14
+ console.log("🚀 Binary Collections - Dynamic Script Runner");
15
+ console.log("═══════════════════════════════════════════════");
16
+ console.log("");
17
+ console.log("📋 Usage: npx binary-collections <script-name> [...args]");
18
+ console.log("");
19
+ console.log("✨ Examples:");
20
+ console.log(" 📊 npx binary-collections git-diff -s");
21
+ console.log(" 🧹 npx binary-collections del-node-modules");
22
+ console.log(" 🔍 npx binary-collections find-node-modules --help");
23
+ console.log("");
24
+ console.log("ℹ️ This tool will search for <script-name>.{cjs,js,mjs} in the script's directory");
25
+ console.log(" and execute it with the provided arguments.");
26
+ console.log("");
27
+ console.log("⚙️ Options:");
28
+ console.log(" --help, -h Show this help message");
29
+ process.exit(0);
30
+ }
31
+
32
+ function findScript(scriptName, searchDir = null) {
33
+ if (!searchDir) searchDir = __dirname;
34
+
35
+ // Define ignore patterns for library config and utils
36
+ const ignorePatterns = [
37
+ `**/*config*.{cjs,js,mjs}`,
38
+ `**/utils.{cjs,js,mjs}`,
39
+ `**/index.{cjs,js,mjs}`,
40
+ `**/chunk-*.{cjs,js,mjs}`,
41
+ `**/*.d.{ts,cts,mts}` // ignore TypeScript declaration files
42
+ ];
43
+
44
+ try {
45
+ // Use glob to find script files, excluding ignored patterns
46
+ // Use cwd option for better path handling
47
+ const pattern = `${scriptName}.{cjs,js,mjs}`;
48
+ const files = glob.sync(pattern, {
49
+ cwd: searchDir,
50
+ ignore: ignorePatterns,
51
+ absolute: true
52
+ });
53
+
54
+ // Return the first match if found
55
+ if (files.length > 0) {
56
+ return files[0];
57
+ }
58
+ } catch (error) {
59
+ console.error(`🔍 Error searching for script: ${error.message}`);
60
+ }
61
+
62
+ return null;
63
+ }
64
+
65
+ function executeScript(scriptPath, args) {
66
+ const child = spawn("node", [scriptPath, ...args], {
67
+ stdio: "inherit",
68
+ shell: true
69
+ });
70
+
71
+ child.on("error", (error) => {
72
+ console.error(`❌ Error executing script: ${error.message}`);
73
+ process.exit(1);
74
+ });
75
+
76
+ child.on("close", (code) => {
77
+ process.exit(code);
78
+ });
79
+ }
80
+
81
+ function main() {
82
+ const args = getArgs();
83
+ const positional = args._ || [];
84
+
85
+ // Show help if no arguments or if help is requested without a script name
86
+ if (positional.length === 0 || (positional.length === 1 && (args.help || args.h))) {
87
+ showHelp();
88
+ }
89
+
90
+ const scriptName = positional[0];
91
+ const scriptArgs = positional.slice(1);
92
+
93
+ // Find the script in current directory
94
+ const scriptPath = findScript(scriptName);
95
+
96
+ if (!scriptPath) {
97
+ console.error(`❌ Error: Script "${scriptName}" not found.`);
98
+ console.error(`🔍 Searched for: ${scriptName}.{cjs,js,mjs} in ${__dirname}`);
99
+ console.error("");
100
+ console.error("📝 Available extensions: .cjs, .js, .mjs");
101
+ process.exit(1);
102
+ }
103
+
104
+ // Show relative path from current working directory
105
+ const relativePath = path.relative(process.cwd(), scriptPath);
106
+ console.log(`✅ Found script: ${relativePath}`);
107
+ executeScript(scriptPath, scriptArgs);
108
+ }
109
+
110
+ // Handle uncaught exceptions
111
+ process.on("uncaughtException", (error) => {
112
+ console.error("💥 Uncaught Exception:", error.message);
113
+ process.exit(1);
114
+ });
115
+
116
+ process.on("unhandledRejection", (reason, promise) => {
117
+ console.error("⚠️ Unhandled Rejection at:", promise, "reason:", reason);
118
+ process.exit(1);
119
+ });
120
+
121
+ main();
@@ -0,0 +1,108 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
+ import {
4
+ require_utils
5
+ } from "./chunk-APBWENF6.mjs";
6
+ import {
7
+ __commonJS,
8
+ __dirname,
9
+ __require,
10
+ init_esm_shims
11
+ } from "./chunk-AASHBCRW.mjs";
12
+
13
+ // src/binary-collections.cjs
14
+ var require_binary_collections = __commonJS({
15
+ "src/binary-collections.cjs"() {
16
+ init_esm_shims();
17
+ var { spawn } = __require("child_process");
18
+ var { glob } = __require("glob");
19
+ var path = __require("path");
20
+ var { getArgs } = require_utils();
21
+ function showHelp() {
22
+ console.log("\u{1F680} Binary Collections - Dynamic Script Runner");
23
+ console.log("\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
24
+ console.log("");
25
+ console.log("\u{1F4CB} Usage: npx binary-collections <script-name> [...args]");
26
+ console.log("");
27
+ console.log("\u2728 Examples:");
28
+ console.log(" \u{1F4CA} npx binary-collections git-diff -s");
29
+ console.log(" \u{1F9F9} npx binary-collections del-node-modules");
30
+ console.log(" \u{1F50D} npx binary-collections find-node-modules --help");
31
+ console.log("");
32
+ console.log("\u2139\uFE0F This tool will search for <script-name>.{cjs,js,mjs} in the script's directory");
33
+ console.log(" and execute it with the provided arguments.");
34
+ console.log("");
35
+ console.log("\u2699\uFE0F Options:");
36
+ console.log(" --help, -h Show this help message");
37
+ process.exit(0);
38
+ }
39
+ function findScript(scriptName, searchDir = null) {
40
+ if (!searchDir) searchDir = __dirname;
41
+ const ignorePatterns = [
42
+ `**/*config*.{cjs,js,mjs}`,
43
+ `**/utils.{cjs,js,mjs}`,
44
+ `**/index.{cjs,js,mjs}`,
45
+ `**/chunk-*.{cjs,js,mjs}`,
46
+ `**/*.d.{ts,cts,mts}`
47
+ // ignore TypeScript declaration files
48
+ ];
49
+ try {
50
+ const pattern = `${scriptName}.{cjs,js,mjs}`;
51
+ const files = glob.sync(pattern, {
52
+ cwd: searchDir,
53
+ ignore: ignorePatterns,
54
+ absolute: true
55
+ });
56
+ if (files.length > 0) {
57
+ return files[0];
58
+ }
59
+ } catch (error) {
60
+ console.error(`\u{1F50D} Error searching for script: ${error.message}`);
61
+ }
62
+ return null;
63
+ }
64
+ function executeScript(scriptPath, args) {
65
+ const child = spawn("node", [scriptPath, ...args], {
66
+ stdio: "inherit",
67
+ shell: true
68
+ });
69
+ child.on("error", (error) => {
70
+ console.error(`\u274C Error executing script: ${error.message}`);
71
+ process.exit(1);
72
+ });
73
+ child.on("close", (code) => {
74
+ process.exit(code);
75
+ });
76
+ }
77
+ function main() {
78
+ const args = getArgs();
79
+ const positional = args._ || [];
80
+ if (positional.length === 0 || positional.length === 1 && (args.help || args.h)) {
81
+ showHelp();
82
+ }
83
+ const scriptName = positional[0];
84
+ const scriptArgs = positional.slice(1);
85
+ const scriptPath = findScript(scriptName);
86
+ if (!scriptPath) {
87
+ console.error(`\u274C Error: Script "${scriptName}" not found.`);
88
+ console.error(`\u{1F50D} Searched for: ${scriptName}.{cjs,js,mjs} in ${__dirname}`);
89
+ console.error("");
90
+ console.error("\u{1F4DD} Available extensions: .cjs, .js, .mjs");
91
+ process.exit(1);
92
+ }
93
+ const relativePath = path.relative(process.cwd(), scriptPath);
94
+ console.log(`\u2705 Found script: ${relativePath}`);
95
+ executeScript(scriptPath, scriptArgs);
96
+ }
97
+ process.on("uncaughtException", (error) => {
98
+ console.error("\u{1F4A5} Uncaught Exception:", error.message);
99
+ process.exit(1);
100
+ });
101
+ process.on("unhandledRejection", (reason, promise) => {
102
+ console.error("\u26A0\uFE0F Unhandled Rejection at:", promise, "reason:", reason);
103
+ process.exit(1);
104
+ });
105
+ main();
106
+ }
107
+ });
108
+ export default require_binary_collections();
@@ -0,0 +1,30 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ __commonJS,
4
+ __require,
5
+ init_esm_shims
6
+ } from "./chunk-AASHBCRW.mjs";
7
+
8
+ // src/binary-collections-config.js
9
+ var require_binary_collections_config = __commonJS({
10
+ "src/binary-collections-config.js"(exports, module) {
11
+ init_esm_shims();
12
+ var path = __require("path");
13
+ function getTempDir() {
14
+ return process.env.TEMP_DIR || "tmp";
15
+ }
16
+ function getTempPath(...segments) {
17
+ return path.join(getTempDir(), ...segments);
18
+ }
19
+ var TEMP_BASE_DIR = getTempDir();
20
+ module.exports = {
21
+ getTempDir,
22
+ getTempPath,
23
+ TEMP_BASE_DIR
24
+ };
25
+ }
26
+ });
27
+
28
+ export {
29
+ require_binary_collections_config
30
+ };