binary-collections 2.0.11 → 2.0.13
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/binaries/binary-executor.cjs +89 -13
- package/binaries/clean-nodemodule.cjs +89 -13
- package/binaries/clean-nodemodules.cjs +89 -13
- package/binaries/dev.cjs +89 -13
- package/binaries/empty.cjs +89 -13
- package/binaries/git-reduce-size.cjs +89 -13
- package/binaries/javakill.cjs +89 -13
- package/binaries/kill-process.cjs +89 -13
- package/binaries/nodekill.cjs +89 -13
- package/binaries/prod.cjs +89 -13
- package/binaries/py.cjs +89 -13
- package/binaries/rmfind.cjs +89 -13
- package/binaries/rmx +15 -1
- package/binaries/rmx.cjs +89 -13
- package/binaries/rmx.cmd +12 -0
- package/binaries/submodule-token.cjs +89 -13
- package/binaries/test-cjs +9 -1
- package/binaries/test-cjs.cjs +89 -13
- package/binaries/test-cjs.cmd +16 -1
- package/binaries/test-esm +16 -0
- package/binaries/test-esm.cjs +254 -0
- package/binaries/test-esm.cmd +23 -0
- package/binaries/yarn-clean +1 -1
- package/binaries/yarn-clean.cjs +89 -13
- package/binaries/yarn-clean.cmd +1 -1
- package/binaries/yarn-clean.py +33 -15
- package/binaries/yc +131 -0
- package/binaries/yc.cjs +254 -0
- package/binaries/ycw +256 -0
- package/binaries/ycw.cjs +254 -0
- package/docs-src/binary-collections.md +34 -0
- package/docs-src/changelog.md +26 -0
- package/docs-src/clean-github-actions-caches.md +91 -2
- package/docs-src/copy-move-file.md +59 -0
- package/docs-src/del-gradle.md +17 -0
- package/docs-src/del-ps.md +28 -0
- package/docs-src/downloader.md +62 -0
- package/docs-src/env-helpers.md +29 -0
- package/docs-src/find-node-modules.md +17 -0
- package/docs-src/git-diff.md +33 -0
- package/docs-src/git-fix.md +34 -0
- package/docs-src/git-purge.md +17 -0
- package/docs-src/git-reduce-size.md +17 -0
- package/docs-src/git-undo.md +21 -0
- package/docs-src/kill-night-crows.md +26 -0
- package/docs-src/node-cache-cleaner.md +182 -0
- package/docs-src/node-executor.md +50 -0
- package/docs-src/node-package-packer.md +48 -0
- package/docs-src/npm-run-series.md +43 -0
- package/docs-src/package-resolutions-updater.md +22 -0
- package/docs-src/php-cs-fixer-staged.md +19 -0
- package/docs-src/print-directory-tree.md +35 -0
- package/docs-src/print-tarball-tree.md +55 -0
- package/docs-src/py.md +19 -0
- package/docs-src/remove-module.md +32 -0
- package/docs-src/rmfind-rmx.md +21 -0
- package/docs-src/rmpath.md +38 -0
- package/docs-src/run-by-checksum.md +87 -0
- package/docs-src/submodule-install.md +31 -0
- package/docs-src/submodule-remove.md +22 -0
- package/docs-src/submodule-token.md +17 -0
- package/docs-src/test-runners.md +21 -0
- package/docs-src/yarn-install.md +31 -0
- package/docs-src/yarn-reinstall.md +27 -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 +309 -0
- package/lib/binary-collections/findScript.d.cts +12 -0
- package/lib/binary-collections/findScript.mjs +7 -0
- package/lib/binary-collections/listScript.cjs +291 -0
- package/lib/binary-collections/listScript.d.cts +19 -0
- package/lib/binary-collections/listScript.mjs +7 -0
- package/lib/binary-collections.cjs +264 -157
- package/lib/binary-collections.mjs +26 -286
- package/lib/changelog.cjs +9 -14
- package/lib/changelog.mjs +2 -2
- package/lib/chunk-2MN4VPV2.mjs +246 -0
- package/lib/chunk-6C7KTYGZ.mjs +41 -0
- package/lib/{chunk-Z6JLYU2J.mjs → chunk-6RK5UCTP.mjs} +7 -12
- package/lib/chunk-CD3HF3LK.mjs +190 -0
- package/lib/chunk-FLYSZFLW.mjs +61 -0
- package/lib/{chunk-N436BNBK.mjs → chunk-GAGABICI.mjs} +19 -13
- package/lib/chunk-H44UWUFY.mjs +105 -0
- package/lib/chunk-KLKAIFKI.mjs +40 -0
- package/lib/chunk-LVSPEFU2.mjs +86 -0
- package/lib/{chunk-RWLXRTYP.mjs → chunk-MGPYPKIE.mjs} +2 -2
- package/lib/chunk-NGFK3EYW.mjs +28 -0
- package/lib/chunk-NQXUYO67.mjs +253 -0
- package/lib/chunk-NVEG3LEZ.mjs +143 -0
- package/lib/chunk-OBXLTXFJ.mjs +34 -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-QD4T255Z.mjs +40 -0
- package/lib/chunk-QII2EKCS.mjs +26 -0
- package/lib/chunk-R5FJOR63.mjs +47 -0
- package/lib/chunk-RDGDLSPD.mjs +76 -0
- package/lib/chunk-RDN6HF5Z.mjs +79 -0
- package/lib/chunk-RJKTSUAX.mjs +123 -0
- package/lib/{chunk-XA3SNBPA.mjs → chunk-TBWXE7ST.mjs} +97 -38
- package/lib/chunk-UXCFNAR6.mjs +55 -0
- package/lib/{chunk-M3YIYRHT.mjs → chunk-UY5VUEA3.mjs} +1 -1
- package/lib/chunk-WSHVPGNM.mjs +44 -0
- package/lib/{chunk-66PAU5PS.mjs → chunk-X2B3X7D4.mjs} +10 -6
- package/lib/clean-github-actions-caches-cli.cjs +507 -0
- package/lib/clean-github-actions-caches-cli.mjs +74 -0
- package/lib/clean-github-actions-caches.cjs +246 -106
- package/lib/clean-github-actions-caches.d.cts +53 -1
- package/lib/clean-github-actions-caches.mjs +5 -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/{ps/isWin.mjs → cross-env/command.mjs} +4 -5
- 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 +8 -13
- package/lib/del-gradle.js +8 -8
- package/lib/del-gradle.mjs +1 -1
- package/lib/del-node-modules.cjs +185 -3
- package/lib/del-node-modules.js +25 -25
- package/lib/del-node-modules.mjs +6 -3
- package/lib/{del-ps.cjs → del-ps-cli.cjs} +38 -43
- package/lib/del-ps-cli.d.mts +1 -0
- package/lib/del-ps-cli.mjs +44 -0
- package/lib/del-yarn-caches.cjs +8 -13
- package/lib/del-yarn-caches.js +2 -2
- package/lib/del-yarn-caches.mjs +1 -1
- package/lib/downloader-cli.cjs +256 -0
- package/lib/downloader-cli.d.cts +2 -0
- package/lib/downloader-cli.mjs +90 -0
- package/lib/file/copy-cli.cjs +273 -0
- package/lib/file/copy-cli.d.mts +1 -0
- package/lib/file/copy-cli.mjs +59 -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 +272 -0
- package/lib/file/move-cli.d.mts +1 -0
- package/lib/file/move-cli.mjs +59 -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.cjs +1 -1
- package/lib/find-node-modules-cli.js +1 -1
- package/lib/find-node-modules-cli.mjs +1 -1
- package/lib/find-node-modules.cjs +1 -1
- package/lib/find-node-modules.mjs +1 -1
- package/lib/free-chatgpt.cjs +27 -26
- package/lib/free-chatgpt.js +10 -10
- package/lib/free-chatgpt.mjs +2 -2
- package/lib/git/user-config.cjs +9 -14
- package/lib/git/user-config.mjs +2 -2
- package/lib/git-diff-cli.cjs +273 -66
- package/lib/git-diff-cli.mjs +5 -4
- package/lib/git-diff.cjs +273 -66
- package/lib/git-diff.d.ts +2 -1
- package/lib/git-diff.js +153 -39
- package/lib/git-diff.mjs +5 -4
- package/lib/git-fix.cjs +9 -14
- package/lib/git-fix.mjs +2 -2
- package/lib/git-purge.cjs +9 -14
- package/lib/git-purge.mjs +2 -2
- package/lib/index.cjs +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.mjs +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 +365 -0
- package/lib/node-cache-cleaner-cli.d.ts +2 -0
- package/lib/node-cache-cleaner-cli.js +57 -0
- package/lib/node-cache-cleaner-cli.mjs +60 -0
- package/lib/node-executor.cjs +272 -0
- package/lib/node-executor.d.cts +2 -0
- package/lib/node-executor.mjs +106 -0
- package/lib/node-package-packer/build-readme.cjs +150 -0
- package/lib/node-package-packer/build-readme.d.mts +10 -0
- package/lib/node-package-packer/build-readme.mjs +10 -0
- package/lib/node-package-packer/build-tarball.cjs +495 -0
- package/lib/node-package-packer/build-tarball.d.mts +33 -0
- package/lib/node-package-packer/build-tarball.mjs +175 -0
- package/lib/node-package-packer-cli.cjs +525 -0
- package/lib/node-package-packer-cli.d.mts +1 -0
- package/lib/node-package-packer-cli.mjs +34 -0
- package/lib/npm-run-series.cjs +28 -40
- package/lib/npm-run-series.mjs +21 -7
- package/lib/package-resolutions-updater-cli.cjs +255 -173
- package/lib/package-resolutions-updater-cli.mjs +19 -40
- package/lib/package-resolutions-updater.cjs +244 -141
- package/lib/package-resolutions-updater.d.mts +54 -1
- package/lib/package-resolutions-updater.mjs +8 -5
- package/lib/php-cs-fixer-staged.cjs +1 -1
- package/lib/php-cs-fixer-staged.mjs +1 -1
- package/lib/print-directory-tree.cjs +18 -20
- package/lib/print-directory-tree.mjs +11 -8
- package/lib/print-tarball-tree.cjs +262 -0
- package/lib/print-tarball-tree.d.mts +1 -0
- package/lib/print-tarball-tree.mjs +68 -0
- package/lib/ps/connected-domain.js +10 -10
- package/lib/ps/index.cjs +11 -11
- package/lib/ps/index.mjs +180 -174
- package/lib/ps/table-parser.d.ts +3 -4
- package/lib/ps/table-parser.js +15 -22
- package/lib/remove-module.cjs +19 -24
- package/lib/remove-module.mjs +2 -2
- package/lib/rm-node-module-cli.cjs +389 -0
- package/lib/rm-node-module-cli.d.cts +1 -0
- package/lib/rm-node-module-cli.mjs +92 -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-cli.cjs +285 -0
- package/lib/rmpath-cli.d.mts +1 -0
- package/lib/rmpath-cli.mjs +23 -0
- package/lib/rmpath.cjs +6 -217
- package/lib/rmpath.mjs +5 -101
- package/lib/run-by-checksum/cache.cjs +69 -0
- package/lib/run-by-checksum/cache.d.ts +19 -0
- package/lib/run-by-checksum/cache.js +50 -0
- package/lib/run-by-checksum/cache.mjs +12 -0
- package/lib/run-by-checksum/hash.cjs +72 -0
- package/lib/run-by-checksum/hash.d.ts +14 -0
- package/lib/run-by-checksum/hash.js +85 -0
- package/lib/run-by-checksum/hash.mjs +10 -0
- package/lib/run-by-checksum/run.cjs +169 -0
- package/lib/run-by-checksum/run.d.ts +22 -0
- package/lib/run-by-checksum/run.js +93 -0
- package/lib/run-by-checksum/run.mjs +10 -0
- package/lib/run-by-checksum-cli.cjs +382 -0
- package/lib/run-by-checksum-cli.d.ts +2 -0
- package/lib/run-by-checksum-cli.js +43 -0
- package/lib/run-by-checksum-cli.mjs +56 -0
- package/lib/submodule-install.cjs +55 -47
- package/lib/submodule-install.mjs +48 -35
- package/lib/submodule-remove-cli.cjs +170 -4
- package/lib/submodule-remove-cli.js +5 -5
- package/lib/submodule-remove-cli.mjs +6 -4
- package/lib/utils/chatgpt.cjs +19 -13
- package/lib/utils/chatgpt.js +94 -94
- package/lib/utils/chatgpt.mjs +1 -1
- package/lib/utils/fetchResponse.cjs +24 -0
- package/lib/utils/fetchResponse.d.cts +25 -0
- package/lib/utils/fetchResponse.mjs +6 -0
- 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 +7 -12
- package/lib/utils/index.d.cts +2 -9
- package/lib/utils/index.mjs +1 -1
- package/lib/utils/isGithubTokenValid.js +7 -7
- package/lib/{ps/isWin.cjs → utils/isWindows.cjs} +12 -7
- package/lib/utils/isWindows.d.ts +5 -0
- package/lib/utils/isWindows.js +10 -0
- package/lib/utils/isWindows.mjs +10 -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 +288 -0
- package/lib/yarn-per-branch-lock-installer.d.cts +2 -0
- package/lib/yarn-per-branch-lock-installer.mjs +122 -0
- package/lib/yarn-reinstall.cjs +8 -13
- package/lib/yarn-reinstall.mjs +1 -1
- package/package.json +91 -57
- package/readme.html +784 -0
- package/readme.md +107 -219
- package/releases/readme.md +6 -3
- package/test/README.md +2 -2
- 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/readme.md +12 -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/themes/hexo-theme-flowbite/readme.md +156 -0
- package/tmp/test-repo/README.md +2 -35
- package/tmp/test-repo-runChecksum/test-complex-glob/README.md +1 -0
- package/tmp/test-repo-runChecksum/test-mixed-args/README.md +1 -0
- 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-6HHJRKFB.mjs +0 -59
- package/lib/chunk-6S4NXESK.mjs +0 -26
- package/lib/chunk-7XTEJHOE.mjs +0 -193
- package/lib/chunk-AJDD5DZM.mjs +0 -109
- 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-NCXAP7AA.mjs +0 -31
- package/lib/chunk-PDSXF5HY.mjs +0 -187
- 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/del-ps.js +0 -32
- package/lib/del-ps.mjs +0 -43
- package/lib/ps/index.d.cjs +0 -17
- package/lib/ps/index.d.ts +0 -2
- package/lib/ps/index.js +0 -254
- package/lib/ps/isWin.d.ts +0 -2
- package/lib/ps/isWin.js +0 -4
- package/lib/utils/findEnvFiles.d.ts +0 -8
- package/lib/utils/findEnvFiles.js +0 -121
- package/test/package.json +0 -20
- package/test-project/package.json +0 -16
- package/tmp/test-repo/package.json +0 -7
- package/tmp/typedoc/readme.md +0 -320
- /package/lib/{binary-collections-config.d.cts → binary-collections/config.d.cts} +0 -0
- /package/lib/{del-ps.d.ts → clean-github-actions-caches-cli.d.cts} +0 -0
package/lib/git-diff.js
CHANGED
|
@@ -16,19 +16,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
16
16
|
exports.GPT_DIFF_OUTPUT_RELATIVE = exports.GPT_DIFF_OUTPUT = exports.DIFF_OUTPUT_RELATIVE = exports.DIFF_OUTPUT = exports.CACHE_DIR = void 0;
|
|
17
17
|
exports.gitDiff = runGitDiff;
|
|
18
18
|
exports.mainGitDiff = mainGitDiff;
|
|
19
|
+
const ansi_colors_1 = __importDefault(require("ansi-colors"));
|
|
19
20
|
const child_process_1 = require("child_process");
|
|
20
21
|
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
22
|
+
const sbg_utility_1 = require("sbg-utility");
|
|
21
23
|
const upath_1 = __importDefault(require("upath"));
|
|
22
24
|
const url_1 = require("url");
|
|
23
|
-
const
|
|
25
|
+
const config_cjs_1 = require("./binary-collections/config.cjs");
|
|
24
26
|
const chatgpt_js_1 = require("./utils/chatgpt.js");
|
|
25
27
|
const index_cjs_1 = require("./utils/index.cjs");
|
|
26
28
|
const __filename = (0, url_1.fileURLToPath)(import.meta.url);
|
|
27
29
|
const __dirname = upath_1.default.dirname(__filename);
|
|
30
|
+
const args = (0, index_cjs_1.getArgs)();
|
|
31
|
+
const positional = args._ || [];
|
|
28
32
|
// Output path using centralized temp directory configuration
|
|
29
|
-
const
|
|
33
|
+
const FILENAME = (0, sbg_utility_1.md5)((positional[0] || 'default') + JSON.stringify(args));
|
|
34
|
+
const DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/${FILENAME}.txt`);
|
|
30
35
|
exports.DIFF_OUTPUT = DIFF_OUTPUT;
|
|
31
|
-
const GPT_DIFF_OUTPUT = (0,
|
|
36
|
+
const GPT_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/gpt-${FILENAME}.txt`);
|
|
32
37
|
exports.GPT_DIFF_OUTPUT = GPT_DIFF_OUTPUT;
|
|
33
38
|
const CACHE_DIR = upath_1.default.dirname(DIFF_OUTPUT);
|
|
34
39
|
exports.CACHE_DIR = CACHE_DIR;
|
|
@@ -38,20 +43,21 @@ exports.DIFF_OUTPUT_RELATIVE = DIFF_OUTPUT_RELATIVE;
|
|
|
38
43
|
const GPT_DIFF_OUTPUT_RELATIVE = upath_1.default.relative(process.cwd(), GPT_DIFF_OUTPUT);
|
|
39
44
|
exports.GPT_DIFF_OUTPUT_RELATIVE = GPT_DIFF_OUTPUT_RELATIVE;
|
|
40
45
|
// Ensure output directory exists
|
|
41
|
-
|
|
42
|
-
fs_extra_1.default.mkdirSync(CACHE_DIR, { recursive: true });
|
|
43
|
-
}
|
|
46
|
+
fs_extra_1.default.ensureDirSync(CACHE_DIR, { mode: 0o755 });
|
|
44
47
|
function showHelp() {
|
|
45
|
-
console.log(
|
|
46
|
-
console.log(
|
|
47
|
-
console.log(
|
|
48
|
-
console.log(
|
|
49
|
-
console.log(
|
|
50
|
-
console.log(
|
|
51
|
-
console.log(
|
|
52
|
-
console.log(
|
|
53
|
-
console.log(
|
|
54
|
-
console.log(
|
|
48
|
+
console.log('📋 Git Diff Helper');
|
|
49
|
+
console.log('Usage:');
|
|
50
|
+
console.log(' git-diff FILE Show staged diff of specified file');
|
|
51
|
+
console.log(' git-diff --staged-only Show staged diff of all files');
|
|
52
|
+
console.log(' git-diff -s | -S Same as --staged-only');
|
|
53
|
+
console.log(' git-diff --unstaged FILE Show unstaged diff of specified file');
|
|
54
|
+
console.log(' git-diff --unstaged Show unstaged diff of all files');
|
|
55
|
+
console.log(' git-diff -u Same as --unstaged');
|
|
56
|
+
console.log(' git-diff --ai Run ChatGPT automation for commit message');
|
|
57
|
+
console.log(' git-diff --help | -h Show this help message');
|
|
58
|
+
console.log('');
|
|
59
|
+
console.log(`💾 Output is saved to: ${DIFF_OUTPUT_RELATIVE}`);
|
|
60
|
+
console.log(`🤖 GPT prompt is saved to: ${GPT_DIFF_OUTPUT_RELATIVE}`);
|
|
55
61
|
process.exit(0);
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
@@ -64,6 +70,7 @@ function showHelp() {
|
|
|
64
70
|
* @param {string} command - The git command to execute (e.g., "git --no-pager diff --staged")
|
|
65
71
|
* @param {string} successMessage - Message to display when the command executes successfully
|
|
66
72
|
* @param {string} errorMessage - Message to display when the command fails
|
|
73
|
+
* @returns {boolean} True when diff content exists, false when no changes were found
|
|
67
74
|
*
|
|
68
75
|
* @throws {Error} Exits the process with code 1 if the git command fails
|
|
69
76
|
*
|
|
@@ -85,67 +92,174 @@ function showHelp() {
|
|
|
85
92
|
*/
|
|
86
93
|
function runGitDiff(command, successMessage, errorMessage) {
|
|
87
94
|
try {
|
|
88
|
-
console.log(
|
|
95
|
+
console.log(`ℹ️ Running command: ${command}`);
|
|
89
96
|
const result = (0, child_process_1.execSync)(command, {
|
|
90
|
-
encoding:
|
|
97
|
+
encoding: 'utf8',
|
|
91
98
|
maxBuffer: 1024 * 1024 * 10 // 10MB buffer to handle large diffs
|
|
92
99
|
});
|
|
93
100
|
// If result is empty, inform user but don't treat as error
|
|
94
|
-
if (!result || result.trim() ===
|
|
95
|
-
console.log(`ℹ️
|
|
96
|
-
|
|
101
|
+
if (!result || result.trim() === '') {
|
|
102
|
+
console.log(`ℹ️ No changes found for the specified criteria`);
|
|
103
|
+
(0, sbg_utility_1.writefile)(DIFF_OUTPUT, '# No changes found\n');
|
|
97
104
|
console.log(`✅ Empty diff saved to "${DIFF_OUTPUT_RELATIVE}"`);
|
|
98
|
-
return;
|
|
105
|
+
return false;
|
|
99
106
|
}
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
(0, sbg_utility_1.writefile)(DIFF_OUTPUT, result);
|
|
108
|
+
(0, sbg_utility_1.writefile)(GPT_DIFF_OUTPUT, `Hello!\nCan you create a conventional commit message by diff content below:\n\n\`\`\`${result}\n\`\`\`\n\nGive me result as codeblock with language "text" only.\n\nThank you!`);
|
|
102
109
|
console.log(`✅ ${successMessage}`);
|
|
103
|
-
console.log(`💾 GPT diff prompt saved to "${GPT_DIFF_OUTPUT_RELATIVE}"`);
|
|
110
|
+
console.log(`💾 GPT diff prompt saved to "${ansi_colors_1.default.green(GPT_DIFF_OUTPUT_RELATIVE)}"`);
|
|
111
|
+
return true;
|
|
104
112
|
}
|
|
105
113
|
catch (error) {
|
|
106
114
|
console.error(`❌ ${errorMessage}`);
|
|
107
|
-
console.error(
|
|
108
|
-
console.error(
|
|
115
|
+
console.error(`❌ Command: ${command}`);
|
|
116
|
+
console.error(`❌ Error: ${error.message}`);
|
|
109
117
|
// Check if it's a git-related error
|
|
110
|
-
if (error.message.includes(
|
|
111
|
-
console.error(
|
|
118
|
+
if (error.message.includes('not a git repository')) {
|
|
119
|
+
console.error('❌ Make sure you are in a git repository');
|
|
112
120
|
}
|
|
113
121
|
process.exit(1);
|
|
114
122
|
}
|
|
115
123
|
}
|
|
124
|
+
/**
|
|
125
|
+
* Generates diff-formatted output for untracked files.
|
|
126
|
+
* Uses `git ls-files --others --exclude-standard` to find untracked files,
|
|
127
|
+
* then creates synthetic git diff entries for each.
|
|
128
|
+
*
|
|
129
|
+
* @returns {string} Formatted diff content for untracked files, or empty string if none
|
|
130
|
+
*/
|
|
131
|
+
function getUntrackedDiff() {
|
|
132
|
+
try {
|
|
133
|
+
const untrackedStr = (0, child_process_1.execSync)('git ls-files --others --exclude-standard', {
|
|
134
|
+
encoding: 'utf8',
|
|
135
|
+
maxBuffer: 1024 * 1024 * 10
|
|
136
|
+
}).trim();
|
|
137
|
+
if (!untrackedStr)
|
|
138
|
+
return '';
|
|
139
|
+
const untrackedFiles = untrackedStr.split('\n').filter(function (f) {
|
|
140
|
+
return f;
|
|
141
|
+
});
|
|
142
|
+
if (untrackedFiles.length === 0)
|
|
143
|
+
return '';
|
|
144
|
+
var result = '\n# Untracked files:\n';
|
|
145
|
+
for (var i = 0; i < untrackedFiles.length; i++) {
|
|
146
|
+
var file = untrackedFiles[i];
|
|
147
|
+
if (!fs_extra_1.default.existsSync(file))
|
|
148
|
+
continue;
|
|
149
|
+
var stat = fs_extra_1.default.statSync(file);
|
|
150
|
+
if (!stat.isFile())
|
|
151
|
+
continue;
|
|
152
|
+
var content;
|
|
153
|
+
try {
|
|
154
|
+
content = fs_extra_1.default.readFileSync(file, 'utf8');
|
|
155
|
+
}
|
|
156
|
+
catch (_a) {
|
|
157
|
+
continue; // skip binary files
|
|
158
|
+
}
|
|
159
|
+
var lines = content.split('\n');
|
|
160
|
+
// Remove trailing empty line from split
|
|
161
|
+
if (lines.length > 0 && lines[lines.length - 1] === '') {
|
|
162
|
+
lines.pop();
|
|
163
|
+
}
|
|
164
|
+
result += 'diff --git a/' + file + ' b/' + file + '\n';
|
|
165
|
+
result += 'new file mode 100644\n';
|
|
166
|
+
result += 'index 0000000..0000000\n';
|
|
167
|
+
result += '--- /dev/null\n';
|
|
168
|
+
result += '+++ b/' + file + '\n';
|
|
169
|
+
result += '@@ -0,0 +1,' + (lines.length || 0) + ' @@\n';
|
|
170
|
+
for (var j = 0; j < lines.length; j++) {
|
|
171
|
+
result += '+' + lines[j] + '\n';
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return result;
|
|
175
|
+
}
|
|
176
|
+
catch (_b) {
|
|
177
|
+
return '';
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function fileHasChanges(file, mode) {
|
|
181
|
+
const command = mode === 'staged' ? `git diff --cached --quiet -- "${file}"` : `git diff --quiet -- "${file}"`;
|
|
182
|
+
try {
|
|
183
|
+
(0, child_process_1.execSync)(command, { stdio: 'ignore' });
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
catch (error) {
|
|
187
|
+
if (error.status === 1) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
throw error;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
116
193
|
function mainGitDiff() {
|
|
117
194
|
return __awaiter(this, void 0, void 0, function* () {
|
|
118
|
-
const args = (0, index_cjs_1.getArgs)();
|
|
119
|
-
const positional = args._ || [];
|
|
120
195
|
// Show help if no arguments or --help/-h is passed
|
|
121
196
|
if (args.help || args.h) {
|
|
122
197
|
showHelp();
|
|
123
198
|
}
|
|
124
|
-
|
|
125
|
-
|
|
199
|
+
const useUnstaged = args.unstaged || args.u;
|
|
200
|
+
const fileFromFlag = typeof args.unstaged === 'string' ? args.unstaged : typeof args.u === 'string' ? args.u : null;
|
|
201
|
+
let hasDiff = false;
|
|
202
|
+
if (args['staged-only'] || args.s || args.S) {
|
|
203
|
+
hasDiff = runGitDiff('git --no-pager diff --staged', `Full staged diff saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, 'Failed to save staged diff');
|
|
126
204
|
}
|
|
127
205
|
else {
|
|
128
206
|
// Handle specific file diff
|
|
129
|
-
const file = positional[0];
|
|
207
|
+
const file = positional[0] || fileFromFlag;
|
|
130
208
|
if (!file) {
|
|
131
|
-
|
|
209
|
+
const fullDiffModeLabel = useUnstaged ? 'unstaged' : 'unstaged';
|
|
210
|
+
hasDiff = runGitDiff('git --no-pager diff', `Full ${fullDiffModeLabel} diff saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, "Failed to save all diff's");
|
|
211
|
+
// Save untracked file diffs to separate file
|
|
212
|
+
const untrackedDiff = getUntrackedDiff();
|
|
213
|
+
if (untrackedDiff) {
|
|
214
|
+
const UNTRACKED_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/untracked-${FILENAME}.txt`);
|
|
215
|
+
const UNTRACKED_GPT_DIFF_OUTPUT = (0, config_cjs_1.getTempPath)(`git-diff/gpt-untracked-${FILENAME}.txt`);
|
|
216
|
+
const UNTRACKED_DIFF_OUTPUT_RELATIVE = upath_1.default.relative(process.cwd(), UNTRACKED_DIFF_OUTPUT);
|
|
217
|
+
(0, sbg_utility_1.writefile)(UNTRACKED_DIFF_OUTPUT, untrackedDiff);
|
|
218
|
+
(0, sbg_utility_1.writefile)(UNTRACKED_GPT_DIFF_OUTPUT, `Hello!\nCan you create a conventional commit message by diff content below:\n\n\`\`\`${untrackedDiff}\n\`\`\`\n\nGive me result as codeblock with language "text" only.\n\nThank you!`);
|
|
219
|
+
console.log(`✅ Untracked file diff saved to "${ansi_colors_1.default.green(UNTRACKED_DIFF_OUTPUT_RELATIVE)}"`);
|
|
220
|
+
console.log(`💾 AI diff prompt saved to "${ansi_colors_1.default.green(upath_1.default.relative(process.cwd(), UNTRACKED_GPT_DIFF_OUTPUT))}"`);
|
|
221
|
+
hasDiff = true;
|
|
222
|
+
}
|
|
132
223
|
}
|
|
133
224
|
else {
|
|
134
|
-
|
|
225
|
+
let fileDiffMode = useUnstaged ? 'unstaged' : 'staged';
|
|
226
|
+
// Default behavior for file target: prefer staged changes, then fall back to unstaged.
|
|
227
|
+
if (!useUnstaged && !fileHasChanges(file, 'staged') && fileHasChanges(file, 'unstaged')) {
|
|
228
|
+
fileDiffMode = 'unstaged';
|
|
229
|
+
}
|
|
230
|
+
hasDiff = runGitDiff(fileDiffMode === 'unstaged' ? `git --no-pager diff -- "${file}"` : `git --no-pager diff --cached -- "${file}"`, `${fileDiffMode[0].toUpperCase() + fileDiffMode.slice(1)} diff of "${file}" saved to "${ansi_colors_1.default.green(DIFF_OUTPUT_RELATIVE)}"`, `Failed to generate ${fileDiffMode} diff for "${file}"`);
|
|
135
231
|
}
|
|
136
232
|
}
|
|
233
|
+
if (hasDiff) {
|
|
234
|
+
// Generate command prompt for opencode CLI
|
|
235
|
+
const opencodePrompt = [
|
|
236
|
+
'',
|
|
237
|
+
'🤖 OpenCode Prompt Helper',
|
|
238
|
+
'────────────────────────',
|
|
239
|
+
'',
|
|
240
|
+
'📄 App Prompt:',
|
|
241
|
+
` Generate a conventional commit message from diff file: ${DIFF_OUTPUT}`,
|
|
242
|
+
'',
|
|
243
|
+
'💻 CLI Command:',
|
|
244
|
+
` opencode run "Generate a conventional commit message from diff file ${DIFF_OUTPUT}"`,
|
|
245
|
+
''
|
|
246
|
+
];
|
|
247
|
+
const opencodePromptPath = (0, config_cjs_1.getTempPath)(`git-diff/opencode-${FILENAME}.txt`);
|
|
248
|
+
(0, sbg_utility_1.writefile)(opencodePromptPath, opencodePrompt.join('\n'));
|
|
249
|
+
console.log(`✅ OpenCode prompt saved to "${ansi_colors_1.default.green(upath_1.default.relative(process.cwd(), opencodePromptPath))}"`);
|
|
250
|
+
}
|
|
137
251
|
// Generate commit message prompt from ChatGPT (only if --ai is specified)
|
|
138
252
|
if (args.ai) {
|
|
139
253
|
try {
|
|
140
254
|
yield (0, chatgpt_js_1.runChatGpt)({ headless: true, questionFile: GPT_DIFF_OUTPUT });
|
|
141
255
|
}
|
|
142
256
|
catch (error) {
|
|
143
|
-
console.error(
|
|
144
|
-
console.error(
|
|
257
|
+
console.error('❌ Error running ChatGPT:', error.message);
|
|
258
|
+
console.error('💡 Try running with visible browser mode or check if Chrome is installed');
|
|
145
259
|
}
|
|
146
260
|
}
|
|
147
261
|
else {
|
|
148
|
-
console.log(
|
|
262
|
+
console.log('💡 Use --ai flag to generate commit message with ChatGPT');
|
|
149
263
|
}
|
|
150
264
|
});
|
|
151
265
|
}
|
package/lib/git-diff.mjs
CHANGED
|
@@ -9,10 +9,11 @@ import {
|
|
|
9
9
|
git_diff_default,
|
|
10
10
|
mainGitDiff,
|
|
11
11
|
runGitDiff
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-2MN4VPV2.mjs";
|
|
13
|
+
import "./chunk-X2B3X7D4.mjs";
|
|
14
|
+
import "./chunk-GAGABICI.mjs";
|
|
15
|
+
import "./chunk-H44UWUFY.mjs";
|
|
16
|
+
import "./chunk-6RK5UCTP.mjs";
|
|
16
17
|
import "./chunk-QQ4A6DLD.mjs";
|
|
17
18
|
export {
|
|
18
19
|
CACHE_DIR,
|
package/lib/git-fix.cjs
CHANGED
|
@@ -349,9 +349,9 @@ var require_utils2 = __commonJS({
|
|
|
349
349
|
init_cjs_shims();
|
|
350
350
|
var fs = require("fs");
|
|
351
351
|
var path2 = require("upath");
|
|
352
|
-
var
|
|
352
|
+
var minimistLib = require("minimist");
|
|
353
|
+
var argv = minimistLib(process.argv.slice(2));
|
|
353
354
|
var { exec } = require("child_process");
|
|
354
|
-
var { URL: URL2 } = require("url");
|
|
355
355
|
var { promisify } = require("util");
|
|
356
356
|
var execAsync = promisify(exec);
|
|
357
357
|
async function parseGitRemotes() {
|
|
@@ -364,7 +364,7 @@ var require_utils2 = __commonJS({
|
|
|
364
364
|
if (name && url) {
|
|
365
365
|
const [repoUrl] = url.split(" ");
|
|
366
366
|
try {
|
|
367
|
-
const parsedUrl = new
|
|
367
|
+
const parsedUrl = new URL(repoUrl);
|
|
368
368
|
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
369
369
|
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
370
370
|
let repoPath = pathParts.join("/");
|
|
@@ -385,15 +385,10 @@ var require_utils2 = __commonJS({
|
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
387
|
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
388
|
-
function
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
388
|
+
function getArgs2(opts) {
|
|
389
|
+
if (opts) {
|
|
390
|
+
return minimistLib(process.argv.slice(2), opts);
|
|
392
391
|
}
|
|
393
|
-
return fullPath;
|
|
394
|
-
}
|
|
395
|
-
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
396
|
-
function getArgs2() {
|
|
397
392
|
return argv;
|
|
398
393
|
}
|
|
399
394
|
module2.exports.getArgs = getArgs2;
|
|
@@ -418,7 +413,7 @@ var require_utils2 = __commonJS({
|
|
|
418
413
|
try {
|
|
419
414
|
fs.rmdirSync(fullPath);
|
|
420
415
|
console.log("deleted", fullPath);
|
|
421
|
-
} catch (
|
|
416
|
+
} catch (_e) {
|
|
422
417
|
try {
|
|
423
418
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
424
419
|
console.log("deleted", fullPath);
|
|
@@ -431,7 +426,7 @@ var require_utils2 = __commonJS({
|
|
|
431
426
|
try {
|
|
432
427
|
fs.unlinkSync(fullPath);
|
|
433
428
|
console.log("deleted", fullPath);
|
|
434
|
-
} catch (
|
|
429
|
+
} catch (_e) {
|
|
435
430
|
try {
|
|
436
431
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
437
432
|
console.log("deleted", fullPath);
|
|
@@ -522,7 +517,7 @@ var require_user_config = __commonJS({
|
|
|
522
517
|
var gch = require("git-command-helper");
|
|
523
518
|
var { runGitCommand, runGitCommandOutput } = require_utils();
|
|
524
519
|
var { getArgs: getArgs2 } = require_utils2();
|
|
525
|
-
require("dotenv").config({ path: require("
|
|
520
|
+
require("dotenv").config({ path: require("upath").join(process.cwd(), ".env"), quiet: true });
|
|
526
521
|
function configureGitUser2(cliUser = null, cliEmail = null, options2 = {}) {
|
|
527
522
|
console.log("\n=== Configuring Git User ===");
|
|
528
523
|
let username, email;
|
package/lib/git-fix.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
} from "./chunk-A2JQXI5Z.mjs";
|
|
6
6
|
import {
|
|
7
7
|
require_user_config
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MGPYPKIE.mjs";
|
|
9
9
|
import {
|
|
10
10
|
require_line_endings
|
|
11
11
|
} from "./chunk-ZDMWBSYF.mjs";
|
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
} from "./chunk-A3VUZEJK.mjs";
|
|
22
22
|
import {
|
|
23
23
|
require_utils
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-6RK5UCTP.mjs";
|
|
25
25
|
import {
|
|
26
26
|
__commonJS,
|
|
27
27
|
__require,
|
package/lib/git-purge.cjs
CHANGED
|
@@ -19,9 +19,9 @@ var require_utils = __commonJS({
|
|
|
19
19
|
init_cjs_shims();
|
|
20
20
|
var fs = require("fs");
|
|
21
21
|
var path2 = require("upath");
|
|
22
|
-
var
|
|
22
|
+
var minimistLib = require("minimist");
|
|
23
|
+
var argv = minimistLib(process.argv.slice(2));
|
|
23
24
|
var { exec } = require("child_process");
|
|
24
|
-
var { URL: URL2 } = require("url");
|
|
25
25
|
var { promisify } = require("util");
|
|
26
26
|
var execAsync = promisify(exec);
|
|
27
27
|
async function parseGitRemotes() {
|
|
@@ -34,7 +34,7 @@ var require_utils = __commonJS({
|
|
|
34
34
|
if (name && url) {
|
|
35
35
|
const [repoUrl] = url.split(" ");
|
|
36
36
|
try {
|
|
37
|
-
const parsedUrl = new
|
|
37
|
+
const parsedUrl = new URL(repoUrl);
|
|
38
38
|
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
39
39
|
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
40
40
|
let repoPath = pathParts.join("/");
|
|
@@ -55,15 +55,10 @@ var require_utils = __commonJS({
|
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
58
|
-
function
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
58
|
+
function getArgs(opts) {
|
|
59
|
+
if (opts) {
|
|
60
|
+
return minimistLib(process.argv.slice(2), opts);
|
|
62
61
|
}
|
|
63
|
-
return fullPath;
|
|
64
|
-
}
|
|
65
|
-
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
66
|
-
function getArgs() {
|
|
67
62
|
return argv;
|
|
68
63
|
}
|
|
69
64
|
module2.exports.getArgs = getArgs;
|
|
@@ -88,7 +83,7 @@ var require_utils = __commonJS({
|
|
|
88
83
|
try {
|
|
89
84
|
fs.rmdirSync(fullPath);
|
|
90
85
|
console.log("deleted", fullPath);
|
|
91
|
-
} catch (
|
|
86
|
+
} catch (_e) {
|
|
92
87
|
try {
|
|
93
88
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
94
89
|
console.log("deleted", fullPath);
|
|
@@ -101,7 +96,7 @@ var require_utils = __commonJS({
|
|
|
101
96
|
try {
|
|
102
97
|
fs.unlinkSync(fullPath);
|
|
103
98
|
console.log("deleted", fullPath);
|
|
104
|
-
} catch (
|
|
99
|
+
} catch (_e) {
|
|
105
100
|
try {
|
|
106
101
|
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
107
102
|
console.log("deleted", fullPath);
|
|
@@ -189,7 +184,7 @@ var require_utils = __commonJS({
|
|
|
189
184
|
init_cjs_shims();
|
|
190
185
|
var { spawnAsync } = require("cross-spawn");
|
|
191
186
|
var glob = require("glob");
|
|
192
|
-
var path = require("
|
|
187
|
+
var path = require("upath");
|
|
193
188
|
var { delay } = require_utils();
|
|
194
189
|
var dirs = [];
|
|
195
190
|
var fetchDirs = (pattern, callback) => {
|
package/lib/git-purge.mjs
CHANGED
|
@@ -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-
|
|
4
|
+
} from "./chunk-6RK5UCTP.mjs";
|
|
5
5
|
import {
|
|
6
6
|
__commonJS,
|
|
7
7
|
__require,
|
|
@@ -14,7 +14,7 @@ var require_git_purge = __commonJS({
|
|
|
14
14
|
init_esm_shims();
|
|
15
15
|
var { spawnAsync } = __require("cross-spawn");
|
|
16
16
|
var glob = __require("glob");
|
|
17
|
-
var path = __require("
|
|
17
|
+
var path = __require("upath");
|
|
18
18
|
var { delay } = require_utils();
|
|
19
19
|
var dirs = [];
|
|
20
20
|
var fetchDirs = (pattern, callback) => {
|
package/lib/index.cjs
CHANGED
|
@@ -43,7 +43,7 @@ var require_find_node_modules = __commonJS({
|
|
|
43
43
|
"src/find-node-modules.cjs"(exports2, module2) {
|
|
44
44
|
init_cjs_shims();
|
|
45
45
|
var glob = require("glob");
|
|
46
|
-
var path = require("
|
|
46
|
+
var path = require("upath");
|
|
47
47
|
function findNodeModules2(dir = process.cwd(), callback = null) {
|
|
48
48
|
const finalDir = typeof dir === "string" ? dir : process.cwd();
|
|
49
49
|
return new Promise((resolve, reject) => {
|
package/lib/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { findNodeModules } from
|
|
1
|
+
import { findNodeModules } from './find-node-modules.cjs';
|
|
2
2
|
export { findNodeModules };
|
package/lib/index.mjs
CHANGED
package/lib/kill-night-crows.cjs
CHANGED
|
@@ -65,19 +65,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
|
|
|
65
65
|
process.exit(0);
|
|
66
66
|
}
|
|
67
67
|
if (!scriptPath) {
|
|
68
|
-
console.error(
|
|
69
|
-
|
|
68
|
+
console.error(
|
|
69
|
+
`PowerShell script not found in any of these paths:
|
|
70
|
+
${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
|
|
71
|
+
);
|
|
70
72
|
process.exit(1);
|
|
71
73
|
}
|
|
72
74
|
if (process.platform !== "win32") {
|
|
73
75
|
console.error("kill-night-crows is supported only on Windows.");
|
|
74
76
|
process.exit(1);
|
|
75
77
|
}
|
|
76
|
-
var result = (0, import_node_child_process.spawnSync)(
|
|
77
|
-
"
|
|
78
|
-
|
|
79
|
-
{ stdio: "inherit" }
|
|
80
|
-
);
|
|
78
|
+
var result = (0, import_node_child_process.spawnSync)("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
|
|
79
|
+
stdio: "inherit"
|
|
80
|
+
});
|
|
81
81
|
if (typeof result.status === "number") {
|
|
82
82
|
process.exit(result.status);
|
|
83
83
|
}
|
package/lib/kill-night-crows.mjs
CHANGED
|
@@ -43,19 +43,19 @@ ${scriptChecks.map((check) => ` ${check.exists ? "found" : "missing"} - ${check
|
|
|
43
43
|
process.exit(0);
|
|
44
44
|
}
|
|
45
45
|
if (!scriptPath) {
|
|
46
|
-
console.error(
|
|
47
|
-
|
|
46
|
+
console.error(
|
|
47
|
+
`PowerShell script not found in any of these paths:
|
|
48
|
+
${scriptCandidates.map((p) => ` - ${p}`).join("\n")}`
|
|
49
|
+
);
|
|
48
50
|
process.exit(1);
|
|
49
51
|
}
|
|
50
52
|
if (process.platform !== "win32") {
|
|
51
53
|
console.error("kill-night-crows is supported only on Windows.");
|
|
52
54
|
process.exit(1);
|
|
53
55
|
}
|
|
54
|
-
var result = spawnSync(
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
{ stdio: "inherit" }
|
|
58
|
-
);
|
|
56
|
+
var result = spawnSync("powershell.exe", ["-NoProfile", "-ExecutionPolicy", "Bypass", "-File", scriptPath, ...args], {
|
|
57
|
+
stdio: "inherit"
|
|
58
|
+
});
|
|
59
59
|
if (typeof result.status === "number") {
|
|
60
60
|
process.exit(result.status);
|
|
61
61
|
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
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
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// src/node-cache-cleaner/npm.ts
|
|
20
|
+
var npm_exports = {};
|
|
21
|
+
__export(npm_exports, {
|
|
22
|
+
cleanNpmCache: () => cleanNpmCache,
|
|
23
|
+
npmVersion: () => npmVersion
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(npm_exports);
|
|
26
|
+
var import_cross_spawn = require("cross-spawn");
|
|
27
|
+
function npmVersion() {
|
|
28
|
+
return new Promise((resolve, reject) => {
|
|
29
|
+
const process = (0, import_cross_spawn.spawn)("npm", ["--version"], {
|
|
30
|
+
stdio: "pipe",
|
|
31
|
+
shell: true
|
|
32
|
+
});
|
|
33
|
+
let version = "";
|
|
34
|
+
process.stdout.on("data", (data) => {
|
|
35
|
+
version += data.toString();
|
|
36
|
+
});
|
|
37
|
+
process.on("close", (code) => {
|
|
38
|
+
if (code === 0) {
|
|
39
|
+
resolve(version.trim());
|
|
40
|
+
} else {
|
|
41
|
+
reject(new Error(`NPM version check failed with exit code ${code}`));
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
function cleanNpmCache() {
|
|
47
|
+
return new Promise((resolve, reject) => {
|
|
48
|
+
const process = (0, import_cross_spawn.spawn)("npm", ["cache", "clean", "--force"], {
|
|
49
|
+
stdio: "inherit",
|
|
50
|
+
shell: true
|
|
51
|
+
});
|
|
52
|
+
process.on("close", (code) => {
|
|
53
|
+
if (code === 0) {
|
|
54
|
+
resolve(true);
|
|
55
|
+
} else {
|
|
56
|
+
reject(new Error(`NPM cache clean failed with exit code ${code}`));
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
62
|
+
0 && (module.exports = {
|
|
63
|
+
cleanNpmCache,
|
|
64
|
+
npmVersion
|
|
65
|
+
});
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.npmVersion = npmVersion;
|
|
4
|
+
exports.cleanNpmCache = cleanNpmCache;
|
|
5
|
+
const cross_spawn_1 = require("cross-spawn");
|
|
6
|
+
function npmVersion() {
|
|
7
|
+
return new Promise((resolve, reject) => {
|
|
8
|
+
const process = (0, cross_spawn_1.spawn)('npm', ['--version'], {
|
|
9
|
+
stdio: 'pipe',
|
|
10
|
+
shell: true
|
|
11
|
+
});
|
|
12
|
+
let version = '';
|
|
13
|
+
process.stdout.on('data', (data) => {
|
|
14
|
+
version += data.toString();
|
|
15
|
+
});
|
|
16
|
+
process.on('close', (code) => {
|
|
17
|
+
if (code === 0) {
|
|
18
|
+
resolve(version.trim());
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
reject(new Error(`NPM version check failed with exit code ${code}`));
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function cleanNpmCache() {
|
|
27
|
+
return new Promise((resolve, reject) => {
|
|
28
|
+
const process = (0, cross_spawn_1.spawn)('npm', ['cache', 'clean', '--force'], {
|
|
29
|
+
stdio: 'inherit',
|
|
30
|
+
shell: true
|
|
31
|
+
});
|
|
32
|
+
process.on('close', (code) => {
|
|
33
|
+
if (code === 0) {
|
|
34
|
+
resolve(true);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
reject(new Error(`NPM cache clean failed with exit code ${code}`));
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
}
|