binary-collections 2.0.9 → 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 +178 -0
- package/{bin → binaries}/clean-nodemodule +0 -0
- package/binaries/clean-nodemodule.cjs +178 -0
- package/binaries/clean-nodemodule.cmd +4 -0
- package/{bin → binaries}/clean-nodemodules +0 -0
- package/binaries/clean-nodemodules.cjs +178 -0
- package/binaries/clean-nodemodules.cmd +5 -0
- package/{bin → binaries}/dev +0 -0
- package/binaries/dev.cjs +178 -0
- package/{bin → binaries}/empty +0 -0
- package/binaries/empty.cjs +178 -0
- package/{bin → binaries}/git-reduce-size +0 -0
- package/binaries/git-reduce-size.cjs +178 -0
- package/binaries/javakill.cjs +178 -0
- package/{bin → binaries}/javakill.cmd +0 -0
- package/binaries/kill-night-crows.bat +7 -0
- package/binaries/kill-night-crows.ps1 +172 -0
- package/{bin → binaries}/kill-process +0 -0
- package/binaries/kill-process.cjs +178 -0
- package/binaries/nodekill.cjs +178 -0
- package/{bin → binaries}/nodekill.ps1 +0 -0
- package/{bin → binaries}/prod +0 -0
- package/binaries/prod.cjs +178 -0
- package/binaries/py +111 -0
- package/binaries/py.cjs +178 -0
- package/binaries/py.cmd +49 -0
- package/{bin → binaries}/rmfind +0 -0
- package/binaries/rmfind.cjs +178 -0
- package/{bin → binaries}/rmx +0 -0
- package/binaries/rmx.cjs +178 -0
- package/{bin → binaries}/submodule-token +0 -0
- package/binaries/submodule-token.cjs +178 -0
- 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/docs-src/clean-github-actions-caches.md +26 -0
- package/docs-src/free-chatgpt.md +26 -0
- package/lib/binary-collections-config.cjs +3 -2
- package/lib/binary-collections-config.mjs +2 -2
- package/lib/binary-collections.cjs +513 -105
- package/lib/binary-collections.mjs +178 -117
- package/lib/changelog.cjs +64 -16
- package/lib/changelog.mjs +177 -171
- package/lib/{chunk-VVEZVNIV.mjs → chunk-2CBJCW7E.mjs} +3 -3
- package/lib/chunk-34IQDTLZ.mjs +27 -0
- package/lib/chunk-3HFFECCI.mjs +27 -0
- package/lib/chunk-4UHL4WVN.mjs +136 -0
- package/lib/{chunk-4BYBVEYC.mjs → chunk-66PAU5PS.mjs} +5 -4
- package/lib/chunk-6HHJRKFB.mjs +59 -0
- package/lib/chunk-6S4NXESK.mjs +26 -0
- package/lib/chunk-7XTEJHOE.mjs +193 -0
- package/lib/{chunk-ZYAQRPUL.mjs → chunk-7YD7IPFF.mjs} +2 -2
- package/lib/{chunk-SH3L6HHV.mjs → chunk-A2JQXI5Z.mjs} +2 -2
- package/lib/{chunk-EGSSKVDH.mjs → chunk-A3VUZEJK.mjs} +1 -1
- package/lib/chunk-AJDD5DZM.mjs +109 -0
- package/lib/chunk-BZWVHODJ.mjs +62 -0
- package/lib/chunk-FCDQGYBF.mjs +136 -0
- package/lib/chunk-FKI7IEB5.mjs +172 -0
- package/lib/chunk-GEYA2USY.mjs +207 -0
- package/lib/chunk-GJTGHXRA.mjs +356 -0
- package/lib/{chunk-YV7DO3YV.mjs → chunk-HLGOWBEO.mjs} +1 -1
- package/lib/chunk-ID2WBTE2.mjs +80 -0
- package/lib/chunk-JXFOHKDM.mjs +239 -0
- package/lib/{chunk-YX5U7XDR.mjs → chunk-M3YIYRHT.mjs} +6 -5
- package/lib/chunk-N436BNBK.mjs +514 -0
- package/lib/chunk-NCXAP7AA.mjs +31 -0
- package/lib/chunk-PDN26I7O.mjs +188 -0
- package/lib/{chunk-JGR2NW6D.mjs → chunk-PDSXF5HY.mjs} +3 -3
- package/lib/{chunk-AASHBCRW.mjs → chunk-QQ4A6DLD.mjs} +8 -0
- package/lib/{chunk-ONIBBBQ3.mjs → chunk-RWLXRTYP.mjs} +4 -3
- package/lib/chunk-TOIVAQF7.mjs +136 -0
- package/lib/chunk-V5SKYJUB.mjs +136 -0
- package/lib/chunk-WSRETQCA.mjs +59 -0
- package/lib/chunk-XA3SNBPA.mjs +184 -0
- package/lib/chunk-XVBFFVCJ.mjs +209 -0
- package/lib/chunk-YYLIQQKF.mjs +31 -0
- package/lib/{chunk-APBWENF6.mjs → chunk-Z6JLYU2J.mjs} +63 -16
- package/lib/chunk-ZDMWBSYF.mjs +81 -0
- package/lib/clean-github-actions-caches.cjs +291 -148
- package/lib/clean-github-actions-caches.mjs +4 -3
- package/lib/del-gradle.cjs +63 -15
- package/lib/del-gradle.js +2 -1
- package/lib/del-gradle.mjs +2 -2
- package/lib/del-node-modules.cjs +143 -148
- package/lib/del-node-modules.js +210 -14
- package/lib/del-node-modules.mjs +149 -18
- package/lib/del-ps.cjs +90 -21
- package/lib/del-ps.js +3 -2
- package/lib/del-ps.mjs +7 -5
- package/lib/del-yarn-caches.cjs +87 -18
- package/lib/del-yarn-caches.js +38 -3
- package/lib/del-yarn-caches.mjs +6 -6
- package/lib/find-node-modules-cli.cjs +5 -4
- package/lib/find-node-modules-cli.js +2 -1
- package/lib/find-node-modules-cli.mjs +2 -2
- package/lib/find-node-modules.cjs +4 -3
- package/lib/{find-node-modules.d.ts → find-node-modules.d.cts} +1 -1
- package/lib/find-node-modules.mjs +2 -2
- package/lib/free-chatgpt.cjs +754 -0
- package/lib/free-chatgpt.js +51 -0
- package/lib/free-chatgpt.mjs +50 -0
- package/lib/git/gitattributes.cjs +2 -1
- package/lib/git/{gitattributes.d.ts → gitattributes.d.cts} +7 -2
- package/lib/git/gitattributes.mjs +2 -2
- package/lib/git/line-endings.cjs +298 -64
- package/lib/git/line-endings.mjs +4 -4
- package/lib/git/normalize.cjs +26 -36
- package/lib/git/normalize.mjs +2 -2
- package/lib/git/permissions.cjs +77 -11
- package/lib/git/permissions.mjs +3 -3
- package/lib/git/pull-strategy.cjs +76 -9
- package/lib/git/pull-strategy.mjs +3 -3
- 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 +313 -83
- package/lib/git/user-config.mjs +4 -4
- package/lib/git/utils.cjs +40 -60
- package/lib/git/utils.mjs +2 -2
- package/lib/git-diff-cli.cjs +857 -0
- package/lib/git-diff-cli.js +16 -0
- package/lib/git-diff-cli.mjs +17 -0
- package/lib/git-diff.cjs +862 -58
- package/lib/git-diff.d.ts +38 -83
- package/lib/git-diff.js +152 -0
- package/lib/git-diff.mjs +23 -85
- package/lib/git-fix.cjs +733 -97
- package/lib/git-fix.mjs +10 -9
- package/lib/git-purge.cjs +64 -16
- package/lib/git-purge.d.cts +1 -0
- package/lib/git-purge.mjs +43 -37
- package/lib/index.cjs +7 -6
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -5
- package/lib/index.mjs +4 -4
- 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 +63 -16
- package/lib/npm-run-series.mjs +42 -36
- 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 +178 -158
- package/lib/package-resolutions-updater.d.mts +32 -1
- package/lib/package-resolutions-updater.mjs +17 -338
- 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 +320 -207
- package/lib/print-directory-tree.mjs +3 -3
- package/lib/ps/connected-domain.cjs +25 -2
- package/lib/ps/connected-domain.d.ts +10 -2
- package/lib/ps/connected-domain.js +5 -2
- package/lib/ps/connected-domain.mjs +8 -4
- package/lib/ps/index.cjs +345 -322
- package/lib/ps/index.d.mjs +1 -1
- package/lib/ps/index.js +2 -1
- package/lib/ps/index.mjs +179 -182
- package/lib/ps/isWin.cjs +24 -1
- package/lib/ps/isWin.d.ts +1 -1
- package/lib/ps/isWin.js +3 -1
- package/lib/ps/isWin.mjs +8 -4
- package/lib/ps/table-parser.cjs +167 -159
- package/lib/ps/table-parser.d.ts +5 -0
- package/lib/ps/table-parser.js +10 -4
- package/lib/ps/table-parser.mjs +9 -5
- package/lib/remove-module.cjs +310 -0
- package/lib/remove-module.d.mts +1 -0
- package/lib/remove-module.mjs +111 -0
- package/lib/rmpath.cjs +322 -0
- package/lib/rmpath.d.mts +3 -0
- package/lib/rmpath.mjs +108 -0
- package/lib/submodule-install.cjs +311 -86
- package/lib/submodule-install.mjs +53 -5
- package/lib/submodule-remove-cli.cjs +107 -0
- package/lib/submodule-remove-cli.d.ts +1 -0
- package/lib/submodule-remove-cli.js +31 -0
- package/lib/submodule-remove-cli.mjs +28 -0
- package/lib/submodule-remove.cjs +46 -0
- package/lib/submodule-remove.d.cts +2 -0
- package/lib/submodule-remove.mjs +6 -0
- package/lib/utils/chatgpt.cjs +541 -0
- package/lib/utils/chatgpt.d.ts +31 -0
- package/lib/utils/chatgpt.js +708 -0
- package/lib/utils/chatgpt.mjs +8 -0
- 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.cjs → utils/index.cjs} +61 -14
- package/lib/{utils.mjs → utils/index.mjs} +2 -2
- 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 +220 -38
- package/lib/yarn-reinstall.mjs +2 -2
- package/package.json +138 -104
- package/readme.md +48 -75
- package/releases/readme.md +36 -0
- package/requirements.txt +1 -0
- package/test/README.md +101 -0
- package/test/package.json +2 -1
- package/test-project/readme.md +26 -0
- package/tmp/test-repo/README.md +35 -0
- package/tmp/test-repo/package.json +1 -1
- package/tmp/typedoc/readme.md +320 -0
- package/bin/bash-dummy +0 -56
- package/bin/bash-dummy.cmd +0 -25
- package/bin/dir-tree.cmd +0 -7
- package/bin/git-diff +0 -4
- package/bin/git-diff.cmd +0 -7
- package/bin/git-fix +0 -36
- package/bin/git-fix.cmd +0 -7
- package/bin/rmpath +0 -70
- package/bin/submodule-install.txt +0 -118
- package/bin/submodule-remove +0 -46
- package/bin/submodule.txt +0 -172
- package/lib/binary-collections-config.d.mts +0 -18
- package/lib/binary-collections-config.js +0 -39
- package/lib/binary-collections.d.mts +0 -137
- package/lib/binary-collections.d.ts +0 -137
- package/lib/changelog.d.mts +0 -2
- package/lib/changelog.js +0 -226
- package/lib/chunk-DPKAJKFO.mjs +0 -171
- package/lib/chunk-G3THLIDT.mjs +0 -200
- package/lib/chunk-W3ENOM53.mjs +0 -18
- package/lib/clean-github-actions-caches.d.mts +0 -169
- package/lib/clean-github-actions-caches.d.ts +0 -169
- package/lib/del-gradle.d.mts +0 -2
- package/lib/del-node-modules.d.mts +0 -2
- package/lib/del-ps.d.mts +0 -2
- package/lib/del-yarn-caches.d.mts +0 -2
- package/lib/find-node-modules-cli.d.mts +0 -1
- package/lib/find-node-modules.d.mts +0 -13
- package/lib/find-node-modules.js +0 -53
- package/lib/git/gitattributes.d.mts +0 -35
- package/lib/git/gitattributes.js +0 -223
- package/lib/git/line-endings.d.mts +0 -83
- package/lib/git/line-endings.d.ts +0 -83
- package/lib/git/normalize.d.mts +0 -43
- package/lib/git/normalize.d.ts +0 -43
- package/lib/git/permissions.d.mts +0 -17
- package/lib/git/permissions.d.ts +0 -17
- package/lib/git/pull-strategy.d.mts +0 -15
- package/lib/git/pull-strategy.d.ts +0 -15
- package/lib/git/user-config.d.mts +0 -105
- package/lib/git/user-config.d.ts +0 -105
- package/lib/git/utils.d.mts +0 -69
- package/lib/git/utils.d.ts +0 -69
- package/lib/git-diff.d.mts +0 -84
- package/lib/git-fix.d.mts +0 -141
- package/lib/git-fix.d.ts +0 -141
- package/lib/git-purge.d.mts +0 -2
- package/lib/git-purge.js +0 -59
- package/lib/index.d.mts +0 -1
- package/lib/npm-run-series.d.mts +0 -1
- package/lib/npm-run-series.js +0 -86
- package/lib/package-resolutions-updater.d.ts +0 -352
- package/lib/print-directory-tree.d.mts +0 -234
- package/lib/print-directory-tree.d.ts +0 -234
- package/lib/ps/connected-domain.d.mts +0 -3
- package/lib/ps/index.d.d.mts +0 -26
- package/lib/ps/index.d.d.ts +0 -26
- package/lib/ps/index.d.mts +0 -26
- package/lib/ps/isWin.d.mts +0 -3
- package/lib/ps/table-parser.d.mts +0 -3
- package/lib/submodule-install.d.mts +0 -121
- package/lib/submodule-install.d.ts +0 -121
- package/lib/utils.d.mts +0 -40
- package/lib/utils.js +0 -181
- package/lib/yarn-reinstall.d.mts +0 -49
- package/lib/yarn-reinstall.d.ts +0 -49
- package/src/package-resolutions-updater.mjs +0 -350
- package/src/print-directory-tree.cjs +0 -234
- package/src/ps/index.js +0 -286
- package/src/yarn-reinstall.cjs +0 -49
- /package/{bin → binaries}/nodekill +0 -0
- /package/{bin → binaries}/nodekill.cmd +0 -0
- /package/lib/{binary-collections-config.d.ts → binary-collections-config.d.cts} +0 -0
- /package/lib/{changelog.d.ts → changelog.d.cts} +0 -0
- /package/lib/{git-purge.d.ts → free-chatgpt.d.ts} +0 -0
- /package/lib/{git-diff.d.cts → git-diff-cli.d.ts} +0 -0
- /package/lib/{npm-run-series.d.ts → npm-run-series.d.cts} +0 -0
- /package/lib/{utils.d.ts → utils/index.d.cts} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
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
|
+
import { parseGitHubUrl } from "git-command-helper";
|
|
22
|
+
var projectDir = process.cwd();
|
|
23
|
+
var envPath = path.join(projectDir, ".env");
|
|
24
|
+
var args = utils.getArgs();
|
|
25
|
+
if (!fs.existsSync(envPath)) {
|
|
26
|
+
const envFiles = findEnvFiles(projectDir, (file) => {
|
|
27
|
+
const content = fs.readFileSync(file, "utf-8");
|
|
28
|
+
return /GITHUB_TOKEN|ACCESS_TOKEN/.test(content);
|
|
29
|
+
});
|
|
30
|
+
if (envFiles.length > 0) {
|
|
31
|
+
envPath = envFiles[0];
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (fs.existsSync(envPath)) {
|
|
35
|
+
dotenv.config({ path: envPath, quiet: true, override: true });
|
|
36
|
+
}
|
|
37
|
+
var ACCESS_TOKEN = process.env.GITHUB_TOKEN || process.env.ACCESS_TOKEN;
|
|
38
|
+
if (args.help || args.h) {
|
|
39
|
+
showHelp();
|
|
40
|
+
}
|
|
41
|
+
function showHelp() {
|
|
42
|
+
const helpText = `
|
|
43
|
+
GitHub Package Resolutions Updater
|
|
44
|
+
Usage:
|
|
45
|
+
node src/package-resolutions-updater.mjs [options]
|
|
46
|
+
Options:
|
|
47
|
+
--help, -h Show this help message
|
|
48
|
+
Description:
|
|
49
|
+
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.
|
|
50
|
+
Features:
|
|
51
|
+
- Parses GitHub URLs to extract repository owner, name, and branch.
|
|
52
|
+
- Fetches the latest commit SHA across all branches using GitHub's API.
|
|
53
|
+
- Replaces the old branch or commit in the URL with the latest SHA.
|
|
54
|
+
- Overwrites package.json with the updated URLs.
|
|
55
|
+
Requirements:
|
|
56
|
+
- GitHub Personal Access Token (GITHUB_TOKEN) via .env
|
|
57
|
+
- ESM support (type: "module" in package.json)
|
|
58
|
+
- Node.js v18+ recommended
|
|
59
|
+
Dependencies:
|
|
60
|
+
- ansi-colors \u2013 for styled terminal output
|
|
61
|
+
- dotenv \u2013 to load GitHub token from .env
|
|
62
|
+
Examples:
|
|
63
|
+
node src/package-resolutions-updater.mjs
|
|
64
|
+
node src/package-resolutions-updater.mjs --help
|
|
65
|
+
|
|
66
|
+
`;
|
|
67
|
+
console.log(helpText);
|
|
68
|
+
process.exit(0);
|
|
69
|
+
}
|
|
70
|
+
var GITHUB_USER_AGENTS = [
|
|
71
|
+
"octokit-rest.js/19.0.7",
|
|
72
|
+
"GitHub CLI/2.40.0",
|
|
73
|
+
"Mozilla/5.0 (compatible; GitHubCopilot/1.0)",
|
|
74
|
+
"PostmanRuntime/7.32.3",
|
|
75
|
+
"binary-collections-resolver/1.0 (+https://github.com/dimaslanjaka/bin)"
|
|
76
|
+
];
|
|
77
|
+
var userAgentDir = path.join(os.tmpdir(), "nodejs");
|
|
78
|
+
var userAgentFile = path.join(userAgentDir, "useragent.txt");
|
|
79
|
+
var selectedUserAgent;
|
|
80
|
+
try {
|
|
81
|
+
if (!fs.existsSync(userAgentDir)) fs.mkdirSync(userAgentDir, { recursive: true });
|
|
82
|
+
if (fs.existsSync(userAgentFile)) {
|
|
83
|
+
const fileAgent = fs.readFileSync(userAgentFile, "utf-8").trim();
|
|
84
|
+
if (GITHUB_USER_AGENTS.includes(fileAgent)) {
|
|
85
|
+
selectedUserAgent = fileAgent;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
if (!selectedUserAgent) {
|
|
89
|
+
selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
|
|
90
|
+
fs.writeFileSync(userAgentFile, selectedUserAgent, "utf-8");
|
|
91
|
+
}
|
|
92
|
+
} catch (_e) {
|
|
93
|
+
selectedUserAgent = GITHUB_USER_AGENTS[Math.floor(Math.random() * GITHUB_USER_AGENTS.length)];
|
|
94
|
+
}
|
|
95
|
+
function fetchJson(url) {
|
|
96
|
+
const headers = {
|
|
97
|
+
"User-Agent": selectedUserAgent,
|
|
98
|
+
Accept: "application/vnd.github.v3+json",
|
|
99
|
+
"X-GitHub-Api-Version": "2022-11-28",
|
|
100
|
+
...ACCESS_TOKEN ? { Authorization: `token ${ACCESS_TOKEN}` } : {}
|
|
101
|
+
};
|
|
102
|
+
return new Promise((resolve, reject) => {
|
|
103
|
+
https.get(url, { headers }, (res) => {
|
|
104
|
+
let data = "";
|
|
105
|
+
res.on("data", (chunk) => data += chunk);
|
|
106
|
+
res.on("end", () => {
|
|
107
|
+
try {
|
|
108
|
+
const json = JSON.parse(data);
|
|
109
|
+
if (res.statusCode < 200 || res.statusCode >= 300) {
|
|
110
|
+
return reject(
|
|
111
|
+
new Error(`GitHub API Error ${res.statusCode}: ${json.message || "Unknown error"}
|
|
112
|
+
URL: ${url}`)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
resolve(json);
|
|
116
|
+
} catch {
|
|
117
|
+
reject(new Error(`Invalid JSON from: ${url}`));
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}).on("error", reject);
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async function getLatestCommit(owner, repo, branch = "main") {
|
|
124
|
+
var _a, _b, _c, _d;
|
|
125
|
+
const url = `https://api.github.com/repos/${owner}/${repo}/commits/${branch}`;
|
|
126
|
+
const json = await fetchJson(url);
|
|
127
|
+
const sha = json.sha;
|
|
128
|
+
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);
|
|
129
|
+
if (!sha || !dateStr) {
|
|
130
|
+
console.log(json);
|
|
131
|
+
throw new Error(`Missing SHA or date for ${owner}/${repo}@${branch}`);
|
|
132
|
+
}
|
|
133
|
+
return {
|
|
134
|
+
owner,
|
|
135
|
+
repo,
|
|
136
|
+
branch,
|
|
137
|
+
sha,
|
|
138
|
+
date: new Date(dateStr).toISOString()
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
async function getLatestCommitAcrossBranches(owner, repo) {
|
|
142
|
+
const branches = await fetchJson(`https://api.github.com/repos/${owner}/${repo}/branches`);
|
|
143
|
+
const commits = await Promise.all(
|
|
144
|
+
branches.map(async ({ name, commit }) => {
|
|
145
|
+
var _a, _b, _c, _d;
|
|
146
|
+
const commitSha = commit == null ? void 0 : commit.sha;
|
|
147
|
+
if (!commitSha) {
|
|
148
|
+
console.warn(`No commit SHA for '${owner}/${repo}' branch: ${name}`);
|
|
149
|
+
return { branch: name, sha: "", date: /* @__PURE__ */ new Date(0) };
|
|
150
|
+
}
|
|
151
|
+
try {
|
|
152
|
+
const commitData = await fetchJson(`https://api.github.com/repos/${owner}/${repo}/commits/${commitSha}`);
|
|
153
|
+
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);
|
|
154
|
+
const date = dateStr ? new Date(dateStr) : /* @__PURE__ */ new Date(0);
|
|
155
|
+
return { branch: name, sha: commitData.sha, date };
|
|
156
|
+
} catch (e) {
|
|
157
|
+
console.warn(`Failed to fetch commit for ${name}: ${e.message}`);
|
|
158
|
+
return { branch: name, sha: commitSha, date: /* @__PURE__ */ new Date(0) };
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
);
|
|
162
|
+
const latest = commits.reduce((a, b) => a.date > b.date ? a : b, { date: /* @__PURE__ */ new Date(0) });
|
|
163
|
+
return {
|
|
164
|
+
owner,
|
|
165
|
+
repo,
|
|
166
|
+
branch: latest.branch,
|
|
167
|
+
sha: latest.sha,
|
|
168
|
+
date: latest.date.toISOString()
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function replaceRawWithLatestHash(url, latestHash) {
|
|
172
|
+
const match = url.match(/^https:\/\/github\.com\/([^/]+)\/([^/]+)\/raw\/([^/]+)\/(.+)$/);
|
|
173
|
+
if (!match) throw new Error("Invalid GitHub raw URL");
|
|
174
|
+
const [, owner, repo, _oldHash, path2] = match;
|
|
175
|
+
return `https://github.com/${owner}/${repo}/raw/${latestHash}/${path2}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export {
|
|
179
|
+
parseGitHubUrl,
|
|
180
|
+
fetchJson,
|
|
181
|
+
getLatestCommit,
|
|
182
|
+
getLatestCommitAcrossBranches,
|
|
183
|
+
replaceRawWithLatestHash
|
|
184
|
+
};
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
connected_domain_default,
|
|
4
|
+
init_connected_domain
|
|
5
|
+
} from "./chunk-FKI7IEB5.mjs";
|
|
6
|
+
import {
|
|
7
|
+
__esm,
|
|
8
|
+
__export,
|
|
9
|
+
init_esm_shims
|
|
10
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
11
|
+
|
|
12
|
+
// src/ps/table-parser.js
|
|
13
|
+
var table_parser_exports = {};
|
|
14
|
+
__export(table_parser_exports, {
|
|
15
|
+
parse: () => parse
|
|
16
|
+
});
|
|
17
|
+
function parse(output) {
|
|
18
|
+
var linesTmp = output.split(/(\r\n)|(\n\r)|\n|\r/);
|
|
19
|
+
var lines = [];
|
|
20
|
+
var titleInfo = {};
|
|
21
|
+
var twoDimArray = [];
|
|
22
|
+
linesTmp.forEach(function(line) {
|
|
23
|
+
if (line && line.trim()) {
|
|
24
|
+
lines.push(line);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
lines.forEach(function(line, index) {
|
|
28
|
+
if (index == 0) {
|
|
29
|
+
var fields = line.split(/\s+/);
|
|
30
|
+
var currentIndex = 0;
|
|
31
|
+
fields.forEach(function(field, idx) {
|
|
32
|
+
if (field) {
|
|
33
|
+
var info = titleInfo[field] = {};
|
|
34
|
+
var indexBegin = line.indexOf(field, currentIndex);
|
|
35
|
+
var indexEnd = currentIndex = indexBegin + field.length;
|
|
36
|
+
if (idx == 0) {
|
|
37
|
+
info.titleBegin = 0;
|
|
38
|
+
} else {
|
|
39
|
+
info.titleBegin = indexBegin;
|
|
40
|
+
}
|
|
41
|
+
if (idx == fields.length - 1) {
|
|
42
|
+
info.titleEnd = line.length - 1;
|
|
43
|
+
} else {
|
|
44
|
+
info.titleEnd = indexEnd;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
} else {
|
|
49
|
+
twoDimArray[index - 1] = line.split("");
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
var connectedDomains = connected_domain_default(
|
|
53
|
+
twoDimArray,
|
|
54
|
+
function(value) {
|
|
55
|
+
if (EMPTY_EX.test(value)) {
|
|
56
|
+
return -1;
|
|
57
|
+
} else {
|
|
58
|
+
return 1;
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
true
|
|
62
|
+
);
|
|
63
|
+
var valuesDomainsVerticalGroups = [];
|
|
64
|
+
connectedDomains.domains.sort(function(a, b) {
|
|
65
|
+
return a.bounding.x - b.bounding.x;
|
|
66
|
+
});
|
|
67
|
+
connectedDomains.domains.forEach(function(domain) {
|
|
68
|
+
if (domain.identifier === 1) {
|
|
69
|
+
var overlapped = false;
|
|
70
|
+
valuesDomainsVerticalGroups.forEach(function(group) {
|
|
71
|
+
var bounding = domain.bounding;
|
|
72
|
+
var left = bounding.x;
|
|
73
|
+
var right = bounding.x + bounding.w;
|
|
74
|
+
if (overlap(left, right, group.begin, group.end)) {
|
|
75
|
+
overlapped = true;
|
|
76
|
+
group.domains.push(domain);
|
|
77
|
+
group.begin = group.begin > left ? left : group.begin;
|
|
78
|
+
group.end = group.end < right ? right : group.end;
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
if (!overlapped) {
|
|
82
|
+
valuesDomainsVerticalGroups.push({
|
|
83
|
+
begin: domain.bounding.x,
|
|
84
|
+
end: domain.bounding.x + domain.bounding.w,
|
|
85
|
+
domains: [domain]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
valuesDomainsVerticalGroups.forEach(function(group) {
|
|
91
|
+
var title = null;
|
|
92
|
+
var info = null;
|
|
93
|
+
var overlapped = false;
|
|
94
|
+
var minimunLeftDistance = null;
|
|
95
|
+
var nearestLeftTitle = null;
|
|
96
|
+
var distance = null;
|
|
97
|
+
for (title in titleInfo) {
|
|
98
|
+
info = titleInfo[title];
|
|
99
|
+
if (group.begin > info.titleBegin) {
|
|
100
|
+
distance = group.begin - info.titleBegin;
|
|
101
|
+
if (!nearestLeftTitle || distance < minimunLeftDistance) {
|
|
102
|
+
nearestLeftTitle = title;
|
|
103
|
+
minimunLeftDistance = distance;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (overlap(group.begin, group.end, info.titleBegin, info.titleEnd)) {
|
|
107
|
+
overlapped = true;
|
|
108
|
+
info.titleBegin = info.titleBegin > group.begin ? group.begin : info.titleBegin;
|
|
109
|
+
info.titleEnd = info.titleEnd < group.end ? group.end : info.titleEnd;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
if (!overlapped && nearestLeftTitle) {
|
|
113
|
+
var nearestTitleField = titleInfo[nearestLeftTitle];
|
|
114
|
+
nearestTitleField.titleBegin = nearestTitleField.titleBegin > group.begin ? group.begin : nearestTitleField.titleBegin;
|
|
115
|
+
nearestTitleField.titleEnd = nearestTitleField.titleEnd < group.end ? group.end : nearestTitleField.titleEnd;
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
var result = [];
|
|
119
|
+
lines.forEach(function(line, index) {
|
|
120
|
+
if (index > 0) {
|
|
121
|
+
var lineItem = {};
|
|
122
|
+
var title = null;
|
|
123
|
+
var info = null;
|
|
124
|
+
var value = null;
|
|
125
|
+
for (title in titleInfo) {
|
|
126
|
+
info = titleInfo[title];
|
|
127
|
+
value = line.substring(info.titleBegin, info.titleEnd + 1);
|
|
128
|
+
lineItem[title] = splitValue(value.trim());
|
|
129
|
+
}
|
|
130
|
+
result.push(lineItem);
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
function overlap(begin1, end1, begin2, end2) {
|
|
136
|
+
return begin1 > begin2 && begin1 < end2 || // 2--1--2--1 or 2--1--1--2
|
|
137
|
+
end1 > begin2 && end1 < end2 || // 1--2--1--2 or 2--1--1--2
|
|
138
|
+
begin1 <= begin2 && end1 >= end2;
|
|
139
|
+
}
|
|
140
|
+
function splitValue(value) {
|
|
141
|
+
var match = value.match(/"/g);
|
|
142
|
+
if (!match || match.length == 1) {
|
|
143
|
+
return value.split(/\s+/);
|
|
144
|
+
} else {
|
|
145
|
+
var result = [];
|
|
146
|
+
var chunk = null;
|
|
147
|
+
var ifInWrappedChunk = false;
|
|
148
|
+
var ifInPureWrappedChunk = false;
|
|
149
|
+
var quotaCount = 0;
|
|
150
|
+
var maxQuotaCount = match.length % 2 == 0 ? match.length : match.length - 1;
|
|
151
|
+
var previousItem = null;
|
|
152
|
+
var values = value.split("");
|
|
153
|
+
values.forEach(function(item, index) {
|
|
154
|
+
if (item !== " ") {
|
|
155
|
+
if (item === '"') {
|
|
156
|
+
if (ifInWrappedChunk === false && quotaCount <= maxQuotaCount) {
|
|
157
|
+
ifInWrappedChunk = true;
|
|
158
|
+
quotaCount++;
|
|
159
|
+
if (previousItem === " " || previousItem === null) {
|
|
160
|
+
ifInPureWrappedChunk = true;
|
|
161
|
+
chunk = "";
|
|
162
|
+
} else {
|
|
163
|
+
chunk += item;
|
|
164
|
+
}
|
|
165
|
+
} else if (ifInWrappedChunk === true) {
|
|
166
|
+
ifInWrappedChunk = false;
|
|
167
|
+
quotaCount++;
|
|
168
|
+
if (ifInPureWrappedChunk === true) {
|
|
169
|
+
ifInPureWrappedChunk = false;
|
|
170
|
+
result.push(chunk);
|
|
171
|
+
chunk = null;
|
|
172
|
+
} else {
|
|
173
|
+
chunk += item;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
} else if (ifInWrappedChunk === false && (previousItem === " " || previousItem === null)) {
|
|
177
|
+
chunk = item;
|
|
178
|
+
} else {
|
|
179
|
+
chunk += item;
|
|
180
|
+
}
|
|
181
|
+
} else if (ifInWrappedChunk) {
|
|
182
|
+
chunk += item;
|
|
183
|
+
} else if (chunk !== null) {
|
|
184
|
+
result.push(chunk);
|
|
185
|
+
chunk = null;
|
|
186
|
+
}
|
|
187
|
+
previousItem = item;
|
|
188
|
+
if (index == values.length - 1 && chunk !== null) {
|
|
189
|
+
result.push(chunk);
|
|
190
|
+
chunk = null;
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
return result;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
var EMPTY_EX;
|
|
197
|
+
var init_table_parser = __esm({
|
|
198
|
+
"src/ps/table-parser.js"() {
|
|
199
|
+
init_esm_shims();
|
|
200
|
+
init_connected_domain();
|
|
201
|
+
EMPTY_EX = /\s/;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
export {
|
|
206
|
+
parse,
|
|
207
|
+
table_parser_exports,
|
|
208
|
+
init_table_parser
|
|
209
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
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/binary-collections-config.cjs
|
|
9
|
+
var require_binary_collections_config = __commonJS({
|
|
10
|
+
"src/binary-collections-config.cjs"(exports, module) {
|
|
11
|
+
init_esm_shims();
|
|
12
|
+
var path = __require("path");
|
|
13
|
+
__require("dotenv").config({ path: path.join(process.cwd(), ".env"), quiet: true, override: true });
|
|
14
|
+
function getTempDir() {
|
|
15
|
+
return process.env.TEMP_DIR || path.join(process.cwd(), "tmp");
|
|
16
|
+
}
|
|
17
|
+
function getTempPath(...segments) {
|
|
18
|
+
return path.join(getTempDir(), ...segments);
|
|
19
|
+
}
|
|
20
|
+
var TEMP_BASE_DIR = getTempDir();
|
|
21
|
+
module.exports = {
|
|
22
|
+
getTempDir,
|
|
23
|
+
getTempPath,
|
|
24
|
+
TEMP_BASE_DIR
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export {
|
|
30
|
+
require_binary_collections_config
|
|
31
|
+
};
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
__commonJS,
|
|
4
4
|
__require,
|
|
5
5
|
init_esm_shims
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
7
7
|
|
|
8
|
-
// src/utils.
|
|
8
|
+
// src/utils/index.cjs
|
|
9
9
|
var require_utils = __commonJS({
|
|
10
|
-
"src/utils.
|
|
10
|
+
"src/utils/index.cjs"(exports, module) {
|
|
11
11
|
init_esm_shims();
|
|
12
12
|
var fs = __require("fs");
|
|
13
13
|
var path = __require("upath");
|
|
@@ -60,31 +60,78 @@ var require_utils = __commonJS({
|
|
|
60
60
|
}
|
|
61
61
|
module.exports.getArgs = getArgs;
|
|
62
62
|
function del(fullPath) {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
try {
|
|
64
|
+
if (!fs.existsSync(fullPath)) return;
|
|
65
|
+
const stat = fs.lstatSync(fullPath);
|
|
66
|
+
if (stat.isSymbolicLink()) {
|
|
67
|
+
try {
|
|
68
|
+
fs.unlinkSync(fullPath);
|
|
69
|
+
console.log("deleted symlink", fullPath);
|
|
70
|
+
} catch (e) {
|
|
71
|
+
console.log("failed delete symlink", fullPath, e && e.message);
|
|
72
|
+
}
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
if (stat.isDirectory()) {
|
|
76
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
77
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
78
|
+
del(subdir[i]);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
fs.rmdirSync(fullPath);
|
|
82
|
+
console.log("deleted", fullPath);
|
|
83
|
+
} catch (e) {
|
|
84
|
+
try {
|
|
85
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
86
|
+
console.log("deleted", fullPath);
|
|
87
|
+
} catch (ee) {
|
|
88
|
+
console.log("failed delete", fullPath, ee && ee.message);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return;
|
|
67
92
|
}
|
|
68
|
-
} else {
|
|
69
93
|
try {
|
|
70
|
-
fs.
|
|
94
|
+
fs.unlinkSync(fullPath);
|
|
71
95
|
console.log("deleted", fullPath);
|
|
72
|
-
} catch (
|
|
73
|
-
|
|
96
|
+
} catch (e) {
|
|
97
|
+
try {
|
|
98
|
+
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
99
|
+
console.log("deleted", fullPath);
|
|
100
|
+
} catch (ee) {
|
|
101
|
+
console.log("failed delete", fullPath, ee && ee.message);
|
|
102
|
+
}
|
|
74
103
|
}
|
|
104
|
+
} catch (err) {
|
|
105
|
+
console.log("failed delete", fullPath, err && err.message);
|
|
75
106
|
}
|
|
76
107
|
}
|
|
77
108
|
module.exports.del = del;
|
|
78
109
|
function delStream(globStream) {
|
|
79
110
|
globStream.stream().on("data", (result) => {
|
|
80
111
|
const fullPath = path.resolve(process.cwd(), result);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
112
|
+
try {
|
|
113
|
+
if (fs.existsSync(fullPath)) {
|
|
114
|
+
const stat = fs.lstatSync(fullPath);
|
|
115
|
+
if (stat.isSymbolicLink()) {
|
|
116
|
+
try {
|
|
117
|
+
fs.unlinkSync(fullPath);
|
|
118
|
+
console.log("deleted symlink", fullPath);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
console.log("failed delete symlink", fullPath, e && e.message);
|
|
121
|
+
}
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
if (stat.isDirectory()) {
|
|
125
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
126
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
127
|
+
del(subdir[i]);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
85
130
|
}
|
|
131
|
+
del(fullPath);
|
|
132
|
+
} catch (err) {
|
|
133
|
+
console.log("failed processing", fullPath, err && err.message);
|
|
86
134
|
}
|
|
87
|
-
del(fullPath);
|
|
88
135
|
});
|
|
89
136
|
}
|
|
90
137
|
module.exports.delStream = delStream;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_gitattributes
|
|
4
|
+
} from "./chunk-PDN26I7O.mjs";
|
|
5
|
+
import {
|
|
6
|
+
require_utils
|
|
7
|
+
} from "./chunk-A3VUZEJK.mjs";
|
|
8
|
+
import {
|
|
9
|
+
__commonJS,
|
|
10
|
+
__require,
|
|
11
|
+
init_esm_shims
|
|
12
|
+
} from "./chunk-QQ4A6DLD.mjs";
|
|
13
|
+
|
|
14
|
+
// src/git/line-endings.cjs
|
|
15
|
+
var require_line_endings = __commonJS({
|
|
16
|
+
"src/git/line-endings.cjs"(exports, module) {
|
|
17
|
+
init_esm_shims();
|
|
18
|
+
var path = __require("upath");
|
|
19
|
+
var fs = __require("fs");
|
|
20
|
+
var { runGitCommand } = require_utils();
|
|
21
|
+
var { updateGitAttributes } = require_gitattributes();
|
|
22
|
+
function forceLfLineEndings() {
|
|
23
|
+
console.log("\n=== Configuring LF Line Endings ===");
|
|
24
|
+
runGitCommand(["config", "core.autocrlf", "false"], "Disable automatic CRLF conversion");
|
|
25
|
+
runGitCommand(["config", "core.eol", "lf"], "Set end-of-line to LF");
|
|
26
|
+
const gitattributesPath = path.join(process.cwd(), ".gitattributes");
|
|
27
|
+
if (fs.existsSync(gitattributesPath)) {
|
|
28
|
+
let content = fs.readFileSync(gitattributesPath, "utf8");
|
|
29
|
+
if (!/^\*\s+text=auto\s+eol=lf/m.test(content)) {
|
|
30
|
+
content = `* text=auto eol=lf
|
|
31
|
+
` + content;
|
|
32
|
+
fs.writeFileSync(gitattributesPath, content);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
const desiredRules = [
|
|
36
|
+
{ pattern: "*", attributes: "text=auto eol=lf", priority: 1 },
|
|
37
|
+
{
|
|
38
|
+
pattern: "*.{cmd,bat,ps1,sh,cmd1,cmd2,bat1,bat2,vbs}",
|
|
39
|
+
attributes: "text eol=crlf",
|
|
40
|
+
priority: 2
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
pattern: "*.{png,jpg,jpeg,gif,ico,svg,bmp,webp,avif,tiff,tif,psd,ai,eps,raw}",
|
|
44
|
+
attributes: "binary",
|
|
45
|
+
priority: 3
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
pattern: "*.{zip,tar,gz,7z,rar,exe,dll,so,bin,jar,war,ear,apk,msi,deb,rpm,iso,img,dmg,pdf,mp3,mp4,mov,avi,mkv,flv,wmv,ogg,webm,wav,aac,m4a,otf,ttf,woff,woff2,eot}",
|
|
49
|
+
attributes: "binary",
|
|
50
|
+
priority: 3
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
const result = updateGitAttributes(gitattributesPath, desiredRules);
|
|
54
|
+
if (result.error) {
|
|
55
|
+
console.log(`[\u2717] Error updating .gitattributes: ${result.error}`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
if (result.conflicts.length > 0) {
|
|
59
|
+
console.log("\n[!] Detected conflicts in .gitattributes:");
|
|
60
|
+
result.conflicts.forEach((conflict) => {
|
|
61
|
+
console.log(` ${conflict.pattern}: ${conflict.existing} -> ${conflict.proposed} (${conflict.action})`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
if (result.success) {
|
|
65
|
+
console.log(`[\u2713] ${result.message}:`);
|
|
66
|
+
result.changes.forEach((change) => {
|
|
67
|
+
console.log(` ${change.action}: ${change.pattern} ${change.attributes}`);
|
|
68
|
+
});
|
|
69
|
+
} else {
|
|
70
|
+
console.log(`[i] ${result.message}`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
module.exports = {
|
|
74
|
+
forceLfLineEndings
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
export {
|
|
80
|
+
require_line_endings
|
|
81
|
+
};
|