combicode 1.7.1 → 1.7.3
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/CHANGELOG.md +7 -0
- package/index.js +22 -12
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [1.7.2](https://github.com/aaurelions/combicode/compare/combicode-js-v1.7.1...combicode-js-v1.7.2) (2025-01-XX)
|
|
4
|
+
|
|
5
|
+
### Bug Fixes
|
|
6
|
+
|
|
7
|
+
- **skip-content:** fix total size calculation to exclude files with skipped content
|
|
8
|
+
- **skip-content:** remove extra blank line after placeholder text in output
|
|
9
|
+
|
|
3
10
|
## [1.7.1](https://github.com/aaurelions/combicode/compare/combicode-js-v1.7.0...combicode-js-v1.7.1) (2025-01-XX)
|
|
4
11
|
|
|
5
12
|
### Bug Fixes
|
package/index.js
CHANGED
|
@@ -179,8 +179,12 @@ function generateFileTree(filesWithSize, root, skipContentSet = null) {
|
|
|
179
179
|
parts.forEach((part, index) => {
|
|
180
180
|
const isFile = index === parts.length - 1;
|
|
181
181
|
if (isFile) {
|
|
182
|
-
const shouldSkipContent =
|
|
183
|
-
|
|
182
|
+
const shouldSkipContent =
|
|
183
|
+
skipContentSet && skipContentSet.has(relativePath);
|
|
184
|
+
currentLevel[part] = {
|
|
185
|
+
size: formattedSize,
|
|
186
|
+
skipContent: shouldSkipContent,
|
|
187
|
+
};
|
|
184
188
|
} else {
|
|
185
189
|
if (!currentLevel[part]) {
|
|
186
190
|
currentLevel[part] = {};
|
|
@@ -261,7 +265,8 @@ async function main() {
|
|
|
261
265
|
default: false,
|
|
262
266
|
})
|
|
263
267
|
.option("skip-content", {
|
|
264
|
-
describe:
|
|
268
|
+
describe:
|
|
269
|
+
"Comma-separated glob patterns for files to include in tree but omit content",
|
|
265
270
|
type: "string",
|
|
266
271
|
})
|
|
267
272
|
.version(version)
|
|
@@ -329,11 +334,14 @@ async function main() {
|
|
|
329
334
|
});
|
|
330
335
|
}
|
|
331
336
|
|
|
332
|
-
// Calculate total size of included files
|
|
333
|
-
const totalSizeBytes = includedFiles.reduce(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
+
// Calculate total size of included files (excluding files with skipped content)
|
|
338
|
+
const totalSizeBytes = includedFiles.reduce((acc, file) => {
|
|
339
|
+
// Don't count files with skipped content in the total size
|
|
340
|
+
if (skipContentSet.has(file.relativePath)) {
|
|
341
|
+
return acc;
|
|
342
|
+
}
|
|
343
|
+
return acc + file.size;
|
|
344
|
+
}, 0);
|
|
337
345
|
|
|
338
346
|
if (includedFiles.length === 0) {
|
|
339
347
|
console.error(
|
|
@@ -382,11 +390,13 @@ async function main() {
|
|
|
382
390
|
for (const fileObj of includedFiles) {
|
|
383
391
|
const relativePath = fileObj.relativePath.replace(/\\/g, "/");
|
|
384
392
|
const shouldSkipContent = skipContentSet.has(fileObj.relativePath);
|
|
385
|
-
|
|
393
|
+
|
|
386
394
|
outputStream.write(`### **FILE:** \`${relativePath}\`\n`);
|
|
387
|
-
outputStream.write("
|
|
395
|
+
outputStream.write("````\n");
|
|
388
396
|
if (shouldSkipContent) {
|
|
389
|
-
outputStream.write(
|
|
397
|
+
outputStream.write(
|
|
398
|
+
`(Content omitted - file size: ${fileObj.formattedSize})`
|
|
399
|
+
);
|
|
390
400
|
totalLines += 1;
|
|
391
401
|
} else {
|
|
392
402
|
try {
|
|
@@ -397,7 +407,7 @@ async function main() {
|
|
|
397
407
|
outputStream.write(`... (error reading file: ${e.message}) ...`);
|
|
398
408
|
}
|
|
399
409
|
}
|
|
400
|
-
outputStream.write("\n
|
|
410
|
+
outputStream.write("\n````\n\n");
|
|
401
411
|
totalLines += 4; // Headers/footers lines
|
|
402
412
|
}
|
|
403
413
|
outputStream.end();
|