binary-collections 2.0.7 → 2.0.9
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 +5 -2
- package/bin/{git-fix-encoding → git-fix} +1 -4
- package/bin/git-fix.cmd +7 -0
- package/bin/nodekill +0 -0
- package/bin/nodekill.ps1 +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 +123 -0
- package/lib/binary-collections.d.cts +2 -0
- package/lib/binary-collections.d.mts +137 -0
- package/lib/binary-collections.d.ts +137 -0
- package/lib/binary-collections.mjs +300 -0
- package/lib/changelog.cjs +328 -0
- package/lib/changelog.d.mts +2 -0
- package/lib/changelog.d.ts +1 -0
- package/lib/changelog.js +226 -0
- package/lib/changelog.mjs +199 -0
- package/lib/chunk-4BYBVEYC.mjs +30 -0
- package/lib/{chunk-FB6YIQYR.mjs → chunk-AASHBCRW.mjs} +17 -2
- package/lib/chunk-APBWENF6.mjs +135 -0
- package/lib/{chunk-4LEXWIIF.mjs → chunk-DPKAJKFO.mjs} +2 -4
- package/lib/chunk-EGSSKVDH.mjs +66 -0
- package/lib/{chunk-3LOB2P54.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-JL32QDSH.mjs → chunk-W3ENOM53.mjs} +2 -4
- package/lib/chunk-YV7DO3YV.mjs +48 -0
- package/lib/{chunk-BSD5CIRU.mjs → chunk-YX5U7XDR.mjs} +11 -5
- 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 +87 -3
- package/lib/del-gradle.js +1 -1
- package/lib/del-gradle.mjs +4 -6
- package/lib/del-node-modules.cjs +86 -2
- package/lib/del-node-modules.mjs +3 -5
- package/lib/del-ps.cjs +89 -5
- package/lib/del-ps.js +2 -2
- package/lib/del-ps.mjs +6 -8
- package/lib/del-yarn-caches.cjs +86 -2
- package/lib/del-yarn-caches.mjs +3 -5
- package/lib/find-node-modules-cli.cjs +8 -0
- package/lib/find-node-modules-cli.mjs +2 -3
- package/lib/find-node-modules.cjs +8 -0
- package/lib/find-node-modules.d.mts +3 -0
- package/lib/find-node-modules.d.ts +3 -0
- package/lib/find-node-modules.js +12 -0
- package/lib/find-node-modules.mjs +2 -3
- 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 +23 -24
- package/lib/git-diff.d.mts +25 -28
- package/lib/git-diff.d.ts +25 -28
- package/lib/git-diff.mjs +32 -27
- 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 +86 -2
- package/lib/git-purge.mjs +3 -5
- package/lib/index.cjs +8 -0
- package/lib/index.mjs +3 -5
- package/lib/npm-run-series.cjs +140 -1
- package/lib/npm-run-series.js +2 -1
- package/lib/npm-run-series.mjs +7 -5
- package/lib/package-resolutions-updater.cjs +447 -0
- package/lib/package-resolutions-updater.d.mts +1 -0
- package/lib/package-resolutions-updater.d.ts +352 -0
- package/lib/package-resolutions-updater.mjs +339 -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.mjs +2 -3
- package/lib/ps/index.cjs +3 -3
- package/lib/ps/index.d.mjs +1 -2
- package/lib/ps/index.js +6 -3
- package/lib/ps/index.mjs +9 -11
- package/lib/ps/isWin.mjs +2 -3
- package/lib/ps/table-parser.mjs +3 -4
- package/lib/submodule-install.cjs +18 -35
- package/lib/submodule-install.d.mts +17 -37
- package/lib/submodule-install.d.ts +17 -37
- package/lib/submodule-install.mjs +21 -29
- package/lib/utils.cjs +86 -2
- package/lib/utils.d.mts +29 -9
- package/lib/utils.d.ts +28 -8
- package/lib/utils.js +139 -8
- package/lib/utils.mjs +2 -3
- package/lib/yarn-reinstall.cjs +9 -7
- package/lib/yarn-reinstall.d.mts +12 -8
- package/lib/yarn-reinstall.d.ts +12 -8
- package/lib/yarn-reinstall.mjs +14 -10
- package/package.json +109 -80
- package/readme.md +74 -11
- package/src/package-resolutions-updater.mjs +350 -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/lib/chunk-OKYLF2MU.mjs +0 -53
- package/lib/chunk-VXZQNLPU.mjs +0 -23
- 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.mjs +0 -31
- /package/bin/{submodule-install → submodule-install.txt} +0 -0
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
const fs = require("fs").promises;
|
|
2
|
+
const path = require("path");
|
|
3
|
+
const crypto = require("crypto");
|
|
4
|
+
const { execSync } = require("child_process");
|
|
5
|
+
const glob = require("glob");
|
|
6
|
+
const { getArgs } = require("./utils.js");
|
|
7
|
+
const sbgUtil = require("sbg-utility");
|
|
8
|
+
const dotenv = require("dotenv");
|
|
9
|
+
|
|
10
|
+
const projectDir = process.cwd();
|
|
11
|
+
const envPath = path.join(projectDir, ".env");
|
|
12
|
+
|
|
13
|
+
// Load the .env file using dotenv (ESM import)
|
|
14
|
+
if (fs.existsSync(envPath)) dotenv.config({ path: envPath });
|
|
15
|
+
|
|
16
|
+
// Parse CLI arguments
|
|
17
|
+
const argv = getArgs();
|
|
18
|
+
|
|
19
|
+
// Main logic wrapped in an async function
|
|
20
|
+
async function main() {
|
|
21
|
+
// Determine output file from CLI args
|
|
22
|
+
let relativeOutputFile = "tmp/directory-structure.txt";
|
|
23
|
+
if (argv.output || argv.o) {
|
|
24
|
+
relativeOutputFile = argv.output || argv.o;
|
|
25
|
+
}
|
|
26
|
+
// If not absolute, resolve relative to projectDir
|
|
27
|
+
const outputFile = path.isAbsolute(relativeOutputFile)
|
|
28
|
+
? relativeOutputFile
|
|
29
|
+
: path.join(projectDir, relativeOutputFile);
|
|
30
|
+
|
|
31
|
+
// Create or clear the hash file
|
|
32
|
+
sbgUtil.writefile(outputFile, "");
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* List of file extensions to include
|
|
36
|
+
* @type {string[]}
|
|
37
|
+
*/
|
|
38
|
+
let extensions = [];
|
|
39
|
+
if (argv.ext) {
|
|
40
|
+
extensions = argv.ext
|
|
41
|
+
.split(",")
|
|
42
|
+
.map((e) => e.trim().replace(/^\./, ""))
|
|
43
|
+
.filter(Boolean);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Directories to exclude
|
|
47
|
+
let excludeDirs = [
|
|
48
|
+
"node_modules",
|
|
49
|
+
"vendor",
|
|
50
|
+
"venv",
|
|
51
|
+
".venv",
|
|
52
|
+
".git",
|
|
53
|
+
".hg",
|
|
54
|
+
".svn",
|
|
55
|
+
".idea",
|
|
56
|
+
".vscode",
|
|
57
|
+
"dist",
|
|
58
|
+
"build",
|
|
59
|
+
"out",
|
|
60
|
+
"coverage",
|
|
61
|
+
".DS_Store"
|
|
62
|
+
];
|
|
63
|
+
if (argv.exclude) {
|
|
64
|
+
const userExcludes = argv.exclude
|
|
65
|
+
.split(",")
|
|
66
|
+
.map((d) => d.trim())
|
|
67
|
+
.filter(Boolean);
|
|
68
|
+
if (argv["override-exclude"] || argv.we) {
|
|
69
|
+
// Override the default excludes with user-provided ones
|
|
70
|
+
excludeDirs = userExcludes;
|
|
71
|
+
} else {
|
|
72
|
+
// Append user-provided excludes to the default ones
|
|
73
|
+
excludeDirs = excludeDirs.concat(userExcludes);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Convert excludeDirs into glob ignore patterns
|
|
78
|
+
const ignorePatterns = excludeDirs.map((dir) => `**/${dir}/**`);
|
|
79
|
+
|
|
80
|
+
// Initialize an array to hold the formatted outputs
|
|
81
|
+
let hashArray = [];
|
|
82
|
+
|
|
83
|
+
// Helper function to hash and add file if not already processed
|
|
84
|
+
const processedFiles = new Set();
|
|
85
|
+
/**
|
|
86
|
+
* Hashes a file and pushes its relative path and hash to the hashArray.
|
|
87
|
+
* @param {string} file - The absolute path to the file.
|
|
88
|
+
* @returns {Promise<void>} Resolves when the file has been processed and added to hashArray.
|
|
89
|
+
*/
|
|
90
|
+
async function hashAndPush(file) {
|
|
91
|
+
if (processedFiles.has(file)) return;
|
|
92
|
+
processedFiles.add(file);
|
|
93
|
+
let relativePath = path.relative(projectDir, file);
|
|
94
|
+
relativePath = relativePath.split(path.sep).join("/");
|
|
95
|
+
try {
|
|
96
|
+
const stats = await fs.stat(file);
|
|
97
|
+
const pseudoHash = `${stats.size}-${stats.mtimeMs}`;
|
|
98
|
+
const hash = crypto.createHash("sha256").update(pseudoHash).digest("hex");
|
|
99
|
+
hashArray.push(`${relativePath} ${hash.slice(0, 8)}`);
|
|
100
|
+
} catch (err) {
|
|
101
|
+
console.error(`Error processing file: ${file}`, err instanceof Error ? err.message : "<unknown error>");
|
|
102
|
+
if (err && err.code === "ENOENT") {
|
|
103
|
+
hashArray.push(`${relativePath} <file not found>`);
|
|
104
|
+
} else {
|
|
105
|
+
hashArray.push(`${relativePath} <error: ${err && err.code ? `code ${err.code}` : "unknown"}>`);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Collect all files to process (extensions + special files)
|
|
111
|
+
const initialFiles = [
|
|
112
|
+
path.join(projectDir, "package.json"),
|
|
113
|
+
path.join(projectDir, "composer.json"),
|
|
114
|
+
path.join(projectDir, "requirements.txt")
|
|
115
|
+
];
|
|
116
|
+
let patterns = [];
|
|
117
|
+
if (argv.pattern) {
|
|
118
|
+
if (Array.isArray(argv.pattern)) {
|
|
119
|
+
patterns = argv.pattern.map((p) => p.trim()).filter(Boolean);
|
|
120
|
+
} else {
|
|
121
|
+
patterns = [argv.pattern.trim()];
|
|
122
|
+
}
|
|
123
|
+
} else if (extensions.length === 0) {
|
|
124
|
+
patterns = ["**/*.*"];
|
|
125
|
+
} else {
|
|
126
|
+
patterns = extensions.map((ext) => `**/*.${ext}`);
|
|
127
|
+
}
|
|
128
|
+
const globFiles = glob.sync(patterns.length === 1 ? patterns[0] : `{${patterns.join(",")}}`, {
|
|
129
|
+
cwd: projectDir,
|
|
130
|
+
ignore: ignorePatterns,
|
|
131
|
+
absolute: true,
|
|
132
|
+
nodir: true
|
|
133
|
+
});
|
|
134
|
+
const allFiles = new Set([...initialFiles, ...globFiles]);
|
|
135
|
+
|
|
136
|
+
// Hash all unique files
|
|
137
|
+
await Promise.all(Array.from(allFiles).map(hashAndPush));
|
|
138
|
+
|
|
139
|
+
// Sort the hashArray by file paths
|
|
140
|
+
hashArray.sort((a, b) => a.localeCompare(b));
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Generates a directory/file tree string from a hash array of file paths and hashes.
|
|
144
|
+
*
|
|
145
|
+
* @param {string[]} hashArray - Array of strings in the format 'relative/path/to/file hash'.
|
|
146
|
+
* @returns {string} The directory/file tree as a string, with file hashes.
|
|
147
|
+
*/
|
|
148
|
+
function getFileTreeString(hashArray) {
|
|
149
|
+
const tree = {};
|
|
150
|
+
// Map file paths to hashes for quick lookup
|
|
151
|
+
const hashMap = {};
|
|
152
|
+
for (const entry of hashArray) {
|
|
153
|
+
const [filePath, hash] = entry.split(" ");
|
|
154
|
+
hashMap[filePath] = hash;
|
|
155
|
+
const parts = filePath.split("/");
|
|
156
|
+
let current = tree;
|
|
157
|
+
for (let i = 0; i < parts.length; i++) {
|
|
158
|
+
const part = parts[i];
|
|
159
|
+
if (i === parts.length - 1) {
|
|
160
|
+
current[part] = null; // file
|
|
161
|
+
} else {
|
|
162
|
+
current[part] = current[part] || {};
|
|
163
|
+
current = current[part];
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Recursively builds the tree string for a given node.
|
|
169
|
+
*
|
|
170
|
+
* @param {Object} node - The current node in the tree.
|
|
171
|
+
* @param {string} prefix - The prefix for the current tree level.
|
|
172
|
+
* @param {string} parentPath - The path to the current node.
|
|
173
|
+
* @returns {string[]} Array of lines representing the tree structure.
|
|
174
|
+
*/
|
|
175
|
+
function printNode(node, prefix = "", parentPath = "") {
|
|
176
|
+
const keys = Object.keys(node).sort();
|
|
177
|
+
let lines = [];
|
|
178
|
+
keys.forEach((key, idx) => {
|
|
179
|
+
const isLast = idx === keys.length - 1;
|
|
180
|
+
const branch = isLast ? "└── " : "├── ";
|
|
181
|
+
const currentPath = parentPath ? parentPath + "/" + key : key;
|
|
182
|
+
if (node[key] === null) {
|
|
183
|
+
// file: show hash
|
|
184
|
+
lines.push(prefix + branch + key + " [" + (hashMap[currentPath] || "") + "]");
|
|
185
|
+
} else {
|
|
186
|
+
lines.push(prefix + branch + key + "/");
|
|
187
|
+
lines = lines.concat(printNode(node[key], prefix + (isLast ? " " : "│ "), currentPath));
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
return lines;
|
|
191
|
+
}
|
|
192
|
+
return printNode(tree, "", "").join("\n");
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
// Write directory/file tree to the output file (hashes are included in the tree)
|
|
196
|
+
const fileTreeString = getFileTreeString(hashArray);
|
|
197
|
+
await fs.writeFile(outputFile, fileTreeString + "\n", "utf-8");
|
|
198
|
+
|
|
199
|
+
// Add the hash file to the commit if --git-add is present
|
|
200
|
+
if (argv["git-add"]) {
|
|
201
|
+
execSync(`git add ${relativeOutputFile}`);
|
|
202
|
+
console.log(`Directory tree written to ${relativeOutputFile} and staged for git.`);
|
|
203
|
+
} else {
|
|
204
|
+
console.log(`Directory tree written to ${relativeOutputFile}.`);
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (argv.help || argv.h) {
|
|
209
|
+
console.log(`
|
|
210
|
+
Usage: node print-directory-tree.cjs [options]
|
|
211
|
+
|
|
212
|
+
Options:
|
|
213
|
+
--output, -o <file> Output file path (default: tmp/directory-structure.txt)
|
|
214
|
+
--ext <exts> Comma-separated list of file extensions (no dot, e.g. js,ts)
|
|
215
|
+
--pattern <glob> Glob pattern(s) for files (can be repeated)
|
|
216
|
+
--exclude <dirs> Comma-separated list of directories to exclude (appends to default)
|
|
217
|
+
--override-exclude, -we Override default exclude directories with --exclude
|
|
218
|
+
--git-add Add output file to git after writing
|
|
219
|
+
--help, -h Show this help message
|
|
220
|
+
|
|
221
|
+
Examples:
|
|
222
|
+
node print-directory-tree.cjs --ext=js,ts
|
|
223
|
+
node print-directory-tree.cjs --pattern=src/**/*.js --pattern=test/**/*.js
|
|
224
|
+
node print-directory-tree.cjs --exclude=dist,build
|
|
225
|
+
node print-directory-tree.cjs --output=tmp/tree.txt
|
|
226
|
+
`);
|
|
227
|
+
process.exit(0);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Execute the main function
|
|
231
|
+
main().catch((err) => {
|
|
232
|
+
console.error(err);
|
|
233
|
+
process.exit(1);
|
|
234
|
+
});
|
package/src/ps/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
var ChildProcess = require("child_process");
|
|
2
2
|
var IS_WIN = require("./isWin");
|
|
3
3
|
var TableParser = require("./table-parser");
|
|
4
|
+
|
|
4
5
|
/**
|
|
5
6
|
* End of line.
|
|
6
7
|
* Basically, the EOL should be:
|
|
@@ -213,7 +214,7 @@ exports.kill = function (pid, signal, next) {
|
|
|
213
214
|
|
|
214
215
|
if (err) {
|
|
215
216
|
clearTimeout(checkTimeoutTimer);
|
|
216
|
-
finishCallback
|
|
217
|
+
if (finishCallback) finishCallback(err);
|
|
217
218
|
} else if (list.length > 0) {
|
|
218
219
|
checkConfident = checkConfident - 1 || 0;
|
|
219
220
|
checkKilled(finishCallback);
|
|
@@ -221,7 +222,7 @@ exports.kill = function (pid, signal, next) {
|
|
|
221
222
|
checkConfident++;
|
|
222
223
|
if (checkConfident === 5) {
|
|
223
224
|
clearTimeout(checkTimeoutTimer);
|
|
224
|
-
finishCallback
|
|
225
|
+
if (finishCallback) finishCallback();
|
|
225
226
|
} else {
|
|
226
227
|
checkKilled(finishCallback);
|
|
227
228
|
}
|
|
@@ -229,7 +230,7 @@ exports.kill = function (pid, signal, next) {
|
|
|
229
230
|
});
|
|
230
231
|
}
|
|
231
232
|
|
|
232
|
-
next
|
|
233
|
+
if (next) checkKilled(next);
|
|
233
234
|
|
|
234
235
|
checkTimeoutTimer =
|
|
235
236
|
next &&
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
const { execSync } = require("child_process");
|
|
2
|
+
const { getArgs } = require("./utils.js");
|
|
3
|
+
const args = getArgs();
|
|
4
|
+
const positional = args._ || [];
|
|
5
|
+
|
|
6
|
+
if (positional.length === 0) {
|
|
7
|
+
console.error("Usage: yarn-reinstall <packageName> [--dev|-D|--peer|-P|--optional|-O]");
|
|
8
|
+
process.exit(1);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const packageName = positional[0];
|
|
12
|
+
const flags = positional.slice(1).concat(
|
|
13
|
+
Object.keys(args)
|
|
14
|
+
.filter((k) => k !== "_" && args[k] === true)
|
|
15
|
+
.map((k) => `--${k}`)
|
|
16
|
+
);
|
|
17
|
+
|
|
18
|
+
if (!packageName) {
|
|
19
|
+
console.error("Please provide a package name.");
|
|
20
|
+
process.exit(1);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Remove and add commands
|
|
24
|
+
const removeCmd = `yarn remove ${packageName}`;
|
|
25
|
+
const addCmd = `yarn add ${packageName} ${flags.join(" ")}`.trim();
|
|
26
|
+
|
|
27
|
+
try {
|
|
28
|
+
// Check if the package is installed before removing
|
|
29
|
+
let isInstalled = false;
|
|
30
|
+
try {
|
|
31
|
+
const listOutput = execSync(`yarn list --pattern "${packageName}" --depth=0`, { encoding: "utf8" });
|
|
32
|
+
isInstalled = listOutput.includes(packageName + "@");
|
|
33
|
+
} catch (_e) {
|
|
34
|
+
// If yarn list fails, assume not installed
|
|
35
|
+
isInstalled = false;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isInstalled) {
|
|
39
|
+
console.log(`Running: ${removeCmd}`);
|
|
40
|
+
execSync(removeCmd, { stdio: "inherit" });
|
|
41
|
+
} else {
|
|
42
|
+
console.warn(`Package "${packageName}" was not installed or not referenced, skipping remove.`);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
console.log(`Running: ${addCmd}`);
|
|
46
|
+
execSync(addCmd, { stdio: "inherit" });
|
|
47
|
+
} catch (err) {
|
|
48
|
+
process.exit(err.status || 1);
|
|
49
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "test-binary-collections",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Test project for binary-collections",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"init-lock": "echo > yarn.lock"
|
|
8
|
+
},
|
|
9
|
+
"keywords": [],
|
|
10
|
+
"author": "dimaslanjaka@gmail.com",
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"binary-collections": "file:../releases/bin.tgz"
|
|
14
|
+
},
|
|
15
|
+
"packageManager": "yarn@4.9.2"
|
|
16
|
+
}
|
package/bin/git-fix-encoding.cmd
DELETED
package/lib/chunk-OKYLF2MU.mjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
init_esm_shims
|
|
4
|
-
} from "./chunk-VXZQNLPU.mjs";
|
|
5
|
-
import {
|
|
6
|
-
__commonJS,
|
|
7
|
-
__require
|
|
8
|
-
} from "./chunk-FB6YIQYR.mjs";
|
|
9
|
-
|
|
10
|
-
// src/utils.js
|
|
11
|
-
var require_utils = __commonJS({
|
|
12
|
-
"src/utils.js"(exports, module) {
|
|
13
|
-
init_esm_shims();
|
|
14
|
-
var { fs, path } = __require("sbg-utility");
|
|
15
|
-
var argv = __require("minimist")(process.argv.slice(2));
|
|
16
|
-
function getArgs() {
|
|
17
|
-
return argv;
|
|
18
|
-
}
|
|
19
|
-
function del(fullPath) {
|
|
20
|
-
if (fs.statSync(fullPath).isDirectory()) {
|
|
21
|
-
const subdir = fs.readdirSync(fullPath).map((dirPath) => path.resolve(fullPath, dirPath));
|
|
22
|
-
for (let i = 0; i < subdir.length; i++) {
|
|
23
|
-
del(subdir[i]);
|
|
24
|
-
}
|
|
25
|
-
} else {
|
|
26
|
-
try {
|
|
27
|
-
fs.rmSync(fullPath, { recursive: true, force: true, retryDelay: 7e3 });
|
|
28
|
-
console.log("deleted", fullPath);
|
|
29
|
-
} catch (_) {
|
|
30
|
-
console.log("failed delete", fullPath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
function delStream(globStream) {
|
|
35
|
-
globStream.stream().on("data", (result) => {
|
|
36
|
-
const fullPath = path.resolve(process.cwd(), result);
|
|
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
|
-
}
|
|
43
|
-
del(fullPath);
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
var delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
47
|
-
module.exports = { del, delStream, getArgs, delay };
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export {
|
|
52
|
-
require_utils
|
|
53
|
-
};
|
package/lib/chunk-VXZQNLPU.mjs
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
__esm
|
|
4
|
-
} from "./chunk-FB6YIQYR.mjs";
|
|
5
|
-
|
|
6
|
-
// node_modules/tsup/assets/esm_shims.js
|
|
7
|
-
import path from "path";
|
|
8
|
-
import { fileURLToPath } from "url";
|
|
9
|
-
var getFilename, getDirname, __dirname, __filename;
|
|
10
|
-
var init_esm_shims = __esm({
|
|
11
|
-
"node_modules/tsup/assets/esm_shims.js"() {
|
|
12
|
-
getFilename = () => fileURLToPath(import.meta.url);
|
|
13
|
-
getDirname = () => path.dirname(getFilename());
|
|
14
|
-
__dirname = /* @__PURE__ */ getDirname();
|
|
15
|
-
__filename = /* @__PURE__ */ getFilename();
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
export {
|
|
20
|
-
__dirname,
|
|
21
|
-
__filename,
|
|
22
|
-
init_esm_shims
|
|
23
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
// src/package-resolutions.json
|
|
2
|
-
var resolutions = {
|
|
3
|
-
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
4
|
-
safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
|
|
5
|
-
"sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
|
|
6
|
-
"sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
|
|
7
|
-
"sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
|
|
8
|
-
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
|
|
9
|
-
"sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
|
|
10
|
-
"static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
|
|
11
|
-
"hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
|
|
12
|
-
"hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
|
|
13
|
-
"hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
|
|
14
|
-
"hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
|
|
15
|
-
hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
|
|
16
|
-
"hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
|
|
17
|
-
"hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
|
|
18
|
-
warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
|
|
19
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
|
|
20
|
-
"instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
|
|
21
|
-
};
|
|
22
|
-
var package_resolutions_default = {
|
|
23
|
-
resolutions
|
|
24
|
-
};
|
|
25
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
26
|
-
0 && (module.exports = {
|
|
27
|
-
resolutions
|
|
28
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var resolutions = {
|
|
2
|
-
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
3
|
-
safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
|
|
4
|
-
"sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
|
|
5
|
-
"sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
|
|
6
|
-
"sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
|
|
7
|
-
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
|
|
8
|
-
"sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
|
|
9
|
-
"static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
|
|
10
|
-
"hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
|
|
11
|
-
"hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
|
|
12
|
-
"hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
|
|
13
|
-
"hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
|
|
14
|
-
hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
|
|
15
|
-
"hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
|
|
16
|
-
"hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
|
|
17
|
-
warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
|
|
18
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
|
|
19
|
-
"instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
|
|
20
|
-
};
|
|
21
|
-
var packageResolutions = {
|
|
22
|
-
resolutions: resolutions
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { packageResolutions as default, resolutions };
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
var resolutions = {
|
|
2
|
-
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
3
|
-
safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
|
|
4
|
-
"sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
|
|
5
|
-
"sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
|
|
6
|
-
"sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
|
|
7
|
-
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
|
|
8
|
-
"sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
|
|
9
|
-
"static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
|
|
10
|
-
"hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
|
|
11
|
-
"hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
|
|
12
|
-
"hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
|
|
13
|
-
"hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
|
|
14
|
-
hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
|
|
15
|
-
"hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
|
|
16
|
-
"hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
|
|
17
|
-
warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
|
|
18
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
|
|
19
|
-
"instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
|
|
20
|
-
};
|
|
21
|
-
var packageResolutions = {
|
|
22
|
-
resolutions: resolutions
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export { packageResolutions as default, resolutions };
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createRequire } from 'module'; const require = createRequire(import.meta.url);
|
|
2
|
-
import "./chunk-FB6YIQYR.mjs";
|
|
3
|
-
|
|
4
|
-
// src/package-resolutions.json
|
|
5
|
-
var resolutions = {
|
|
6
|
-
"cross-spawn": "https://github.com/dimaslanjaka/node-cross-spawn/raw/private/release/cross-spawn.tgz",
|
|
7
|
-
safelinkify: "https://github.com/dimaslanjaka/safelink/raw/monorepo/release/safelinkify.tgz",
|
|
8
|
-
"sbg-api": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-api/release/sbg-api.tgz",
|
|
9
|
-
"sbg-cli": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-cli/release/sbg-cli.tgz",
|
|
10
|
-
"sbg-server": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-server/release/sbg-server.tgz",
|
|
11
|
-
"sbg-utility": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sbg-utility/release/sbg-utility.tgz",
|
|
12
|
-
"sitemap-crawler": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/sitemap-crawler/release/sitemap-crawler.tgz",
|
|
13
|
-
"static-blog-generator": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/static-blog-generator/release/static-blog-generator.tgz",
|
|
14
|
-
"hexo-blogger-xml": "https://github.com/dimaslanjaka/hexo-blogger-xml/raw/monorepo/release/hexo-blogger-xml.tgz",
|
|
15
|
-
"hexo-post-parser": "https://github.com/dimaslanjaka/hexo-post-parser/raw/monorepo/release/hexo-post-parser.tgz",
|
|
16
|
-
"hexo-asset-link": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-asset-link.tgz",
|
|
17
|
-
"hexo-front-matter": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-front-matter.tgz",
|
|
18
|
-
hexo: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo.tgz",
|
|
19
|
-
"hexo-log": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-log.tgz",
|
|
20
|
-
"hexo-util": "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/hexo-util.tgz",
|
|
21
|
-
warehouse: "https://github.com/dimaslanjaka/hexo/raw/monorepo-v7/releases/warehouse.tgz",
|
|
22
|
-
"git-command-helper": "https://github.com/dimaslanjaka/git-command-helper/raw/monorepo/release/git-command-helper.tgz",
|
|
23
|
-
"instant-indexing": "https://github.com/dimaslanjaka/static-blog-generator/raw/beta/packages/instant-indexing/release/instant-indexing.tgz"
|
|
24
|
-
};
|
|
25
|
-
var package_resolutions_default = {
|
|
26
|
-
resolutions
|
|
27
|
-
};
|
|
28
|
-
export {
|
|
29
|
-
package_resolutions_default as default,
|
|
30
|
-
resolutions
|
|
31
|
-
};
|
|
File without changes
|