Skip to content

Commit 9b4a896

Browse files
committed
fix: add don't include i18n-*.json files in cache calculation for bunde redundent detection
1 parent a1ed178 commit 9b4a896

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -795,7 +795,7 @@ class CodeInjector implements ICodeInjector {
795795

796796
const allFiles = [];
797797
const sourcesHash = await this.computeSourcesHash(this.spaTmpPath(), allFiles);
798-
process.env.VERY_HEAVY_DEBUG && console.log('🪲🪲 allFiles:', allFiles);
798+
process.env.VERY_HEAVY_DEBUG && console.log('🪲🪲 allFiles:', JSON.stringify(allFiles.sort((a,b) => a.localeCompare(b)), null, 1))
799799

800800
const buildHash = await this.tryReadFile(path.join(serveDir, '.adminforth_build_hash'));
801801
const messagesHash = await this.tryReadFile(path.join(serveDir, '.adminforth_messages_hash'));
@@ -828,6 +828,10 @@ class CodeInjector implements ICodeInjector {
828828
// copy i18n messages to serve dir
829829
await fsExtra.copy(path.join(cwd, 'i18n-messages.json'), path.join(serveDir, 'i18n-messages.json'));
830830

831+
// rm i18n-messages.json and i18n-empty.json from spa tmp, or they will affect hash
832+
await fs.promises.rm(path.join(cwd, 'i18n-messages.json'), { force: true });
833+
await fs.promises.rm(path.join(cwd, 'i18n-empty.json'), { force: true });
834+
831835
// save hash
832836
await fs.promises.writeFile(path.join(serveDir, '.adminforth_messages_hash'), sourcesHash);
833837
} else {

0 commit comments

Comments
 (0)