binary-collections 2.0.11 → 2.0.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.opencode/package.json +5 -0
- package/binaries/rmx +15 -1
- package/binaries/rmx.cmd +12 -0
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +178 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +110 -0
- package/binaries/yc.cjs +178 -0
- package/lib/binary-collections/config.cjs +126 -0
- package/lib/binary-collections/config.mjs +7 -0
- package/lib/binary-collections/executeScript.cjs +19 -0
- package/lib/binary-collections/executeScript.d.cts +12 -0
- package/lib/binary-collections/executeScript.mjs +6 -0
- package/lib/binary-collections/findScript.cjs +284 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +266 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +224 -137
- package/lib/binary-collections.mjs +22 -282
- package/lib/changelog.cjs +2 -2
- package/lib/changelog.mjs +1 -1
- package/lib/{chunk-AJDD5DZM.mjs → chunk-2LSRSEXF.mjs} +1 -1
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-5RTXZVCW.mjs} +2 -2
- package/lib/{chunk-XA3SNBPA.mjs → chunk-66KDU4TX.mjs} +93 -9
- package/lib/chunk-6PU7BAHB.mjs +61 -0
- package/lib/chunk-C6D2TTYU.mjs +32 -0
- package/lib/chunk-FB2WKVJD.mjs +158 -0
- package/lib/{chunk-NCXAP7AA.mjs → chunk-G5UUEWUO.mjs} +9 -5
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-NCZPTKDV.mjs +79 -0
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OGXVGBRI.mjs +29 -0
- package/lib/chunk-OXV52GD5.mjs +62 -0
- package/lib/chunk-PXBMHE7O.mjs +35 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-SPTECFE5.mjs +180 -0
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/chunk-V2IBPCEV.mjs +39 -0
- package/lib/chunk-XPJGCDOD.mjs +14 -0
- package/lib/chunk-ZOWVMII3.mjs +228 -0
- package/lib/clean-github-actions-caches-cli.cjs +465 -0
- package/lib/clean-github-actions-caches-cli.d.cts +1 -0
- package/lib/clean-github-actions-caches-cli.mjs +56 -0
- package/lib/clean-github-actions-caches.cjs +149 -205
- package/lib/clean-github-actions-caches.d.cts +15 -1
- package/lib/clean-github-actions-caches.mjs +4 -130
- package/lib/cross-env/command.cjs +63 -0
- package/lib/cross-env/command.d.ts +8 -0
- package/lib/cross-env/command.js +45 -0
- package/lib/cross-env/command.mjs +9 -0
- package/lib/cross-env/index.cjs +178 -0
- package/lib/cross-env/index.d.ts +8 -0
- package/lib/cross-env/index.js +102 -0
- package/lib/cross-env/index.mjs +101 -0
- package/lib/cross-env/variable.cjs +60 -0
- package/lib/cross-env/variable.d.ts +7 -0
- package/lib/cross-env/variable.js +59 -0
- package/lib/cross-env/variable.mjs +9 -0
- package/lib/del-gradle.cjs +2 -2
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.js +24 -24
- package/lib/del-ps.cjs +2 -2
- package/lib/del-ps.js +8 -8
- package/lib/del-ps.mjs +1 -1
- package/lib/del-yarn-caches.cjs +2 -2
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/file/copy-cli.cjs +92 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +55 -0
- package/lib/file/copy.cjs +56 -0
- package/lib/file/copy.d.mts +1 -0
- package/lib/file/copy.mjs +8 -0
- package/lib/file/move-cli.cjs +91 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +55 -0
- package/lib/file/move.cjs +55 -0
- package/lib/file/move.d.mts +1 -0
- package/lib/file/move.mjs +8 -0
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/free-chatgpt.cjs +21 -15
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +2 -2
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +188 -42
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +188 -42
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +91 -34
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +2 -2
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +2 -2
- package/lib/git-purge.mjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/kill-night-crows.cjs +7 -7
- package/lib/kill-night-crows.mjs +7 -7
- package/lib/node-cache-cleaner/npm.cjs +65 -0
- package/lib/node-cache-cleaner/npm.d.ts +2 -0
- package/lib/node-cache-cleaner/npm.js +41 -0
- package/lib/node-cache-cleaner/npm.mjs +10 -0
- package/lib/node-cache-cleaner/npx.cjs +89 -0
- package/lib/node-cache-cleaner/npx.d.ts +4 -0
- package/lib/node-cache-cleaner/npx.js +82 -0
- package/lib/{ps/index.d.mjs → node-cache-cleaner/npx.mjs} +6 -5
- package/lib/node-cache-cleaner/yarn.cjs +73 -0
- package/lib/node-cache-cleaner/yarn.d.ts +2 -0
- package/lib/node-cache-cleaner/yarn.js +62 -0
- package/lib/node-cache-cleaner/yarn.mjs +10 -0
- package/lib/node-cache-cleaner-cli.cjs +182 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +60 -0
- package/lib/node-cache-cleaner-cli.mjs +56 -0
- package/lib/node-executor.cjs +91 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +103 -0
- package/lib/npm-run-series.cjs +21 -28
- package/lib/npm-run-series.mjs +20 -6
- package/lib/package-resolutions-updater-cli.cjs +213 -128
- package/lib/package-resolutions-updater-cli.mjs +17 -39
- package/lib/package-resolutions-updater.cjs +204 -98
- package/lib/package-resolutions-updater.d.mts +20 -1
- package/lib/package-resolutions-updater.mjs +7 -5
- package/lib/print-directory-tree.cjs +2 -2
- package/lib/print-directory-tree.mjs +1 -1
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +1 -1
- package/lib/ps/index.mjs +177 -171
- package/lib/ps/isWin.js +1 -1
- package/lib/ps/table-parser.js +6 -6
- package/lib/remove-module.cjs +2 -2
- package/lib/remove-module.mjs +1 -1
- package/lib/rm-node-module-cli.cjs +222 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +89 -0
- package/lib/rm-node-modules.cjs +127 -0
- package/lib/rm-node-modules.d.cts +35 -0
- package/lib/{binary-collections-config.mjs → rm-node-modules.mjs} +3 -3
- package/lib/rmpath.cjs +2 -2
- package/lib/rmpath.mjs +1 -1
- package/lib/submodule-install.cjs +47 -34
- package/lib/submodule-install.mjs +46 -33
- package/lib/submodule-remove-cli.cjs +1 -2
- package/lib/submodule-remove-cli.js +3 -3
- package/lib/submodule-remove-cli.mjs +1 -2
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/findEnvFiles.cjs +28 -46
- package/lib/utils/findEnvFiles.d.cts +19 -0
- package/lib/utils/findEnvFiles.mjs +3 -5
- package/lib/utils/findWorkspaceRoot.js +4 -4
- package/lib/utils/index.cjs +2 -2
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/index.d.cjs → utils/isWindows.cjs} +17 -3
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +8 -0
- package/lib/utils/runBash.cjs +53 -0
- package/lib/utils/runBash.d.cts +12 -0
- package/lib/utils/runBash.mjs +66 -0
- package/lib/yarn-per-branch-lock-installer.cjs +97 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +109 -0
- package/lib/yarn-reinstall.cjs +2 -2
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +61 -52
- package/readme.html +784 -0
- package/readme.md +106 -218
- package/releases/readme.md +1 -1
- package/test/README.md +2 -2
- package/test-project/package.json +8 -2
- package/test-project/workspaces/workspace-a/package.json +135 -0
- package/test-project/workspaces/workspace-a/readme.md +20 -0
- package/test-project/workspaces/workspace-a/release/readme.md +42 -0
- package/test-project/workspaces/workspace-a/test/demo/package.json +25 -0
- package/test-project/workspaces/workspace-a/test/readme.md +12 -0
- package/test-project/workspaces/workspace-b/package.json +139 -0
- package/test-project/workspaces/workspace-b/readme.md +94 -0
- package/test-project/workspaces/workspace-b/requirements.txt +1 -0
- package/test-project/workspaces/workspace-b/test/sample-project/package.json +7 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/package.json +96 -0
- package/test-project/workspaces/workspace-b/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/rm-node-modules-test-project/package.json +17 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-a/package.json +16 -0
- package/tmp/rm-node-modules-test-project/packages/workspace-b/package.json +16 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo/package.json +13 -3
- package/docs-src/clean-github-actions-caches.md +0 -26
- package/docs-src/free-chatgpt.md +0 -26
- package/lib/binary-collections-config.cjs +0 -15
- package/lib/chunk-2CBJCW7E.mjs +0 -81
- package/lib/chunk-4UHL4WVN.mjs +0 -136
- package/lib/chunk-66PAU5PS.mjs +0 -31
- package/lib/chunk-6HHJRKFB.mjs +0 -59
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-FCDQGYBF.mjs +0 -136
- package/lib/chunk-GEYA2USY.mjs +0 -207
- package/lib/chunk-GJTGHXRA.mjs +0 -356
- package/lib/chunk-ID2WBTE2.mjs +0 -80
- package/lib/chunk-JXFOHKDM.mjs +0 -239
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- package/lib/chunk-RWLXRTYP.mjs +0 -109
- package/lib/chunk-TOIVAQF7.mjs +0 -136
- package/lib/chunk-V5SKYJUB.mjs +0 -136
- package/lib/chunk-WSRETQCA.mjs +0 -59
- package/lib/chunk-YYLIQQKF.mjs +0 -31
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
package/lib/chunk-ID2WBTE2.mjs
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
init_esm_shims
|
|
4
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
5
|
-
|
|
6
|
-
// src/utils/findEnvFiles.js
|
|
7
|
-
init_esm_shims();
|
|
8
|
-
import fs from "fs";
|
|
9
|
-
import path from "path";
|
|
10
|
-
import * as glob from "glob";
|
|
11
|
-
var DEFAULT_IGNORES = [
|
|
12
|
-
"**/node_modules/**",
|
|
13
|
-
"**/.git/**",
|
|
14
|
-
"**/.yarn/**",
|
|
15
|
-
"**/.pnpm/**",
|
|
16
|
-
"**/dist/**",
|
|
17
|
-
"**/build/**",
|
|
18
|
-
"**/coverage/**",
|
|
19
|
-
"**/vendor/**",
|
|
20
|
-
"**/tmp/**",
|
|
21
|
-
"**/.cache/**",
|
|
22
|
-
"**/assets/**",
|
|
23
|
-
"**/logs/**",
|
|
24
|
-
"**/output/**",
|
|
25
|
-
"**/public/**",
|
|
26
|
-
"**/static/**",
|
|
27
|
-
"**/temp/**",
|
|
28
|
-
"**/backup/**",
|
|
29
|
-
"**/backups/**",
|
|
30
|
-
"**/examples/**",
|
|
31
|
-
"**/docs/**",
|
|
32
|
-
"**/tests/**",
|
|
33
|
-
"**/__tests__/**",
|
|
34
|
-
"**/spec/**",
|
|
35
|
-
"**/__specs__/**",
|
|
36
|
-
"**/scripts/**",
|
|
37
|
-
"**/bin/**",
|
|
38
|
-
"**/hooks/**",
|
|
39
|
-
"**/config/**",
|
|
40
|
-
"**/configs/**",
|
|
41
|
-
"**/settings/**",
|
|
42
|
-
"**/.vscode/**",
|
|
43
|
-
"**/.idea/**"
|
|
44
|
-
];
|
|
45
|
-
function findEnvFiles(startDir = process.cwd(), filter) {
|
|
46
|
-
const found = /* @__PURE__ */ new Set();
|
|
47
|
-
function addFile(file) {
|
|
48
|
-
const normalized = path.normalize(file);
|
|
49
|
-
if (typeof filter === "function" && !filter(normalized)) {
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
found.add(normalized);
|
|
53
|
-
}
|
|
54
|
-
let current = path.resolve(startDir);
|
|
55
|
-
while (true) {
|
|
56
|
-
const envPath = path.join(current, ".env");
|
|
57
|
-
if (fs.existsSync(envPath)) {
|
|
58
|
-
addFile(envPath);
|
|
59
|
-
}
|
|
60
|
-
const parent = path.dirname(current);
|
|
61
|
-
if (parent === current) {
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
current = parent;
|
|
65
|
-
}
|
|
66
|
-
const files = glob.globSync("**/.env*", {
|
|
67
|
-
cwd: startDir,
|
|
68
|
-
absolute: true,
|
|
69
|
-
nodir: true,
|
|
70
|
-
ignore: DEFAULT_IGNORES
|
|
71
|
-
});
|
|
72
|
-
for (const file of files) {
|
|
73
|
-
addFile(file);
|
|
74
|
-
}
|
|
75
|
-
return [...found];
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
export {
|
|
79
|
-
findEnvFiles
|
|
80
|
-
};
|
package/lib/chunk-JXFOHKDM.mjs
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
findEnvFiles
|
|
4
|
-
} from "./chunk-ID2WBTE2.mjs";
|
|
5
|
-
import {
|
|
6
|
-
require_utils
|
|
7
|
-
} from "./chunk-Z6JLYU2J.mjs";
|
|
8
|
-
import {
|
|
9
|
-
__toESM,
|
|
10
|
-
init_esm_shims
|
|
11
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
12
|
-
|
|
13
|
-
// src/package-resolutions-updater.mjs
|
|
14
|
-
init_esm_shims();
|
|
15
|
-
var utils = __toESM(require_utils(), 1);
|
|
16
|
-
import * as dotenv from "dotenv";
|
|
17
|
-
import fs from "fs";
|
|
18
|
-
import https from "https";
|
|
19
|
-
import os from "os";
|
|
20
|
-
import path from "path";
|
|
21
|
-
var projectDir = process.cwd();
|
|
22
|
-
var envPath = path.join(projectDir, ".env");
|
|
23
|
-
var args = utils.getArgs();
|
|
24
|
-
if (!fs.existsSync(envPath)) {
|
|
25
|
-
const envFiles = findEnvFiles(projectDir, (file) => {
|
|
26
|
-
const content = fs.readFileSync(file, "utf-8");
|
|
27
|
-
return /GITHUB_TOKEN|ACCESS_TOKEN/.test(content);
|
|
28
|
-
});
|
|
29
|
-
if (envFiles.length > 0) {
|
|
30
|
-
envPath = envFiles[0];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (fs.existsSync(envPath)) {
|
|
34
|
-
dotenv.config({ path: envPath, quiet: true, override: true });
|
|
35
|
-
}
|
|
36
|
-
var ACCESS_TOKEN = process.env.GITHUB_TOKEN || process.env.ACCESS_TOKEN;
|
|
37
|
-
if (args.help || args.h) {
|
|
38
|
-
showHelp();
|
|
39
|
-
}
|
|
40
|
-
function showHelp() {
|
|
41
|
-
const helpText = `
|
|
42
|
-
GitHub Package Resolutions Updater
|
|
43
|
-
Usage:
|
|
44
|
-
node src/package-resolutions-updater.mjs [options]
|
|
45
|
-
Options:
|
|
46
|
-
--help, -h Show this help message
|
|
47
|
-
Description:
|
|
48
|
-
Updates the commit hashes in package.json's 'resolutions' field for GitHub tarball URLs to point to the latest commit SHA of the corresponding repository and branch.
|
|
49
|
-
Features:
|
|
50
|
-
- Parses GitHub URLs to extract repository owner, name, and branch.
|
|
51
|
-
- Fetches the latest commit SHA across all branches using GitHub's API.
|
|
52
|
-
- Replaces the old branch or commit in the URL with the latest SHA.
|
|
53
|
-
- Overwrites package.json with the updated URLs.
|
|
54
|
-
Requirements:
|
|
55
|
-
- GitHub Personal Access Token (GITHUB_TOKEN) via .env
|
|
56
|
-
- ESM support (type: "module" in package.json)
|
|
57
|
-
- Node.js v18+ recommended
|
|
58
|
-
Dependencies:
|
|
59
|
-
- ansi-colors \u2013 for styled terminal output
|
|
60
|
-
- dotenv \u2013 to load GitHub token from .env
|
|
61
|
-
Examples:
|
|
62
|
-
node src/package-resolutions-updater.mjs
|
|
63
|
-
node src/package-resolutions-updater.mjs --help
|
|
64
|
-
|
|
65
|
-
`;
|
|
66
|
-
console.log(helpText);
|
|
67
|
-
process.exit(0);
|
|
68
|
-
}
|
|
69
|
-
var GITHUB_USER_AGENTS = [
|
|
70
|
-
"octokit-rest.js/19.0.7",
|
|
71
|
-
"GitHub CLI/2.40.0",
|
|
72
|
-
"Mozilla/5.0 (compatible; GitHubCopilot/1.0)",
|
|
73
|
-
"PostmanRuntime/7.32.3",
|
|
74
|
-
"binary-collections-resolver/1.0 (+https://github.com/dimaslanjaka/bin)"
|
|
75
|
-
];
|
|
76
|
-
var userAgentDir = path.join(os.tmpdir(), "nodejs");
|
|
77
|
-
var userAgentFile = path.join(userAgentDir, "useragent.txt");
|
|
78
|
-
var selectedUserAgent;
|
|
79
|
-
try {
|
|
80
|
-
if (!fs.existsSync(userAgentDir)) fs.mkdirSync(userAgentDir, { recursive: true });
|
|
81
|
-
if (fs.existsSync(userAgentFile)) {
|
|
82
|
-
const fileAgent = fs.readFileSync(userAgentFile, "utf-8").trim();
|
|
83
|
-
if (GITHUB_USER_AGENTS.includes(fileAgent)) {
|
|
84
|
-
selectedUserAgent = fileAgent;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (!selectedUserAgent) {
|
|
88
|
-
selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
|
|
89
|
-
fs.writeFileSync(userAgentFile, selectedUserAgent, "utf-8");
|
|
90
|
-
}
|
|
91
|
-
} catch (_e) {
|
|
92
|
-
selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
|
|
93
|
-
}
|
|
94
|
-
function fetchJson(url) {
|
|
95
|
-
const headers = {
|
|
96
|
-
"User-Agent": selectedUserAgent,
|
|
97
|
-
Accept: "application/vnd.github.v3+json",
|
|
98
|
-
"X-GitHub-Api-Version": "2022-11-28",
|
|
99
|
-
...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
|
|
100
|
-
};
|
|
101
|
-
return new Promise((resolve, reject) => {
|
|
102
|
-
https.get(url, { headers }, (res) => {
|
|
103
|
-
let data = "";
|
|
104
|
-
res.on("data", (chunk) => data += chunk);
|
|
105
|
-
res.on("end", () => {
|
|
106
|
-
try {
|
|
107
|
-
const json = JSON.parse(data);
|
|
108
|
-
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
109
|
-
return reject(
|
|
110
|
-
new Error(`GitHub API Error ${res.statusCode}: ${json.message || "Unknown error"}
|
|
111
|
-
URL: ${url}`)
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
resolve(json);
|
|
115
|
-
} catch {
|
|
116
|
-
reject(new Error(`Invalid JSON from: ${url}`));
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
}).on("error", reject);
|
|
120
|
-
});
|
|
121
|
-
}
|
|
122
|
-
async function getLatestCommit(owner, repo, branch = "main") {
|
|
123
|
-
var _a, _b, _c, _d;
|
|
124
|
-
const url = `https://api.github.com/repos/${owner}/${repo}/commits/${branch}`;
|
|
125
|
-
const json = await fetchJson(url);
|
|
126
|
-
const sha = json.sha;
|
|
127
|
-
const dateStr = ((_b = (_a = json.commit) == null ? void 0 : _a.committer) == null ? void 0 : _b.date) || ((_d = (_c = json.commit) == null ? void 0 : _c.author) == null ? void 0 : _d.date);
|
|
128
|
-
if (!sha || !dateStr) {
|
|
129
|
-
console.log(json);
|
|
130
|
-
throw new Error(`Missing SHA or date for ${owner}/${repo}@${branch}`);
|
|
131
|
-
}
|
|
132
|
-
return {
|
|
133
|
-
owner,
|
|
134
|
-
repo,
|
|
135
|
-
branch,
|
|
136
|
-
sha,
|
|
137
|
-
date: new Date(dateStr).toISOString()
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
async function getLatestCommitAcrossBranches(owner, repo) {
|
|
141
|
-
const branches = await fetchJson(`https://api.github.com/repos/${owner}/${repo}/branches`);
|
|
142
|
-
const commits = await Promise.all(
|
|
143
|
-
branches.map(async ({ name, commit }) => {
|
|
144
|
-
var _a, _b, _c, _d;
|
|
145
|
-
const commitSha = commit == null ? void 0 : commit.sha;
|
|
146
|
-
if (!commitSha) {
|
|
147
|
-
console.warn(`No commit SHA for '${owner}/${repo}' branch: ${name}`);
|
|
148
|
-
return { branch: name, sha: "", date: /* @__PURE__ */ new Date(0) };
|
|
149
|
-
}
|
|
150
|
-
try {
|
|
151
|
-
const commitData = await fetchJson(`https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}`);
|
|
152
|
-
const dateStr = ((_b = (_a = commitData.commit) == null ? void 0 : _a.committer) == null ? void 0 : _b.date) || ((_d = (_c = commitData.commit) == null ? void 0 : _c.author) == null ? void 0 : _d.date);
|
|
153
|
-
const date = dateStr ? new Date(dateStr) : /* @__PURE__ */ new Date(0);
|
|
154
|
-
return { branch: name, sha: commitData.sha, date };
|
|
155
|
-
} catch (e) {
|
|
156
|
-
console.warn(`Failed to fetch commit for ${name}: ${e.message}`);
|
|
157
|
-
return { branch: name, sha: commitSha, date: /* @__PURE__ */ new Date(0) };
|
|
158
|
-
}
|
|
159
|
-
})
|
|
160
|
-
);
|
|
161
|
-
const latest = commits.reduce((a, b) => a.date > b.date ? a : b, { date: /* @__PURE__ */ new Date(0) });
|
|
162
|
-
return {
|
|
163
|
-
owner,
|
|
164
|
-
repo,
|
|
165
|
-
branch: latest.branch,
|
|
166
|
-
sha: latest.sha,
|
|
167
|
-
date: latest.date.toISOString()
|
|
168
|
-
};
|
|
169
|
-
}
|
|
170
|
-
function replaceRawWithLatestHash(url, latestHash) {
|
|
171
|
-
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/([^/]+)\/(.+)$/);
|
|
172
|
-
if (!match) throw new Error("Invalid GitHub raw URL");
|
|
173
|
-
const [, owner, repo, _oldHash, path2] = match;
|
|
174
|
-
return `https://github.com/${owner}/${repo}/raw/${latestHash}/${path2}`;
|
|
175
|
-
}
|
|
176
|
-
function splitGitHubRefPath(refPath) {
|
|
177
|
-
const segments = refPath.split("/").filter(Boolean);
|
|
178
|
-
if (segments.length === 0) {
|
|
179
|
-
return { branch: "", remainder: null };
|
|
180
|
-
}
|
|
181
|
-
if (segments[0] === "refs" && segments[1] === "heads" && segments.length >= 3) {
|
|
182
|
-
return {
|
|
183
|
-
branch: segments[2],
|
|
184
|
-
remainder: segments.slice(3).join("/") || null
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
let branchSegmentCount = 1;
|
|
188
|
-
if (segments[0] === "refs") {
|
|
189
|
-
if ((segments[1] === "tags" || segments[1] === "remotes" || segments[1] === "pull") && segments.length >= 3) {
|
|
190
|
-
branchSegmentCount = segments[1] === "tags" ? 3 : 4;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
const branch = segments.slice(0, branchSegmentCount).join("/");
|
|
194
|
-
const remainder = segments.slice(branchSegmentCount).join("/");
|
|
195
|
-
return {
|
|
196
|
-
branch,
|
|
197
|
-
remainder: remainder || null
|
|
198
|
-
};
|
|
199
|
-
}
|
|
200
|
-
function parseGitHubUrl(url) {
|
|
201
|
-
const ghRepoRoot = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/?$/;
|
|
202
|
-
const ghTreeOrBlob = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/(tree|blob)\/([^/]+(?:\/[^/]+)*)/;
|
|
203
|
-
const ghRaw = /^https:\/\/raw\.githubusercontent\.com\/([^/]+)\/([^/]+)\/(.+)$/;
|
|
204
|
-
const ghDotComRaw = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/(.+)$/;
|
|
205
|
-
let match;
|
|
206
|
-
if (match = url.match(ghRaw)) {
|
|
207
|
-
const [, owner, repo, rawPath] = match;
|
|
208
|
-
const { branch, remainder } = splitGitHubRefPath(rawPath);
|
|
209
|
-
return {
|
|
210
|
-
owner,
|
|
211
|
-
repo,
|
|
212
|
-
branch,
|
|
213
|
-
url: `https://raw.githubusercontent.com/${owner}/${repo}/${branch}${remainder ? `/${remainder}` : ""}`
|
|
214
|
-
};
|
|
215
|
-
}
|
|
216
|
-
if (match = url.match(ghDotComRaw)) {
|
|
217
|
-
const [, owner, repo, rawPath] = match;
|
|
218
|
-
const { branch } = splitGitHubRefPath(rawPath);
|
|
219
|
-
return { owner, repo, branch, url };
|
|
220
|
-
}
|
|
221
|
-
if (match = url.match(ghTreeOrBlob)) {
|
|
222
|
-
const [, owner, repo, , branchPath] = match;
|
|
223
|
-
const { branch } = splitGitHubRefPath(branchPath);
|
|
224
|
-
return { owner, repo, branch, url };
|
|
225
|
-
}
|
|
226
|
-
if (match = url.match(ghRepoRoot)) {
|
|
227
|
-
const [, owner, repo] = match;
|
|
228
|
-
return { owner, repo, url };
|
|
229
|
-
}
|
|
230
|
-
throw new Error(`Unsupported GitHub URL: ${url}`);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
export {
|
|
234
|
-
fetchJson,
|
|
235
|
-
getLatestCommit,
|
|
236
|
-
getLatestCommitAcrossBranches,
|
|
237
|
-
replaceRawWithLatestHash,
|
|
238
|
-
parseGitHubUrl
|
|
239
|
-
};
|
package/lib/chunk-PDSXF5HY.mjs
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
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/git/gitattributes.cjs
|
|
9
|
-
var require_gitattributes = __commonJS({
|
|
10
|
-
"src/git/gitattributes.cjs"(exports, module) {
|
|
11
|
-
init_esm_shims();
|
|
12
|
-
var fs = __require("fs");
|
|
13
|
-
function parseGitAttributes(gitattributesPath) {
|
|
14
|
-
const rules = [];
|
|
15
|
-
if (!fs.existsSync(gitattributesPath)) {
|
|
16
|
-
return rules;
|
|
17
|
-
}
|
|
18
|
-
const content = fs.readFileSync(gitattributesPath, "utf8");
|
|
19
|
-
const lines = content.split("\n");
|
|
20
|
-
lines.forEach((line, index) => {
|
|
21
|
-
const trimmedLine = line.trim();
|
|
22
|
-
if (!trimmedLine || trimmedLine.startsWith("#")) {
|
|
23
|
-
rules.push({
|
|
24
|
-
type: trimmedLine.startsWith("#") ? "comment" : "empty",
|
|
25
|
-
content: line,
|
|
26
|
-
lineNumber: index + 1
|
|
27
|
-
});
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const parts = trimmedLine.split(/\s+/);
|
|
31
|
-
if (parts.length >= 2) {
|
|
32
|
-
const pattern = parts[0];
|
|
33
|
-
const attributes = parts.slice(1).join(" ");
|
|
34
|
-
rules.push({
|
|
35
|
-
type: "rule",
|
|
36
|
-
pattern,
|
|
37
|
-
attributes,
|
|
38
|
-
content: line,
|
|
39
|
-
lineNumber: index + 1
|
|
40
|
-
});
|
|
41
|
-
} else {
|
|
42
|
-
rules.push({
|
|
43
|
-
type: "invalid",
|
|
44
|
-
content: line,
|
|
45
|
-
lineNumber: index + 1
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
return rules;
|
|
50
|
-
}
|
|
51
|
-
function patternsConflict(pattern1, pattern2) {
|
|
52
|
-
if (pattern1 === pattern2) {
|
|
53
|
-
return true;
|
|
54
|
-
}
|
|
55
|
-
if (pattern1 === "*" || pattern2 === "*") {
|
|
56
|
-
return pattern1 !== pattern2;
|
|
57
|
-
}
|
|
58
|
-
const normalize = (p) => p.replace(/\{[^}]+\}/g, "*").replace(/\*+/g, "*");
|
|
59
|
-
const norm1 = normalize(pattern1);
|
|
60
|
-
const norm2 = normalize(pattern2);
|
|
61
|
-
return norm1 === norm2;
|
|
62
|
-
}
|
|
63
|
-
function mergeGitAttributeRules(existingRules, desiredRules) {
|
|
64
|
-
let mergedRules;
|
|
65
|
-
if (existingRules.length === 0) {
|
|
66
|
-
mergedRules = desiredRules.map((desired, idx) => ({
|
|
67
|
-
type: "rule",
|
|
68
|
-
pattern: desired.pattern,
|
|
69
|
-
attributes: desired.attributes,
|
|
70
|
-
content: `${desired.pattern} ${desired.attributes}`,
|
|
71
|
-
lineNumber: idx + 1,
|
|
72
|
-
added: true
|
|
73
|
-
}));
|
|
74
|
-
return {
|
|
75
|
-
mergedRules,
|
|
76
|
-
conflicts: [],
|
|
77
|
-
changes: desiredRules.map((rule) => ({ action: "added", pattern: rule.pattern, attributes: rule.attributes }))
|
|
78
|
-
};
|
|
79
|
-
} else {
|
|
80
|
-
mergedRules = [...existingRules];
|
|
81
|
-
}
|
|
82
|
-
const conflicts = [];
|
|
83
|
-
const changes = [];
|
|
84
|
-
desiredRules.forEach((desired) => {
|
|
85
|
-
const existingIdx = mergedRules.findIndex((r) => r.type === "rule" && r.pattern === desired.pattern);
|
|
86
|
-
if (existingIdx !== -1) {
|
|
87
|
-
const existing = mergedRules[existingIdx];
|
|
88
|
-
if (existing.attributes === desired.attributes) {
|
|
89
|
-
conflicts.push({
|
|
90
|
-
pattern: desired.pattern,
|
|
91
|
-
existing: existing.attributes,
|
|
92
|
-
proposed: desired.attributes,
|
|
93
|
-
action: "kept existing (identical)"
|
|
94
|
-
});
|
|
95
|
-
} else if (desired.priority > (existing.priority || 0)) {
|
|
96
|
-
mergedRules[existingIdx] = {
|
|
97
|
-
type: "rule",
|
|
98
|
-
pattern: desired.pattern,
|
|
99
|
-
attributes: desired.attributes,
|
|
100
|
-
content: `${desired.pattern} ${desired.attributes}`,
|
|
101
|
-
lineNumber: existing.lineNumber,
|
|
102
|
-
replaced: true
|
|
103
|
-
};
|
|
104
|
-
conflicts.push({
|
|
105
|
-
pattern: desired.pattern,
|
|
106
|
-
existing: existing.attributes,
|
|
107
|
-
proposed: desired.attributes,
|
|
108
|
-
action: "replaced (higher priority)"
|
|
109
|
-
});
|
|
110
|
-
changes.push({
|
|
111
|
-
action: "replaced",
|
|
112
|
-
pattern: desired.pattern,
|
|
113
|
-
attributes: desired.attributes,
|
|
114
|
-
oldAttributes: existing.attributes
|
|
115
|
-
});
|
|
116
|
-
} else {
|
|
117
|
-
conflicts.push({
|
|
118
|
-
pattern: desired.pattern,
|
|
119
|
-
existing: existing.attributes,
|
|
120
|
-
proposed: desired.attributes,
|
|
121
|
-
action: "kept existing (lower priority)"
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
} else {
|
|
125
|
-
mergedRules.push({
|
|
126
|
-
type: "rule",
|
|
127
|
-
pattern: desired.pattern,
|
|
128
|
-
attributes: desired.attributes,
|
|
129
|
-
content: `${desired.pattern} ${desired.attributes}`,
|
|
130
|
-
lineNumber: mergedRules.length + 1,
|
|
131
|
-
added: true
|
|
132
|
-
});
|
|
133
|
-
changes.push({
|
|
134
|
-
action: "added",
|
|
135
|
-
pattern: desired.pattern,
|
|
136
|
-
attributes: desired.attributes
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
return { mergedRules, conflicts, changes };
|
|
141
|
-
}
|
|
142
|
-
function formatGitAttributes(rules) {
|
|
143
|
-
return rules.map((rule) => {
|
|
144
|
-
if (rule.type === "rule") {
|
|
145
|
-
return `${rule.pattern} ${rule.attributes}`;
|
|
146
|
-
}
|
|
147
|
-
return rule.content;
|
|
148
|
-
}).join("\n") + "\n";
|
|
149
|
-
}
|
|
150
|
-
function updateGitAttributes(gitattributesPath, desiredRules) {
|
|
151
|
-
try {
|
|
152
|
-
const existingRules = parseGitAttributes(gitattributesPath);
|
|
153
|
-
const { mergedRules, conflicts, changes } = mergeGitAttributeRules(existingRules, desiredRules);
|
|
154
|
-
let success = false;
|
|
155
|
-
if (changes.length > 0) {
|
|
156
|
-
const newContent = formatGitAttributes(mergedRules);
|
|
157
|
-
fs.writeFileSync(gitattributesPath, newContent);
|
|
158
|
-
success = true;
|
|
159
|
-
}
|
|
160
|
-
return {
|
|
161
|
-
success,
|
|
162
|
-
conflicts,
|
|
163
|
-
changes,
|
|
164
|
-
message: success ? `Updated .gitattributes with ${changes.length} changes` : "No changes needed - all rules already present"
|
|
165
|
-
};
|
|
166
|
-
} catch (error) {
|
|
167
|
-
return {
|
|
168
|
-
success: false,
|
|
169
|
-
error: error.message,
|
|
170
|
-
conflicts: [],
|
|
171
|
-
changes: []
|
|
172
|
-
};
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
module.exports = {
|
|
176
|
-
parseGitAttributes,
|
|
177
|
-
patternsConflict,
|
|
178
|
-
mergeGitAttributeRules,
|
|
179
|
-
formatGitAttributes,
|
|
180
|
-
updateGitAttributes
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
});
|
|
184
|
-
|
|
185
|
-
export {
|
|
186
|
-
require_gitattributes
|
|
187
|
-
};
|
package/lib/chunk-RWLXRTYP.mjs
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
require_utils as require_utils2
|
|
4
|
-
} from "./chunk-A3VUZEJK.mjs";
|
|
5
|
-
import {
|
|
6
|
-
require_utils
|
|
7
|
-
} from "./chunk-Z6JLYU2J.mjs";
|
|
8
|
-
import {
|
|
9
|
-
__commonJS,
|
|
10
|
-
__require,
|
|
11
|
-
init_esm_shims
|
|
12
|
-
} from "./chunk-QQ4A6DLD.mjs";
|
|
13
|
-
|
|
14
|
-
// src/git/user-config.cjs
|
|
15
|
-
var require_user_config = __commonJS({
|
|
16
|
-
"src/git/user-config.cjs"(exports, module) {
|
|
17
|
-
init_esm_shims();
|
|
18
|
-
var gch = __require("git-command-helper");
|
|
19
|
-
var { runGitCommand, runGitCommandOutput } = require_utils2();
|
|
20
|
-
var { getArgs } = require_utils();
|
|
21
|
-
__require("dotenv").config({ path: __require("path").join(process.cwd(), ".env") });
|
|
22
|
-
function configureGitUser(cliUser = null, cliEmail = null, options = {}) {
|
|
23
|
-
console.log("\n=== Configuring Git User ===");
|
|
24
|
-
let username, email;
|
|
25
|
-
if (cliUser && cliEmail) {
|
|
26
|
-
username = cliUser.trim();
|
|
27
|
-
email = cliEmail.trim();
|
|
28
|
-
console.log("[i] Using CLI-provided user configuration");
|
|
29
|
-
} else {
|
|
30
|
-
username = process.env.GITHUB_USER ? process.env.GITHUB_USER.trim() : void 0;
|
|
31
|
-
email = process.env.GITHUB_EMAIL ? process.env.GITHUB_EMAIL.trim() : void 0;
|
|
32
|
-
if (username || email) {
|
|
33
|
-
console.log("[i] Using environment variable user configuration");
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
if (!username && !email) {
|
|
37
|
-
console.log("[i] No Git user configuration needed (no CLI args or environment variables set)");
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (username) {
|
|
41
|
-
const success = runGitCommand(["config", "user.name", username], `Set Git username to "${username}"`);
|
|
42
|
-
if (!success) {
|
|
43
|
-
console.log("[i] Failed to set Git username, but continuing...");
|
|
44
|
-
}
|
|
45
|
-
} else {
|
|
46
|
-
console.log("[i] No username provided, skipping username configuration");
|
|
47
|
-
}
|
|
48
|
-
if (email) {
|
|
49
|
-
const success = runGitCommand(["config", "user.email", email], `Set Git email to "${email}"`);
|
|
50
|
-
if (!success) {
|
|
51
|
-
console.log("[i] Failed to set Git email, but continuing...");
|
|
52
|
-
}
|
|
53
|
-
} else {
|
|
54
|
-
console.log("[i] No email provided, skipping email configuration");
|
|
55
|
-
}
|
|
56
|
-
if (username || email) {
|
|
57
|
-
console.log("[\u2713] Git user configuration completed");
|
|
58
|
-
}
|
|
59
|
-
if (username) {
|
|
60
|
-
const remoteUrl = runGitCommandOutput(["remote", "get-url", "origin"], "Fetching remote URL for verification");
|
|
61
|
-
if (remoteUrl) {
|
|
62
|
-
console.log(`[i] Remote URL: ${remoteUrl}`);
|
|
63
|
-
const parsedUrl = gch.parseGitHubUrl(remoteUrl);
|
|
64
|
-
if (parsedUrl && parsedUrl.owner && username && parsedUrl.owner.toLowerCase() !== username.toLowerCase()) {
|
|
65
|
-
console.warn(
|
|
66
|
-
`
|
|
67
|
-
[!] The GitHub remote owner ("${parsedUrl.owner}") does not match the configured username ("${username}").`
|
|
68
|
-
);
|
|
69
|
-
console.warn(`[!] If this is not intentional, consider updating the remote URL to use your username.`);
|
|
70
|
-
console.warn(`[!] Example: git remote set-url origin https://github.com/${username}/<repo>.git
|
|
71
|
-
`);
|
|
72
|
-
const args = getArgs();
|
|
73
|
-
const updateRemote = options.updateRemote || args["update-remote"] === true;
|
|
74
|
-
if (updateRemote) {
|
|
75
|
-
let newUrl = remoteUrl;
|
|
76
|
-
if (/^https:\/\//.test(remoteUrl)) {
|
|
77
|
-
newUrl = remoteUrl.replace(/https:\/\/(?:[^@]+@)?github.com/, `https://${username}@github.com`);
|
|
78
|
-
} else if (/^git@github.com:/.test(remoteUrl)) {
|
|
79
|
-
console.warn(
|
|
80
|
-
`[!] For SSH remotes, set your SSH config or use HTTPS with username if you want to change authentication user.`
|
|
81
|
-
);
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (newUrl !== remoteUrl) {
|
|
85
|
-
const updated = runGitCommand(["remote", "set-url", "origin", newUrl], `Set origin to ${newUrl}`);
|
|
86
|
-
if (updated) {
|
|
87
|
-
console.log(`[\u2713] Remote URL updated to: ${newUrl}`);
|
|
88
|
-
} else {
|
|
89
|
-
console.warn(`[!] Failed to update remote URL. Please update it manually if needed.`);
|
|
90
|
-
}
|
|
91
|
-
} else {
|
|
92
|
-
console.log(`[i] Remote URL does not use HTTPS or already contains the username.`);
|
|
93
|
-
}
|
|
94
|
-
} else {
|
|
95
|
-
console.log(`[i] Remote URL not changed. Use --update-remote to update automatically.`);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
module.exports = {
|
|
102
|
-
configureGitUser
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
export {
|
|
108
|
-
require_user_config
|
|
109
|
-
};
|