fix(fs/compiler/unpack): robustify directory removal and remove noisy diagnostic logging
This commit is contained in:
@@ -87,30 +87,16 @@ export class TsUnpacker {
|
||||
public async unpack(): Promise<boolean> {
|
||||
// Check if we should unpack based on config
|
||||
if (!(await this.shouldUnpack())) {
|
||||
console.log(` 📋 [DIAG-UNPACK] Skipping unpack: shouldUnpack=false`);
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if nested structure exists
|
||||
const hasNesting = await this.detectNesting();
|
||||
console.log(` 📋 [DIAG-UNPACK] detectNesting=${hasNesting}, nestedPath=${this.getNestedPath()}`);
|
||||
if (!hasNesting) {
|
||||
if (!(await this.detectNesting())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const nestedPath = this.getNestedPath();
|
||||
|
||||
// DIAGNOSTIC: Log contents before unpack
|
||||
try {
|
||||
const destEntries = fs.readdirSync(this.destDir, { withFileTypes: true });
|
||||
const destDirs = destEntries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||
console.log(` 📋 [DIAG-UNPACK] Before removeSibling: destDir dirs=[${destDirs.join(', ')}]`);
|
||||
const nestedEntries = fs.readdirSync(nestedPath, { withFileTypes: true });
|
||||
const nestedDirs = nestedEntries.filter(e => e.isDirectory()).map(e => e.name).sort();
|
||||
const nestedFiles = nestedEntries.filter(e => e.isFile()).length;
|
||||
console.log(` 📋 [DIAG-UNPACK] Nested dir (${this.sourceFolderName}/): ${nestedDirs.length} dirs [${nestedDirs.join(', ')}], ${nestedFiles} files`);
|
||||
} catch (e: any) { console.log(` 📋 [DIAG-UNPACK] Error reading: ${e.message}`); }
|
||||
|
||||
// Delete sibling folders (not the source folder)
|
||||
await this.removeSiblingDirectories();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user