Skip to content

Commit a1ed178

Browse files
committed
fix: add more heavy DEBUGs
1 parent b4e58e8 commit a1ed178

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ class CodeInjector implements ICodeInjector {
116116
};
117117

118118
console.log(`⚙️ exec: npm ${command}`);
119+
process.env.HEAVY_DEBUG && console.log(`🪲 npm ${command} cwd:`, cwd);
119120
process.env.HEAVY_DEBUG && console.time(`npm ${command} done in`);
120121
const { stdout: out, stderr: err } = await execAsync(`${nodeBinary} ${npmPath} ${command}`, {
121122
cwd,
@@ -747,8 +748,9 @@ class CodeInjector implements ICodeInjector {
747748
}
748749
}
749750

750-
async computeSourcesHash(folderPath: string = this.spaTmpPath()) {
751+
async computeSourcesHash(folderPath: string = this.spaTmpPath(), allFiles: string[] = []) {
751752
const files = await fs.promises.readdir(folderPath, { withFileTypes: true });
753+
allFiles.push(...files.map((file) => path.join(folderPath, file.name)));
752754
const hashes = await Promise.all(
753755
files.map(async (file) => {
754756
const filePath = path.join(folderPath, file.name);
@@ -759,7 +761,7 @@ class CodeInjector implements ICodeInjector {
759761
}
760762

761763
if (file.isDirectory()) {
762-
return this.computeSourcesHash(filePath);
764+
return this.computeSourcesHash(filePath, allFiles);
763765
} else {
764766
const content = await fs.promises.readFile(filePath, 'utf-8');
765767
return md5hash(content);
@@ -791,7 +793,9 @@ class CodeInjector implements ICodeInjector {
791793
const cwd = this.spaTmpPath();
792794
const serveDir = this.getServeDir();
793795

794-
const sourcesHash = await this.computeSourcesHash(this.spaTmpPath());
796+
const allFiles = [];
797+
const sourcesHash = await this.computeSourcesHash(this.spaTmpPath(), allFiles);
798+
process.env.VERY_HEAVY_DEBUG && console.log('🪲🪲 allFiles:', allFiles);
795799

796800
const buildHash = await this.tryReadFile(path.join(serveDir, '.adminforth_build_hash'));
797801
const messagesHash = await this.tryReadFile(path.join(serveDir, '.adminforth_messages_hash'));

0 commit comments

Comments
 (0)