combicode 1.7.2 → 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/index.js +21 -17
- package/package.json +1 -1
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)
|
|
@@ -330,16 +335,13 @@ async function main() {
|
|
|
330
335
|
}
|
|
331
336
|
|
|
332
337
|
// Calculate total size of included files (excluding files with skipped content)
|
|
333
|
-
const totalSizeBytes = includedFiles.reduce(
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
},
|
|
341
|
-
0
|
|
342
|
-
);
|
|
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);
|
|
343
345
|
|
|
344
346
|
if (includedFiles.length === 0) {
|
|
345
347
|
console.error(
|
|
@@ -388,11 +390,13 @@ async function main() {
|
|
|
388
390
|
for (const fileObj of includedFiles) {
|
|
389
391
|
const relativePath = fileObj.relativePath.replace(/\\/g, "/");
|
|
390
392
|
const shouldSkipContent = skipContentSet.has(fileObj.relativePath);
|
|
391
|
-
|
|
393
|
+
|
|
392
394
|
outputStream.write(`### **FILE:** \`${relativePath}\`\n`);
|
|
393
|
-
outputStream.write("
|
|
395
|
+
outputStream.write("````\n");
|
|
394
396
|
if (shouldSkipContent) {
|
|
395
|
-
outputStream.write(
|
|
397
|
+
outputStream.write(
|
|
398
|
+
`(Content omitted - file size: ${fileObj.formattedSize})`
|
|
399
|
+
);
|
|
396
400
|
totalLines += 1;
|
|
397
401
|
} else {
|
|
398
402
|
try {
|
|
@@ -403,7 +407,7 @@ async function main() {
|
|
|
403
407
|
outputStream.write(`... (error reading file: ${e.message}) ...`);
|
|
404
408
|
}
|
|
405
409
|
}
|
|
406
|
-
outputStream.write("\n
|
|
410
|
+
outputStream.write("\n````\n\n");
|
|
407
411
|
totalLines += 4; // Headers/footers lines
|
|
408
412
|
}
|
|
409
413
|
outputStream.end();
|