binary-collections 2.0.6 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/dir-tree.cmd +7 -0
- package/bin/git-diff +4 -0
- package/bin/git-diff.cmd +7 -0
- package/bin/{git-fix-encoding → git-fix} +1 -4
- package/bin/git-fix.cmd +7 -0
- package/bin/nodekill +0 -0
- package/bin/nodekill.cmd +0 -0
- package/bin/{submodule-install → submodule-install.txt} +0 -0
- package/bin/{submodule → submodule.txt} +0 -0
- package/lib/binary-collections-config.cjs +14 -0
- package/lib/binary-collections-config.d.mts +18 -0
- package/lib/binary-collections-config.d.ts +16 -0
- package/lib/binary-collections-config.js +39 -0
- package/lib/binary-collections-config.mjs +6 -0
- package/lib/binary-collections.cjs +105 -0
- package/lib/binary-collections.d.cts +2 -0
- package/lib/binary-collections.d.mts +121 -0
- package/lib/binary-collections.d.ts +121 -0
- package/lib/binary-collections.mjs +108 -0
- package/lib/chunk-4BYBVEYC.mjs +30 -0
- package/lib/chunk-AASHBCRW.mjs +57 -0
- package/lib/chunk-APBWENF6.mjs +135 -0
- package/lib/{chunk-M4IBUK4H.mjs → chunk-DPKAJKFO.mjs} +2 -4
- package/lib/chunk-EGSSKVDH.mjs +66 -0
- package/lib/{chunk-GA4DDV65.mjs → chunk-G3THLIDT.mjs} +3 -5
- package/lib/chunk-JGR2NW6D.mjs +187 -0
- package/lib/chunk-ONIBBBQ3.mjs +108 -0
- package/lib/chunk-SH3L6HHV.mjs +27 -0
- package/lib/chunk-VVEZVNIV.mjs +81 -0
- package/lib/{chunk-E75HJFJO.mjs → chunk-W3ENOM53.mjs} +2 -4
- package/lib/chunk-YV7DO3YV.mjs +48 -0
- package/lib/chunk-YX5U7XDR.mjs +58 -0
- package/lib/chunk-ZYAQRPUL.mjs +28 -0
- package/lib/clean-github-actions-caches.cjs +162 -0
- package/lib/clean-github-actions-caches.d.cts +1 -0
- package/lib/clean-github-actions-caches.d.mts +169 -0
- package/lib/clean-github-actions-caches.d.ts +169 -0
- package/lib/clean-github-actions-caches.mjs +132 -0
- package/lib/del-gradle.cjs +99 -15
- package/lib/del-gradle.d.ts +1 -2
- package/lib/del-gradle.js +12 -69
- package/lib/del-gradle.mjs +4 -6
- package/lib/del-node-modules.cjs +98 -14
- package/lib/del-node-modules.d.ts +1 -2
- package/lib/del-node-modules.js +11 -68
- package/lib/del-node-modules.mjs +3 -5
- package/lib/del-ps.cjs +98 -627
- package/lib/del-ps.d.ts +1 -2
- package/lib/del-ps.js +27 -702
- package/lib/del-ps.mjs +7 -12
- package/lib/del-yarn-caches.cjs +98 -14
- package/lib/del-yarn-caches.d.ts +1 -2
- package/lib/del-yarn-caches.js +6 -63
- package/lib/del-yarn-caches.mjs +3 -5
- package/lib/find-node-modules-cli.cjs +67 -0
- package/lib/find-node-modules-cli.d.mts +1 -0
- package/lib/find-node-modules-cli.d.ts +2 -0
- package/lib/find-node-modules-cli.js +3 -0
- package/lib/find-node-modules-cli.mjs +13 -0
- package/lib/find-node-modules.cjs +39 -9
- package/lib/find-node-modules.d.mts +12 -1
- package/lib/find-node-modules.d.ts +12 -2
- package/lib/find-node-modules.js +53 -12
- package/lib/find-node-modules.mjs +4 -19
- package/lib/git/gitattributes.cjs +171 -0
- package/lib/git/gitattributes.d.mts +35 -0
- package/lib/git/gitattributes.d.ts +33 -0
- package/lib/git/gitattributes.js +223 -0
- package/lib/git/gitattributes.mjs +6 -0
- package/lib/git/line-endings.cjs +74 -0
- package/lib/git/line-endings.d.cts +7 -0
- package/lib/git/line-endings.d.mts +83 -0
- package/lib/git/line-endings.d.ts +83 -0
- package/lib/git/line-endings.mjs +8 -0
- package/lib/git/normalize.cjs +42 -0
- package/lib/git/normalize.d.cts +6 -0
- package/lib/git/normalize.d.mts +43 -0
- package/lib/git/normalize.d.ts +43 -0
- package/lib/git/normalize.mjs +6 -0
- package/lib/git/permissions.cjs +15 -0
- package/lib/git/permissions.d.cts +6 -0
- package/lib/git/permissions.d.mts +17 -0
- package/lib/git/permissions.d.ts +17 -0
- package/lib/git/permissions.mjs +7 -0
- package/lib/git/pull-strategy.cjs +13 -0
- package/lib/git/pull-strategy.d.cts +5 -0
- package/lib/git/pull-strategy.d.mts +15 -0
- package/lib/git/pull-strategy.d.ts +15 -0
- package/lib/git/pull-strategy.mjs +7 -0
- package/lib/git/user-config.cjs +100 -0
- package/lib/git/user-config.d.cts +10 -0
- package/lib/git/user-config.d.mts +105 -0
- package/lib/git/user-config.d.ts +105 -0
- package/lib/git/user-config.mjs +8 -0
- package/lib/git/utils.cjs +70 -0
- package/lib/git/utils.d.cts +20 -0
- package/lib/git/utils.d.mts +69 -0
- package/lib/git/utils.d.ts +69 -0
- package/lib/git/utils.mjs +6 -0
- package/lib/git-diff.cjs +73 -0
- package/lib/git-diff.d.cts +2 -0
- package/lib/git-diff.d.mts +84 -0
- package/lib/git-diff.d.ts +84 -0
- package/lib/git-diff.mjs +88 -0
- package/lib/git-fix.cjs +129 -0
- package/lib/git-fix.d.cts +2 -0
- package/lib/git-fix.d.mts +141 -0
- package/lib/git-fix.d.ts +141 -0
- package/lib/git-fix.mjs +151 -0
- package/lib/git-purge.cjs +92 -621
- package/lib/git-purge.d.ts +1 -2
- package/lib/git-purge.js +53 -698
- package/lib/git-purge.mjs +4 -9
- package/lib/index.cjs +99 -1
- package/lib/index.d.mts +1 -2
- package/lib/index.d.ts +2 -2
- package/lib/index.js +8 -2
- package/lib/index.mjs +10 -3
- package/lib/npm-run-series.cjs +140 -1
- package/lib/npm-run-series.d.ts +1 -0
- package/lib/npm-run-series.js +81 -56
- package/lib/npm-run-series.mjs +7 -5
- package/lib/package-resolutions-updater.cjs +274 -0
- package/lib/package-resolutions-updater.d.mts +1 -0
- package/lib/package-resolutions-updater.d.ts +326 -0
- package/lib/package-resolutions-updater.mjs +316 -0
- package/lib/print-directory-tree.cjs +241 -0
- package/lib/print-directory-tree.d.cts +1 -0
- package/lib/print-directory-tree.d.mts +234 -0
- package/lib/print-directory-tree.d.ts +234 -0
- package/lib/print-directory-tree.mjs +182 -0
- package/lib/ps/connected-domain.cjs +0 -0
- package/lib/ps/connected-domain.d.ts +1 -2
- package/lib/ps/connected-domain.js +196 -150
- package/lib/ps/connected-domain.mjs +2 -3
- package/lib/ps/index.cjs +3 -3
- package/lib/ps/index.d.mjs +1 -2
- package/lib/ps/index.d.ts +2 -26
- package/lib/ps/index.js +233 -535
- package/lib/ps/index.mjs +9 -11
- package/lib/ps/isWin.cjs +0 -0
- package/lib/ps/isWin.d.ts +1 -2
- package/lib/ps/isWin.js +1 -2
- package/lib/ps/isWin.mjs +2 -3
- package/lib/ps/table-parser.cjs +0 -0
- package/lib/ps/table-parser.d.ts +1 -3
- package/lib/ps/table-parser.js +254 -345
- package/lib/ps/table-parser.mjs +3 -4
- package/lib/submodule-install.cjs +100 -0
- package/lib/submodule-install.d.cts +2 -0
- package/lib/submodule-install.d.mts +121 -0
- package/lib/submodule-install.d.ts +121 -0
- package/lib/submodule-install.mjs +107 -0
- package/lib/utils.cjs +98 -14
- package/lib/utils.d.mts +29 -9
- package/lib/utils.d.ts +30 -14
- package/lib/utils.js +173 -27
- package/lib/utils.mjs +2 -3
- package/lib/yarn-reinstall.cjs +44 -0
- package/lib/yarn-reinstall.d.cts +1 -0
- package/lib/yarn-reinstall.d.mts +49 -0
- package/lib/yarn-reinstall.d.ts +49 -0
- package/lib/yarn-reinstall.mjs +54 -0
- package/package.json +126 -99
- package/readme.md +238 -50
- package/src/package-resolutions-updater.mjs +325 -0
- package/src/print-directory-tree.cjs +234 -0
- package/src/ps/index.js +4 -3
- package/src/yarn-reinstall.cjs +49 -0
- package/test-project/package.json +16 -0
- package/tmp/test-repo/package.json +7 -0
- package/bin/git-fix-encoding.cmd +0 -6
- package/eslint.config.cjs +0 -97
- package/lib/chunk-7MSZ52XC.mjs +0 -14
- package/lib/chunk-AVDT32AY.mjs +0 -20
- package/lib/chunk-LPLPQBYP.mjs +0 -53
- package/lib/chunk-S4SJ7SDW.mjs +0 -625
- package/lib/package-resolutions.cjs +0 -28
- package/lib/package-resolutions.d.mts +0 -25
- package/lib/package-resolutions.d.ts +0 -25
- package/lib/package-resolutions.js +0 -28
- package/lib/package-resolutions.mjs +0 -31
- package/lib/ps/index.d.js +0 -17
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
require_utils
|
|
4
|
+
} from "./chunk-APBWENF6.mjs";
|
|
5
|
+
import {
|
|
6
|
+
__commonJS,
|
|
7
|
+
__require,
|
|
8
|
+
init_esm_shims
|
|
9
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
10
|
+
|
|
11
|
+
// src/clean-github-actions-caches.cjs
|
|
12
|
+
var require_clean_github_actions_caches = __commonJS({
|
|
13
|
+
"src/clean-github-actions-caches.cjs"() {
|
|
14
|
+
init_esm_shims();
|
|
15
|
+
var axios = __require("axios");
|
|
16
|
+
var { parseGitRemotes } = require_utils();
|
|
17
|
+
var path = __require("upath");
|
|
18
|
+
var fs = __require("fs");
|
|
19
|
+
var projectDir = process.cwd();
|
|
20
|
+
var envPath = path.join(projectDir, ".env");
|
|
21
|
+
if (fs.existsSync(envPath)) {
|
|
22
|
+
__require("dotenv").config({ path: envPath });
|
|
23
|
+
} else {
|
|
24
|
+
console.warn(`.env file not found at ${envPath}`);
|
|
25
|
+
}
|
|
26
|
+
var ACCESS_TOKEN = process.env.ACCESS_TOKEN || process.env.GITHUB_TOKEN;
|
|
27
|
+
if (!ACCESS_TOKEN) {
|
|
28
|
+
throw new Error(
|
|
29
|
+
"Access token is not provided. Please set ACCESS_TOKEN or GITHUB_TOKEN in your environment variables."
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
function deleteGitHubActionsCache(GH_REPO, cacheId) {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches/${cacheId}`;
|
|
35
|
+
const token = ACCESS_TOKEN;
|
|
36
|
+
if (!token) {
|
|
37
|
+
return reject(new Error("Access token is not provided"));
|
|
38
|
+
}
|
|
39
|
+
axios.delete(url, {
|
|
40
|
+
headers: {
|
|
41
|
+
Authorization: `token ${token}`,
|
|
42
|
+
Accept: "application/vnd.github.v3+json"
|
|
43
|
+
}
|
|
44
|
+
}).then((response) => {
|
|
45
|
+
console.log(`Cache (${cacheId}) deleted successfully`, response.data);
|
|
46
|
+
resolve(response.data);
|
|
47
|
+
}).catch((error) => {
|
|
48
|
+
var _a;
|
|
49
|
+
console.error("Error deleting cache:", ((_a = error.response) == null ? void 0 : _a.data) || error.message || "Unknown error");
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function get_caches(GH_REPO) {
|
|
55
|
+
const url = `https://api.github.com/repos/${GH_REPO}/actions/caches`;
|
|
56
|
+
return new Promise((resolve, reject) => {
|
|
57
|
+
axios.get(url, {
|
|
58
|
+
headers: {
|
|
59
|
+
Accept: "application/vnd.github.v3+json",
|
|
60
|
+
Authorization: `token ${ACCESS_TOKEN}`
|
|
61
|
+
}
|
|
62
|
+
}).then((response) => {
|
|
63
|
+
const data = response.data.actions_caches;
|
|
64
|
+
const getPrefix = (key) => {
|
|
65
|
+
const split = key.split(/[-_]/);
|
|
66
|
+
if (split.length == 3) {
|
|
67
|
+
return `${split[0]}-${split[1]}`;
|
|
68
|
+
} else if (split.length > 3) {
|
|
69
|
+
return `${split[0]}-${split[1]}-${split[2]}`;
|
|
70
|
+
}
|
|
71
|
+
return split[0];
|
|
72
|
+
};
|
|
73
|
+
const grouped = data.reduce(
|
|
74
|
+
/**
|
|
75
|
+
* @param {Record<string, Record<string, any>[]>} acc
|
|
76
|
+
* @param {Record<string, any>} item
|
|
77
|
+
* @returns {Record<string, Record<string, any>[]>}
|
|
78
|
+
*/
|
|
79
|
+
(acc, item) => {
|
|
80
|
+
const prefix = getPrefix(item.key);
|
|
81
|
+
if (!acc[prefix]) {
|
|
82
|
+
acc[prefix] = [];
|
|
83
|
+
}
|
|
84
|
+
acc[prefix].push(item);
|
|
85
|
+
return acc;
|
|
86
|
+
},
|
|
87
|
+
{}
|
|
88
|
+
);
|
|
89
|
+
resolve(grouped);
|
|
90
|
+
}).catch((error) => {
|
|
91
|
+
console.error("Error fetching data:", error);
|
|
92
|
+
reject(error);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
(async () => {
|
|
97
|
+
try {
|
|
98
|
+
const remotes = await parseGitRemotes();
|
|
99
|
+
const GH_REPO = remotes.origin;
|
|
100
|
+
const caches = await get_caches(GH_REPO);
|
|
101
|
+
for (const key in caches) {
|
|
102
|
+
if (Object.hasOwnProperty.call(caches, key)) {
|
|
103
|
+
const items = caches[key].sort((a, b) => new Date(b.created_at) - new Date(a.created_at)).map((item) => ({
|
|
104
|
+
...item,
|
|
105
|
+
human_readable_date: new Date(item.created_at).toLocaleString()
|
|
106
|
+
}));
|
|
107
|
+
if (items.length > 1) {
|
|
108
|
+
const ids = items.map((o) => o.id);
|
|
109
|
+
ids.shift();
|
|
110
|
+
if (ids.length > 0) {
|
|
111
|
+
for (const id of ids) {
|
|
112
|
+
try {
|
|
113
|
+
await deleteGitHubActionsCache(GH_REPO, id);
|
|
114
|
+
} catch (err) {
|
|
115
|
+
console.error(`Error deleting cache ${id}:`, err);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
console.log(`cache prefix ${key} no cache left`);
|
|
120
|
+
}
|
|
121
|
+
} else {
|
|
122
|
+
console.log(`cache prefix ${key} only have 1 cache`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
} catch (e) {
|
|
127
|
+
console.error(`Error: ${e}`);
|
|
128
|
+
}
|
|
129
|
+
})();
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
export default require_clean_github_actions_caches();
|
package/lib/del-gradle.cjs
CHANGED
|
@@ -16,23 +16,56 @@ var init_cjs_shims = __esm({
|
|
|
16
16
|
var require_utils = __commonJS({
|
|
17
17
|
"src/utils.js"(exports2, module2) {
|
|
18
18
|
init_cjs_shims();
|
|
19
|
-
var
|
|
19
|
+
var fs = require("fs");
|
|
20
|
+
var path2 = require("upath");
|
|
20
21
|
var argv = require("minimist")(process.argv.slice(2));
|
|
22
|
+
var { exec } = require("child_process");
|
|
23
|
+
var { URL: URL2 } = require("url");
|
|
24
|
+
var { promisify } = require("util");
|
|
25
|
+
var execAsync = promisify(exec);
|
|
26
|
+
async function parseGitRemotes() {
|
|
27
|
+
try {
|
|
28
|
+
const { stdout } = await execAsync("git remote -v");
|
|
29
|
+
const lines = stdout.split("\n");
|
|
30
|
+
const remotes = {};
|
|
31
|
+
lines.forEach((line) => {
|
|
32
|
+
const [name, url] = line.split(" ");
|
|
33
|
+
if (name && url) {
|
|
34
|
+
const [repoUrl] = url.split(" ");
|
|
35
|
+
try {
|
|
36
|
+
const parsedUrl = new URL2(repoUrl);
|
|
37
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
38
|
+
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
39
|
+
let repoPath = pathParts.join("/");
|
|
40
|
+
if (repoPath.endsWith(".git")) {
|
|
41
|
+
repoPath = repoPath.slice(0, -4);
|
|
42
|
+
}
|
|
43
|
+
remotes[name] = repoPath;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error("URL Parsing Error:", e.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return remotes;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("Error:", error.message);
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
57
|
+
function joinPathPreserveDriveLetter(...segments) {
|
|
58
|
+
let fullPath = require("path").join(...segments);
|
|
59
|
+
if (/^[a-z]:\\/.test(fullPath)) {
|
|
60
|
+
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
61
|
+
}
|
|
62
|
+
return fullPath;
|
|
63
|
+
}
|
|
64
|
+
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
21
65
|
function getArgs() {
|
|
22
66
|
return argv;
|
|
23
67
|
}
|
|
24
|
-
|
|
25
|
-
globStream2.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path2.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del2(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del2(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
68
|
+
module2.exports.getArgs = getArgs;
|
|
36
69
|
function del2(fullPath) {
|
|
37
70
|
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
71
|
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
@@ -48,15 +81,66 @@ var require_utils = __commonJS({
|
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
83
|
}
|
|
84
|
+
module2.exports.del = del2;
|
|
85
|
+
function delStream(globStream2) {
|
|
86
|
+
globStream2.stream().on("data", (result) => {
|
|
87
|
+
const fullPath = path2.resolve(process.cwd(), result);
|
|
88
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
89
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
90
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
91
|
+
del2(subdir[i]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
del2(fullPath);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
module2.exports.delStream = delStream;
|
|
98
|
+
function getFileTreeString(hashArray) {
|
|
99
|
+
const tree = {};
|
|
100
|
+
const hashMap = {};
|
|
101
|
+
for (const entry of hashArray) {
|
|
102
|
+
const [filePath, hash] = entry.split(" ");
|
|
103
|
+
hashMap[filePath] = hash;
|
|
104
|
+
const parts = filePath.split("/");
|
|
105
|
+
let current = tree;
|
|
106
|
+
for (let i = 0; i < parts.length; i++) {
|
|
107
|
+
const part = parts[i];
|
|
108
|
+
if (i === parts.length - 1) {
|
|
109
|
+
current[part] = null;
|
|
110
|
+
} else {
|
|
111
|
+
current[part] = current[part] || {};
|
|
112
|
+
current = current[part];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function printNode(node, prefix = "", parentPath = "") {
|
|
117
|
+
const keys = Object.keys(node).sort();
|
|
118
|
+
let lines = [];
|
|
119
|
+
keys.forEach((key, idx) => {
|
|
120
|
+
const isLast = idx === keys.length - 1;
|
|
121
|
+
const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
122
|
+
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
123
|
+
if (node[key] === null) {
|
|
124
|
+
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
125
|
+
} else {
|
|
126
|
+
lines.push(prefix + branch + key + "/");
|
|
127
|
+
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return lines;
|
|
131
|
+
}
|
|
132
|
+
return printNode(tree, "", "").join("\n");
|
|
133
|
+
}
|
|
134
|
+
module2.exports.getFileTreeString = getFileTreeString;
|
|
51
135
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports =
|
|
136
|
+
module2.exports.delay = delay;
|
|
53
137
|
}
|
|
54
138
|
});
|
|
55
139
|
|
|
56
140
|
// src/del-gradle.js
|
|
57
141
|
init_cjs_shims();
|
|
58
142
|
var glob = require("glob");
|
|
59
|
-
var
|
|
143
|
+
var path = require("upath");
|
|
60
144
|
var { del } = require_utils();
|
|
61
145
|
var globStream = new glob.Glob(["**/build.gradle"], {
|
|
62
146
|
withFileTypes: false,
|
package/lib/del-gradle.d.ts
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export {};
|
package/lib/del-gradle.js
CHANGED
|
@@ -1,72 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
10
|
-
var init_cjs_shims = __esm({
|
|
11
|
-
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// src/utils.js
|
|
16
|
-
var require_utils = __commonJS({
|
|
17
|
-
"src/utils.js"(exports2, module2) {
|
|
18
|
-
init_cjs_shims();
|
|
19
|
-
var { fs, path: path2 } = require("sbg-utility");
|
|
20
|
-
var argv = require("minimist")(process.argv.slice(2));
|
|
21
|
-
function getArgs() {
|
|
22
|
-
return argv;
|
|
23
|
-
}
|
|
24
|
-
function delStream(globStream2) {
|
|
25
|
-
globStream2.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path2.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del2(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del2(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function del2(fullPath) {
|
|
37
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path2.resolve(fullPath, dirPath));
|
|
39
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
40
|
-
del2(subdir[i]);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
try {
|
|
44
|
-
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
45
|
-
console.log("deleted", fullPath);
|
|
46
|
-
} catch (_) {
|
|
47
|
-
console.log("failed delete", fullPath);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports = { del: del2, delStream, getArgs, delay };
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// src/del-gradle.js
|
|
57
|
-
init_cjs_shims();
|
|
58
|
-
var glob = require("glob");
|
|
59
|
-
var { path } = require("sbg-utility");
|
|
60
|
-
var { del } = require_utils();
|
|
61
|
-
var globStream = new glob.Glob(["**/build.gradle"], {
|
|
62
|
-
withFileTypes: false,
|
|
63
|
-
cwd: process.cwd(),
|
|
64
|
-
ignore: ["**/node_modules/**", "**/vendor/**"]
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const path = require("upath");
|
|
3
|
+
const { del } = require("./utils");
|
|
4
|
+
const globStream = new glob.Glob(["**/build.gradle"], {
|
|
5
|
+
withFileTypes: false,
|
|
6
|
+
cwd: process.cwd(),
|
|
7
|
+
ignore: ["**/node_modules/**", "**/vendor/**"]
|
|
65
8
|
});
|
|
66
9
|
globStream.stream().on("data", (result) => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
10
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
11
|
+
const base = path.dirname(fullPath);
|
|
12
|
+
const buildFolder = path.join(base, "build");
|
|
13
|
+
console.log("delete build folder", buildFolder);
|
|
14
|
+
del(buildFolder);
|
|
72
15
|
});
|
package/lib/del-gradle.mjs
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
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-APBWENF6.mjs";
|
|
5
5
|
import {
|
|
6
|
+
__require,
|
|
6
7
|
init_esm_shims
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__require
|
|
10
|
-
} from "./chunk-AVDT32AY.mjs";
|
|
8
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
11
9
|
|
|
12
10
|
// src/del-gradle.js
|
|
13
11
|
init_esm_shims();
|
|
14
12
|
var glob = __require("glob");
|
|
15
|
-
var
|
|
13
|
+
var path = __require("upath");
|
|
16
14
|
var { del } = require_utils();
|
|
17
15
|
var globStream = new glob.Glob(["**/build.gradle"], {
|
|
18
16
|
withFileTypes: false,
|
package/lib/del-node-modules.cjs
CHANGED
|
@@ -16,23 +16,56 @@ var init_cjs_shims = __esm({
|
|
|
16
16
|
var require_utils = __commonJS({
|
|
17
17
|
"src/utils.js"(exports2, module2) {
|
|
18
18
|
init_cjs_shims();
|
|
19
|
-
var
|
|
19
|
+
var fs = require("fs");
|
|
20
|
+
var path = require("upath");
|
|
20
21
|
var argv = require("minimist")(process.argv.slice(2));
|
|
22
|
+
var { exec } = require("child_process");
|
|
23
|
+
var { URL: URL2 } = require("url");
|
|
24
|
+
var { promisify } = require("util");
|
|
25
|
+
var execAsync = promisify(exec);
|
|
26
|
+
async function parseGitRemotes() {
|
|
27
|
+
try {
|
|
28
|
+
const { stdout } = await execAsync("git remote -v");
|
|
29
|
+
const lines = stdout.split("\n");
|
|
30
|
+
const remotes = {};
|
|
31
|
+
lines.forEach((line) => {
|
|
32
|
+
const [name, url] = line.split(" ");
|
|
33
|
+
if (name && url) {
|
|
34
|
+
const [repoUrl] = url.split(" ");
|
|
35
|
+
try {
|
|
36
|
+
const parsedUrl = new URL2(repoUrl);
|
|
37
|
+
const pathParts = parsedUrl.pathname.split("/").filter(Boolean);
|
|
38
|
+
if (parsedUrl.hostname === "github.com" && pathParts.length === 2) {
|
|
39
|
+
let repoPath = pathParts.join("/");
|
|
40
|
+
if (repoPath.endsWith(".git")) {
|
|
41
|
+
repoPath = repoPath.slice(0, -4);
|
|
42
|
+
}
|
|
43
|
+
remotes[name] = repoPath;
|
|
44
|
+
}
|
|
45
|
+
} catch (e) {
|
|
46
|
+
console.error("URL Parsing Error:", e.message);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return remotes;
|
|
51
|
+
} catch (error) {
|
|
52
|
+
console.error("Error:", error.message);
|
|
53
|
+
return {};
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
module2.exports.parseGitRemotes = parseGitRemotes;
|
|
57
|
+
function joinPathPreserveDriveLetter(...segments) {
|
|
58
|
+
let fullPath = require("path").join(...segments);
|
|
59
|
+
if (/^[a-z]:\\/.test(fullPath)) {
|
|
60
|
+
fullPath = fullPath.charAt(0).toUpperCase() + fullPath.slice(1);
|
|
61
|
+
}
|
|
62
|
+
return fullPath;
|
|
63
|
+
}
|
|
64
|
+
module2.exports.joinPathPreserveDriveLetter = joinPathPreserveDriveLetter;
|
|
21
65
|
function getArgs() {
|
|
22
66
|
return argv;
|
|
23
67
|
}
|
|
24
|
-
|
|
25
|
-
globStream.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
68
|
+
module2.exports.getArgs = getArgs;
|
|
36
69
|
function del(fullPath) {
|
|
37
70
|
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
71
|
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
@@ -48,8 +81,59 @@ var require_utils = __commonJS({
|
|
|
48
81
|
}
|
|
49
82
|
}
|
|
50
83
|
}
|
|
84
|
+
module2.exports.del = del;
|
|
85
|
+
function delStream2(globStream) {
|
|
86
|
+
globStream.stream().on("data", (result) => {
|
|
87
|
+
const fullPath = path.resolve(process.cwd(), result);
|
|
88
|
+
if (fs.statSync(fullPath).isDirectory()) {
|
|
89
|
+
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
90
|
+
for (let i = 0; i < subdir.length; i++) {
|
|
91
|
+
del(subdir[i]);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
del(fullPath);
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
module2.exports.delStream = delStream2;
|
|
98
|
+
function getFileTreeString(hashArray) {
|
|
99
|
+
const tree = {};
|
|
100
|
+
const hashMap = {};
|
|
101
|
+
for (const entry of hashArray) {
|
|
102
|
+
const [filePath, hash] = entry.split(" ");
|
|
103
|
+
hashMap[filePath] = hash;
|
|
104
|
+
const parts = filePath.split("/");
|
|
105
|
+
let current = tree;
|
|
106
|
+
for (let i = 0; i < parts.length; i++) {
|
|
107
|
+
const part = parts[i];
|
|
108
|
+
if (i === parts.length - 1) {
|
|
109
|
+
current[part] = null;
|
|
110
|
+
} else {
|
|
111
|
+
current[part] = current[part] || {};
|
|
112
|
+
current = current[part];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
function printNode(node, prefix = "", parentPath = "") {
|
|
117
|
+
const keys = Object.keys(node).sort();
|
|
118
|
+
let lines = [];
|
|
119
|
+
keys.forEach((key, idx) => {
|
|
120
|
+
const isLast = idx === keys.length - 1;
|
|
121
|
+
const branch = isLast ? "\u2514\u2500\u2500 " : "\u251C\u2500\u2500 ";
|
|
122
|
+
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
123
|
+
if (node[key] === null) {
|
|
124
|
+
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
125
|
+
} else {
|
|
126
|
+
lines.push(prefix + branch + key + "/");
|
|
127
|
+
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "\u2502 "), currentPath));
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
return lines;
|
|
131
|
+
}
|
|
132
|
+
return printNode(tree, "", "").join("\n");
|
|
133
|
+
}
|
|
134
|
+
module2.exports.getFileTreeString = getFileTreeString;
|
|
51
135
|
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports =
|
|
136
|
+
module2.exports.delay = delay;
|
|
53
137
|
}
|
|
54
138
|
});
|
|
55
139
|
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { }
|
|
1
|
+
export {};
|
package/lib/del-node-modules.js
CHANGED
|
@@ -1,72 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
// node_modules/tsup/assets/cjs_shims.js
|
|
10
|
-
var init_cjs_shims = __esm({
|
|
11
|
-
"node_modules/tsup/assets/cjs_shims.js"() {
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
// src/utils.js
|
|
16
|
-
var require_utils = __commonJS({
|
|
17
|
-
"src/utils.js"(exports2, module2) {
|
|
18
|
-
init_cjs_shims();
|
|
19
|
-
var { fs, path } = require("sbg-utility");
|
|
20
|
-
var argv = require("minimist")(process.argv.slice(2));
|
|
21
|
-
function getArgs() {
|
|
22
|
-
return argv;
|
|
23
|
-
}
|
|
24
|
-
function delStream2(globStream) {
|
|
25
|
-
globStream.stream().on("data", (result) => {
|
|
26
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
27
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
28
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
29
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
30
|
-
del(subdir[i]);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
del(fullPath);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
function del(fullPath) {
|
|
37
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
38
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
39
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
40
|
-
del(subdir[i]);
|
|
41
|
-
}
|
|
42
|
-
} else {
|
|
43
|
-
try {
|
|
44
|
-
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
45
|
-
console.log("deleted", fullPath);
|
|
46
|
-
} catch (_) {
|
|
47
|
-
console.log("failed delete", fullPath);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
52
|
-
module2.exports = { del, delStream: delStream2, getArgs, delay };
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
// src/del-node-modules.js
|
|
57
|
-
init_cjs_shims();
|
|
58
|
-
var glob = require("glob");
|
|
59
|
-
var { delStream } = require_utils();
|
|
60
|
-
var globalIgnore = [
|
|
61
|
-
// ignore .git .github folder
|
|
62
|
-
"**/.git*",
|
|
63
|
-
// ignore composer folder
|
|
64
|
-
"**/vendor/**"
|
|
1
|
+
const glob = require("glob");
|
|
2
|
+
const { delStream } = require("./utils");
|
|
3
|
+
const globalIgnore = [
|
|
4
|
+
// ignore .git .github folder
|
|
5
|
+
"**/.git*",
|
|
6
|
+
// ignore composer folder
|
|
7
|
+
"**/vendor/**"
|
|
65
8
|
];
|
|
66
9
|
console.log("cleaning node_modules in", process.cwd());
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
10
|
+
const g3 = new glob.Glob("**/node_modules", {
|
|
11
|
+
withFileTypes: false,
|
|
12
|
+
cwd: process.cwd(),
|
|
13
|
+
ignore: globalIgnore
|
|
71
14
|
});
|
|
72
15
|
delStream(g3);
|
package/lib/del-node-modules.mjs
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
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-APBWENF6.mjs";
|
|
5
5
|
import {
|
|
6
|
+
__require,
|
|
6
7
|
init_esm_shims
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import {
|
|
9
|
-
__require
|
|
10
|
-
} from "./chunk-AVDT32AY.mjs";
|
|
8
|
+
} from "./chunk-AASHBCRW.mjs";
|
|
11
9
|
|
|
12
10
|
// src/del-node-modules.js
|
|
13
11
|
init_esm_shims();
|