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.
Files changed (225) hide show
  1. package/.opencode/package.json +5 -0
  2. package/binaries/rmx +15 -1
  3. package/binaries/rmx.cmd +12 -0
  4. package/binaries/test-cjs +9 -1
  5. package/binaries/test-cjs.cmd +16 -1
  6. package/binaries/test-esm +16 -0
  7. package/binaries/test-esm.cjs +178 -0
  8. package/binaries/test-esm.cmd +23 -0
  9. package/binaries/yarn-clean +1 -1
  10. package/binaries/yarn-clean.cmd +1 -1
  11. package/binaries/yarn-clean.py +33 -15
  12. package/binaries/yc +110 -0
  13. package/binaries/yc.cjs +178 -0
  14. package/lib/binary-collections/config.cjs +126 -0
  15. package/lib/binary-collections/config.mjs +7 -0
  16. package/lib/binary-collections/executeScript.cjs +19 -0
  17. package/lib/binary-collections/executeScript.d.cts +12 -0
  18. package/lib/binary-collections/executeScript.mjs +6 -0
  19. package/lib/binary-collections/findScript.cjs +284 -0
  20. package/lib/binary-collections/findScript.d.cts +12 -0
  21. package/lib/binary-collections/findScript.mjs +7 -0
  22. package/lib/binary-collections/listScript.cjs +266 -0
  23. package/lib/binary-collections/listScript.d.cts +19 -0
  24. package/lib/binary-collections/listScript.mjs +7 -0
  25. package/lib/binary-collections.cjs +224 -137
  26. package/lib/binary-collections.mjs +22 -282
  27. package/lib/changelog.cjs +2 -2
  28. package/lib/changelog.mjs +1 -1
  29. package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
  30. package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
  31. package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
  32. package/lib/chunk-6PU7BAHB.mjs +61 -0
  33. package/lib/chunk-C6D2TTYU.mjs +32 -0
  34. package/lib/chunk-FB2WKVJD.mjs +158 -0
  35. package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
  36. package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
  37. package/lib/chunk-H44UWUFY.mjs +105 -0
  38. package/lib/chunk-NCZPTKDV.mjs +79 -0
  39. package/lib/chunk-NGFK3EYW.mjs +28 -0
  40. package/lib/chunk-NVEG3LEZ.mjs +143 -0
  41. package/lib/chunk-OGXVGBRI.mjs +29 -0
  42. package/lib/chunk-OXV52GD5.mjs +62 -0
  43. package/lib/chunk-PXBMHE7O.mjs +35 -0
  44. package/lib/chunk-R5FJOR63.mjs +47 -0
  45. package/lib/chunk-SPTECFE5.mjs +180 -0
  46. package/lib/chunk-UXCFNAR6.mjs +55 -0
  47. package/lib/chunk-V2IBPCEV.mjs +39 -0
  48. package/lib/chunk-XPJGCDOD.mjs +14 -0
  49. package/lib/chunk-ZOWVMII3.mjs +228 -0
  50. package/lib/clean-github-actions-caches-cli.cjs +465 -0
  51. package/lib/clean-github-actions-caches-cli.d.cts +1 -0
  52. package/lib/clean-github-actions-caches-cli.mjs +56 -0
  53. package/lib/clean-github-actions-caches.cjs +149 -205
  54. package/lib/clean-github-actions-caches.d.cts +15 -1
  55. package/lib/clean-github-actions-caches.mjs +4 -130
  56. package/lib/cross-env/command.cjs +63 -0
  57. package/lib/cross-env/command.d.ts +8 -0
  58. package/lib/cross-env/command.js +45 -0
  59. package/lib/cross-env/command.mjs +9 -0
  60. package/lib/cross-env/index.cjs +178 -0
  61. package/lib/cross-env/index.d.ts +8 -0
  62. package/lib/cross-env/index.js +102 -0
  63. package/lib/cross-env/index.mjs +101 -0
  64. package/lib/cross-env/variable.cjs +60 -0
  65. package/lib/cross-env/variable.d.ts +7 -0
  66. package/lib/cross-env/variable.js +59 -0
  67. package/lib/cross-env/variable.mjs +9 -0
  68. package/lib/del-gradle.cjs +2 -2
  69. package/lib/del-gradle.js +8 -8
  70. package/lib/del-gradle.mjs +1 -1
  71. package/lib/del-node-modules.js +24 -24
  72. package/lib/del-ps.cjs +2 -2
  73. package/lib/del-ps.js +8 -8
  74. package/lib/del-ps.mjs +1 -1
  75. package/lib/del-yarn-caches.cjs +2 -2
  76. package/lib/del-yarn-caches.js +2 -2
  77. package/lib/del-yarn-caches.mjs +1 -1
  78. package/lib/file/copy-cli.cjs +92 -0
  79. package/lib/file/copy-cli.d.mts +1 -0
  80. package/lib/file/copy-cli.mjs +55 -0
  81. package/lib/file/copy.cjs +56 -0
  82. package/lib/file/copy.d.mts +1 -0
  83. package/lib/file/copy.mjs +8 -0
  84. package/lib/file/move-cli.cjs +91 -0
  85. package/lib/file/move-cli.d.mts +1 -0
  86. package/lib/file/move-cli.mjs +55 -0
  87. package/lib/file/move.cjs +55 -0
  88. package/lib/file/move.d.mts +1 -0
  89. package/lib/file/move.mjs +8 -0
  90. package/lib/find-node-modules-cli.js +1 -1
  91. package/lib/free-chatgpt.cjs +21 -15
  92. package/lib/free-chatgpt.js +10 -10
  93. package/lib/free-chatgpt.mjs +2 -2
  94. package/lib/git/user-config.cjs +2 -2
  95. package/lib/git/user-config.mjs +2 -2
  96. package/lib/git-diff-cli.cjs +188 -42
  97. package/lib/git-diff-cli.mjs +5 -4
  98. package/lib/git-diff.cjs +188 -42
  99. package/lib/git-diff.d.ts +2 -1
  100. package/lib/git-diff.js +91 -34
  101. package/lib/git-diff.mjs +5 -4
  102. package/lib/git-fix.cjs +2 -2
  103. package/lib/git-fix.mjs +2 -2
  104. package/lib/git-purge.cjs +2 -2
  105. package/lib/git-purge.mjs +1 -1
  106. package/lib/index.d.ts +1 -1
  107. package/lib/kill-night-crows.cjs +7 -7
  108. package/lib/kill-night-crows.mjs +7 -7
  109. package/lib/node-cache-cleaner/npm.cjs +65 -0
  110. package/lib/node-cache-cleaner/npm.d.ts +2 -0
  111. package/lib/node-cache-cleaner/npm.js +41 -0
  112. package/lib/node-cache-cleaner/npm.mjs +10 -0
  113. package/lib/node-cache-cleaner/npx.cjs +89 -0
  114. package/lib/node-cache-cleaner/npx.d.ts +4 -0
  115. package/lib/node-cache-cleaner/npx.js +82 -0
  116. package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
  117. package/lib/node-cache-cleaner/yarn.cjs +73 -0
  118. package/lib/node-cache-cleaner/yarn.d.ts +2 -0
  119. package/lib/node-cache-cleaner/yarn.js +62 -0
  120. package/lib/node-cache-cleaner/yarn.mjs +10 -0
  121. package/lib/node-cache-cleaner-cli.cjs +182 -0
  122. package/lib/node-cache-cleaner-cli.d.ts +2 -0
  123. package/lib/node-cache-cleaner-cli.js +60 -0
  124. package/lib/node-cache-cleaner-cli.mjs +56 -0
  125. package/lib/node-executor.cjs +91 -0
  126. package/lib/node-executor.d.cts +2 -0
  127. package/lib/node-executor.mjs +103 -0
  128. package/lib/npm-run-series.cjs +21 -28
  129. package/lib/npm-run-series.mjs +20 -6
  130. package/lib/package-resolutions-updater-cli.cjs +213 -128
  131. package/lib/package-resolutions-updater-cli.mjs +17 -39
  132. package/lib/package-resolutions-updater.cjs +204 -98
  133. package/lib/package-resolutions-updater.d.mts +20 -1
  134. package/lib/package-resolutions-updater.mjs +7 -5
  135. package/lib/print-directory-tree.cjs +2 -2
  136. package/lib/print-directory-tree.mjs +1 -1
  137. package/lib/ps/connected-domain.js +10 -10
  138. package/lib/ps/index.cjs +1 -1
  139. package/lib/ps/index.mjs +177 -171
  140. package/lib/ps/isWin.js +1 -1
  141. package/lib/ps/table-parser.js +6 -6
  142. package/lib/remove-module.cjs +2 -2
  143. package/lib/remove-module.mjs +1 -1
  144. package/lib/rm-node-module-cli.cjs +222 -0
  145. package/lib/rm-node-module-cli.d.cts +1 -0
  146. package/lib/rm-node-module-cli.mjs +89 -0
  147. package/lib/rm-node-modules.cjs +127 -0
  148. package/lib/rm-node-modules.d.cts +35 -0
  149. package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
  150. package/lib/rmpath.cjs +2 -2
  151. package/lib/rmpath.mjs +1 -1
  152. package/lib/submodule-install.cjs +47 -34
  153. package/lib/submodule-install.mjs +46 -33
  154. package/lib/submodule-remove-cli.cjs +1 -2
  155. package/lib/submodule-remove-cli.js +3 -3
  156. package/lib/submodule-remove-cli.mjs +1 -2
  157. package/lib/utils/chatgpt.cjs +19 -13
  158. package/lib/utils/chatgpt.js +94 -94
  159. package/lib/utils/chatgpt.mjs +1 -1
  160. package/lib/utils/findEnvFiles.cjs +28 -46
  161. package/lib/utils/findEnvFiles.d.cts +19 -0
  162. package/lib/utils/findEnvFiles.mjs +3 -5
  163. package/lib/utils/findWorkspaceRoot.js +4 -4
  164. package/lib/utils/index.cjs +2 -2
  165. package/lib/utils/index.mjs +1 -1
  166. package/lib/utils/isGithubTokenValid.js +7 -7
  167. package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
  168. package/lib/utils/isWindows.d.ts +5 -0
  169. package/lib/utils/isWindows.js +10 -0
  170. package/lib/utils/isWindows.mjs +8 -0
  171. package/lib/utils/runBash.cjs +53 -0
  172. package/lib/utils/runBash.d.cts +12 -0
  173. package/lib/utils/runBash.mjs +66 -0
  174. package/lib/yarn-per-branch-lock-installer.cjs +97 -0
  175. package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
  176. package/lib/yarn-per-branch-lock-installer.mjs +109 -0
  177. package/lib/yarn-reinstall.cjs +2 -2
  178. package/lib/yarn-reinstall.mjs +1 -1
  179. package/package.json +61 -52
  180. package/readme.html +784 -0
  181. package/readme.md +106 -218
  182. package/releases/readme.md +1 -1
  183. package/test/README.md +2 -2
  184. package/test-project/package.json +8 -2
  185. package/test-project/workspaces/workspace-a/package.json +135 -0
  186. package/test-project/workspaces/workspace-a/readme.md +20 -0
  187. package/test-project/workspaces/workspace-a/release/readme.md +42 -0
  188. package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
  189. package/test-project/workspaces/workspace-a/test/readme.md +12 -0
  190. package/test-project/workspaces/workspace-b/package.json +139 -0
  191. package/test-project/workspaces/workspace-b/readme.md +94 -0
  192. package/test-project/workspaces/workspace-b/requirements.txt +1 -0
  193. package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
  194. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
  195. package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
  196. package/tmp/rm-node-modules-test-project/package.json +17 -0
  197. package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
  198. package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
  199. package/tmp/test-repo/README.md +2 -35
  200. package/tmp/test-repo/package.json +13 -3
  201. package/docs-src/clean-github-actions-caches.md +0 -26
  202. package/docs-src/free-chatgpt.md +0 -26
  203. package/lib/binary-collections-config.cjs +0 -15
  204. package/lib/chunk-2CBJCW7E.mjs +0 -81
  205. package/lib/chunk-4UHL4WVN.mjs +0 -136
  206. package/lib/chunk-66PAU5PS.mjs +0 -31
  207. package/lib/chunk-6HHJRKFB.mjs +0 -59
  208. package/lib/chunk-7XTEJHOE.mjs +0 -193
  209. package/lib/chunk-FCDQGYBF.mjs +0 -136
  210. package/lib/chunk-GEYA2USY.mjs +0 -207
  211. package/lib/chunk-GJTGHXRA.mjs +0 -356
  212. package/lib/chunk-ID2WBTE2.mjs +0 -80
  213. package/lib/chunk-JXFOHKDM.mjs +0 -239
  214. package/lib/chunk-PDSXF5HY.mjs +0 -187
  215. package/lib/chunk-RWLXRTYP.mjs +0 -109
  216. package/lib/chunk-TOIVAQF7.mjs +0 -136
  217. package/lib/chunk-V5SKYJUB.mjs +0 -136
  218. package/lib/chunk-WSRETQCA.mjs +0 -59
  219. package/lib/chunk-YYLIQQKF.mjs +0 -31
  220. package/lib/ps/index.d.ts +0 -2
  221. package/lib/ps/index.js +0 -254
  222. package/lib/utils/findEnvFiles.d.ts +0 -8
  223. package/lib/utils/findEnvFiles.js +0 -121
  224. package/tmp/typedoc/readme.md +0 -320
  225. /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
@@ -70,7 +70,7 @@ function del(fullPath) {
70
70
  try {
71
71
  fs.rmdirSync(fullPath);
72
72
  console.log("deleted", fullPath);
73
- } catch (e) {
73
+ } catch (_e) {
74
74
  try {
75
75
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
76
76
  console.log("deleted", fullPath);
@@ -83,7 +83,7 @@ function del(fullPath) {
83
83
  try {
84
84
  fs.unlinkSync(fullPath);
85
85
  console.log("deleted", fullPath);
86
- } catch (e) {
86
+ } catch (_e) {
87
87
  try {
88
88
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
89
89
  console.log("deleted", fullPath);
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "../chunk-Z6JLYU2J.mjs";
4
+ } from "../chunk-5RTXZVCW.mjs";
5
5
  import "../chunk-QQ4A6DLD.mjs";
6
6
  export default require_utils();
@@ -22,18 +22,18 @@ const node_https_1 = __importDefault(require("node:https"));
22
22
  */
23
23
  function isGitHubTokenValid(token) {
24
24
  return __awaiter(this, void 0, void 0, function* () {
25
- if (!token || typeof token !== "string") {
25
+ if (!token || typeof token !== 'string') {
26
26
  return false;
27
27
  }
28
28
  return new Promise((resolve) => {
29
29
  const req = node_https_1.default.request({
30
- hostname: "api.github.com",
31
- path: "/user",
32
- method: "GET",
30
+ hostname: 'api.github.com',
31
+ path: '/user',
32
+ method: 'GET',
33
33
  headers: {
34
34
  Authorization: `Bearer ${token}`,
35
- "User-Agent": "github-token-validator",
36
- Accept: "application/vnd.github+json"
35
+ 'User-Agent': 'github-token-validator',
36
+ Accept: 'application/vnd.github+json'
37
37
  }
38
38
  }, (res) => {
39
39
  // 200 = valid token
@@ -41,7 +41,7 @@ function isGitHubTokenValid(token) {
41
41
  // consume response to avoid memory leak
42
42
  res.resume();
43
43
  });
44
- req.on("error", () => resolve(false));
44
+ req.on('error', () => resolve(false));
45
45
  req.end();
46
46
  });
47
47
  });
@@ -2,6 +2,10 @@ var __defProp = Object.defineProperty;
2
2
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
3
  var __getOwnPropNames = Object.getOwnPropertyNames;
4
4
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
5
9
  var __copyProps = (to, from, except, desc) => {
6
10
  if (from && typeof from === "object" || typeof from === "function") {
7
11
  for (let key of __getOwnPropNames(from))
@@ -12,6 +16,16 @@ var __copyProps = (to, from, except, desc) => {
12
16
  };
13
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
18
 
15
- // src/ps/index.d.ts
16
- var index_d_exports = {};
17
- module.exports = __toCommonJS(index_d_exports);
19
+ // src/utils/isWindows.js
20
+ var isWindows_exports = {};
21
+ __export(isWindows_exports, {
22
+ isWindows: () => isWindows
23
+ });
24
+ module.exports = __toCommonJS(isWindows_exports);
25
+ function isWindows() {
26
+ return process.platform === "win32" || /^(msys|cygwin)$/.test(process.env.OSTYPE || "");
27
+ }
28
+ // Annotate the CommonJS export names for ESM import in node:
29
+ 0 && (module.exports = {
30
+ isWindows
31
+ });
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Determines if the current platform is Windows
3
+ * @returns {boolean} true if running on Windows, false otherwise
4
+ */
5
+ export function isWindows(): boolean;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWindows = isWindows;
4
+ /**
5
+ * Determines if the current platform is Windows
6
+ * @returns {boolean} true if running on Windows, false otherwise
7
+ */
8
+ function isWindows() {
9
+ return process.platform === 'win32' || /^(msys|cygwin)$/.test(process.env.OSTYPE || '');
10
+ }
@@ -0,0 +1,8 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import {
3
+ isWindows
4
+ } from "../chunk-XPJGCDOD.mjs";
5
+ import "../chunk-QQ4A6DLD.mjs";
6
+ export {
7
+ isWindows
8
+ };
@@ -0,0 +1,53 @@
1
+ // src/utils/runBash.cjs
2
+ var { spawn } = require("child_process");
3
+ var fs = require("fs");
4
+ var path = require("path");
5
+ function runBash(file, options = {}) {
6
+ return new Promise((resolve, reject) => {
7
+ const env = { ...process.env, ...options.env || {} };
8
+ if (options.env) delete options.env;
9
+ const isWindows = process.platform === "win32";
10
+ if (isWindows) {
11
+ const candidates = [
12
+ "C:\\Program Files\\Git\\bin",
13
+ "C:\\Program Files\\Git\\usr\\bin",
14
+ "C:\\laragon\\bin\\git\\bin",
15
+ path.join(process.cwd(), "node_modules", ".bin"),
16
+ path.join(process.cwd(), "vendor", "bin"),
17
+ path.join(process.cwd(), "bin"),
18
+ path.join(process.cwd(), "venv", "Scripts"),
19
+ path.join(process.cwd(), ".venv", "Scripts")
20
+ ].filter((dir) => fs.existsSync(dir));
21
+ if (candidates.length > 0) {
22
+ env.PATH = `${candidates.join(";")};${env.PATH}`;
23
+ } else {
24
+ return reject(
25
+ new Error("No suitable bash found on Windows. Please install Git Bash or WSL and ensure it's in your PATH.")
26
+ );
27
+ }
28
+ }
29
+ const proc = spawn("bash", [file], {
30
+ shell: true,
31
+ env,
32
+ ...options
33
+ });
34
+ let stdout = "";
35
+ let stderr = "";
36
+ proc.stdout.on("data", (data) => {
37
+ stdout += data.toString();
38
+ });
39
+ proc.stderr.on("data", (data) => {
40
+ stderr += data.toString();
41
+ });
42
+ proc.on("error", (err) => {
43
+ reject(err);
44
+ });
45
+ proc.on("close", (code) => {
46
+ const result = { code, stdout, stderr };
47
+ if (code === 0) return resolve(result);
48
+ return reject(result);
49
+ });
50
+ });
51
+ }
52
+ module.exports = { runBash };
53
+ module.exports.default = runBash;
@@ -0,0 +1,12 @@
1
+ export default runBash;
2
+ /**
3
+ * Run a bash script using spawn
4
+ * @param {string} file - path to bash file
5
+ * @param {import("child_process").SpawnOptions} options
6
+ * @returns {Promise<{code: number, stdout: string, stderr: string}>}
7
+ */
8
+ export function runBash(file: string, options?: import("child_process").SpawnOptions): Promise<{
9
+ code: number;
10
+ stdout: string;
11
+ stderr: string;
12
+ }>;
@@ -0,0 +1,66 @@
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/runBash.cjs
9
+ var require_runBash = __commonJS({
10
+ "src/utils/runBash.cjs"(exports, module) {
11
+ init_esm_shims();
12
+ var { spawn } = __require("child_process");
13
+ var fs = __require("fs");
14
+ var path = __require("path");
15
+ function runBash(file, options = {}) {
16
+ return new Promise((resolve, reject) => {
17
+ const env = { ...process.env, ...options.env || {} };
18
+ if (options.env) delete options.env;
19
+ const isWindows = process.platform === "win32";
20
+ if (isWindows) {
21
+ const candidates = [
22
+ "C:\\Program Files\\Git\\bin",
23
+ "C:\\Program Files\\Git\\usr\\bin",
24
+ "C:\\laragon\\bin\\git\\bin",
25
+ path.join(process.cwd(), "node_modules", ".bin"),
26
+ path.join(process.cwd(), "vendor", "bin"),
27
+ path.join(process.cwd(), "bin"),
28
+ path.join(process.cwd(), "venv", "Scripts"),
29
+ path.join(process.cwd(), ".venv", "Scripts")
30
+ ].filter((dir) => fs.existsSync(dir));
31
+ if (candidates.length > 0) {
32
+ env.PATH = `${candidates.join(";")};${env.PATH}`;
33
+ } else {
34
+ return reject(
35
+ new Error("No suitable bash found on Windows. Please install Git Bash or WSL and ensure it's in your PATH.")
36
+ );
37
+ }
38
+ }
39
+ const proc = spawn("bash", [file], {
40
+ shell: true,
41
+ env,
42
+ ...options
43
+ });
44
+ let stdout = "";
45
+ let stderr = "";
46
+ proc.stdout.on("data", (data) => {
47
+ stdout += data.toString();
48
+ });
49
+ proc.stderr.on("data", (data) => {
50
+ stderr += data.toString();
51
+ });
52
+ proc.on("error", (err) => {
53
+ reject(err);
54
+ });
55
+ proc.on("close", (code) => {
56
+ const result = { code, stdout, stderr };
57
+ if (code === 0) return resolve(result);
58
+ return reject(result);
59
+ });
60
+ });
61
+ }
62
+ module.exports = { runBash };
63
+ module.exports.default = runBash;
64
+ }
65
+ });
66
+ export default require_runBash();
@@ -0,0 +1,97 @@
1
+ #!/usr/bin/env node
2
+
3
+ // src/yarn-per-branch-lock-installer.cjs
4
+ var { execSync, spawnSync } = require("child_process");
5
+ var fs = require("fs-extra");
6
+ var minimist = require("minimist");
7
+ function run(cmd, opts = {}) {
8
+ var _a;
9
+ try {
10
+ return execSync(cmd, {
11
+ encoding: "utf8",
12
+ stdio: "pipe",
13
+ ...opts
14
+ }).trim();
15
+ } catch (err) {
16
+ console.error(((_a = err.stderr) == null ? void 0 : _a.toString()) || err.message);
17
+ process.exit(err.status || 1);
18
+ }
19
+ }
20
+ function getBranchName() {
21
+ return run("git rev-parse --abbrev-ref HEAD");
22
+ }
23
+ function safeBranchName(name) {
24
+ return name.replace(/[\\/]/g, "-");
25
+ }
26
+ function findYarn() {
27
+ try {
28
+ const paths = run(process.platform === "win32" ? "where yarn" : "which yarn").split(/\r?\n/).filter(Boolean);
29
+ if (process.platform === "win32") {
30
+ return paths.find((p) => /\.cmd$/i.test(p)) || paths[0] || null;
31
+ }
32
+ return paths[0] || null;
33
+ } catch {
34
+ return null;
35
+ }
36
+ }
37
+ function runYarn(yarnPath, args) {
38
+ const result = process.platform === "win32" ? spawnSync("cmd.exe", ["/d", "/s", "/c", yarnPath, ...args], {
39
+ stdio: "inherit"
40
+ }) : spawnSync(yarnPath, args, {
41
+ stdio: "inherit"
42
+ });
43
+ if (result.error) {
44
+ console.error(result.error.message);
45
+ process.exit(1);
46
+ }
47
+ process.exitCode = result.status || 0;
48
+ }
49
+ function showHelp() {
50
+ console.log(`
51
+ Usage:
52
+ yarn-lock-sync [packages...]
53
+
54
+ Options:
55
+ -h, --help Show help
56
+
57
+ Examples:
58
+ yarn-lock-sync
59
+ yarn-lock-sync lodash axios
60
+ `);
61
+ }
62
+ function main() {
63
+ const argv = minimist(process.argv.slice(2), {
64
+ boolean: ["help"],
65
+ alias: {
66
+ h: "help"
67
+ }
68
+ });
69
+ if (argv.help) {
70
+ showHelp();
71
+ return;
72
+ }
73
+ const packages = argv._;
74
+ const branch = safeBranchName(getBranchName());
75
+ const yarnLock = "yarn.lock";
76
+ const branchLock = `yarn.${branch}.lock`;
77
+ const yarnPath = findYarn();
78
+ if (!yarnPath) {
79
+ console.error("Error: Yarn not found in PATH.");
80
+ process.exit(1);
81
+ }
82
+ if (fs.existsSync(branchLock)) {
83
+ console.log(`Restoring ${branchLock} -> ${yarnLock}`);
84
+ fs.copyFileSync(branchLock, yarnLock);
85
+ } else {
86
+ console.log(`No ${branchLock} found`);
87
+ fs.removeSync(yarnLock);
88
+ }
89
+ const args = packages.length ? ["up", ...packages] : ["install"];
90
+ console.log(`Running: yarn ${args.join(" ")}`);
91
+ runYarn(yarnPath, args);
92
+ if (fs.existsSync(yarnLock)) {
93
+ console.log(`Saving ${yarnLock} -> ${branchLock}`);
94
+ fs.copyFileSync(yarnLock, branchLock);
95
+ }
96
+ }
97
+ main();
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,109 @@
1
+ #!/usr/bin/env node
2
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
3
+ import {
4
+ __commonJS,
5
+ __require,
6
+ init_esm_shims
7
+ } from "./chunk-QQ4A6DLD.mjs";
8
+
9
+ // src/yarn-per-branch-lock-installer.cjs
10
+ var require_yarn_per_branch_lock_installer = __commonJS({
11
+ "src/yarn-per-branch-lock-installer.cjs"() {
12
+ init_esm_shims();
13
+ var { execSync, spawnSync } = __require("child_process");
14
+ var fs = __require("fs-extra");
15
+ var minimist = __require("minimist");
16
+ function run(cmd, opts = {}) {
17
+ var _a;
18
+ try {
19
+ return execSync(cmd, {
20
+ encoding: "utf8",
21
+ stdio: "pipe",
22
+ ...opts
23
+ }).trim();
24
+ } catch (err) {
25
+ console.error(((_a = err.stderr) == null ? void 0 : _a.toString()) || err.message);
26
+ process.exit(err.status || 1);
27
+ }
28
+ }
29
+ function getBranchName() {
30
+ return run("git rev-parse --abbrev-ref HEAD");
31
+ }
32
+ function safeBranchName(name) {
33
+ return name.replace(/[\\/]/g, "-");
34
+ }
35
+ function findYarn() {
36
+ try {
37
+ const paths = run(process.platform === "win32" ? "where yarn" : "which yarn").split(/\r?\n/).filter(Boolean);
38
+ if (process.platform === "win32") {
39
+ return paths.find((p) => /\.cmd$/i.test(p)) || paths[0] || null;
40
+ }
41
+ return paths[0] || null;
42
+ } catch {
43
+ return null;
44
+ }
45
+ }
46
+ function runYarn(yarnPath, args) {
47
+ const result = process.platform === "win32" ? spawnSync("cmd.exe", ["/d", "/s", "/c", yarnPath, ...args], {
48
+ stdio: "inherit"
49
+ }) : spawnSync(yarnPath, args, {
50
+ stdio: "inherit"
51
+ });
52
+ if (result.error) {
53
+ console.error(result.error.message);
54
+ process.exit(1);
55
+ }
56
+ process.exitCode = result.status || 0;
57
+ }
58
+ function showHelp() {
59
+ console.log(`
60
+ Usage:
61
+ yarn-lock-sync [packages...]
62
+
63
+ Options:
64
+ -h, --help Show help
65
+
66
+ Examples:
67
+ yarn-lock-sync
68
+ yarn-lock-sync lodash axios
69
+ `);
70
+ }
71
+ function main() {
72
+ const argv = minimist(process.argv.slice(2), {
73
+ boolean: ["help"],
74
+ alias: {
75
+ h: "help"
76
+ }
77
+ });
78
+ if (argv.help) {
79
+ showHelp();
80
+ return;
81
+ }
82
+ const packages = argv._;
83
+ const branch = safeBranchName(getBranchName());
84
+ const yarnLock = "yarn.lock";
85
+ const branchLock = `yarn.${branch}.lock`;
86
+ const yarnPath = findYarn();
87
+ if (!yarnPath) {
88
+ console.error("Error: Yarn not found in PATH.");
89
+ process.exit(1);
90
+ }
91
+ if (fs.existsSync(branchLock)) {
92
+ console.log(`Restoring ${branchLock} -> ${yarnLock}`);
93
+ fs.copyFileSync(branchLock, yarnLock);
94
+ } else {
95
+ console.log(`No ${branchLock} found`);
96
+ fs.removeSync(yarnLock);
97
+ }
98
+ const args = packages.length ? ["up", ...packages] : ["install"];
99
+ console.log(`Running: yarn ${args.join(" ")}`);
100
+ runYarn(yarnPath, args);
101
+ if (fs.existsSync(yarnLock)) {
102
+ console.log(`Saving ${yarnLock} -> ${branchLock}`);
103
+ fs.copyFileSync(yarnLock, branchLock);
104
+ }
105
+ }
106
+ main();
107
+ }
108
+ });
109
+ export default require_yarn_per_branch_lock_installer();
@@ -88,7 +88,7 @@ var require_utils = __commonJS({
88
88
  try {
89
89
  fs.rmdirSync(fullPath);
90
90
  console.log("deleted", fullPath);
91
- } catch (e) {
91
+ } catch (_e) {
92
92
  try {
93
93
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
94
94
  console.log("deleted", fullPath);
@@ -101,7 +101,7 @@ var require_utils = __commonJS({
101
101
  try {
102
102
  fs.unlinkSync(fullPath);
103
103
  console.log("deleted", fullPath);
104
- } catch (e) {
104
+ } catch (_e) {
105
105
  try {
106
106
  fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
107
107
  console.log("deleted", fullPath);
@@ -1,7 +1,7 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
2
  import {
3
3
  require_utils
4
- } from "./chunk-Z6JLYU2J.mjs";
4
+ } from "./chunk-5RTXZVCW.mjs";
5
5
  import {
6
6
  __commonJS,
7
7
  __require,