Skip to content

Commit b4e58e8

Browse files
committed
fix: don't re-extract messages after npx adminforth bundle
1 parent 269e3b4 commit b4e58e8

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

adminforth/modules/codeInjector.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,6 @@ class CodeInjector implements ICodeInjector {
791791
const cwd = this.spaTmpPath();
792792
const serveDir = this.getServeDir();
793793

794-
795794
const sourcesHash = await this.computeSourcesHash(this.spaTmpPath());
796795

797796
const buildHash = await this.tryReadFile(path.join(serveDir, '.adminforth_build_hash'));
@@ -805,7 +804,17 @@ class CodeInjector implements ICodeInjector {
805804
console.log(`🪲 SPA messages hash: ${messagesHash}`);
806805
console.log(`🪲 SPA sources hash: ${sourcesHash}`);
807806
}
808-
807+
808+
if (!skipBuild) {
809+
// remove serveDir if exists
810+
try {
811+
await fs.promises.rm(serveDir, { recursive: true });
812+
} catch (e) {
813+
// ignore
814+
}
815+
await fs.promises.mkdir(serveDir, { recursive: true });
816+
}
817+
809818
if (!skipExtract) {
810819
await this.runNpmShell({command: 'run i18n:extract', cwd});
811820

@@ -823,13 +832,6 @@ class CodeInjector implements ICodeInjector {
823832

824833
if (!hotReload) {
825834
if (!skipBuild) {
826-
// remove serveDir if exists
827-
try {
828-
await fs.promises.rm(serveDir, { recursive: true });
829-
} catch (e) {
830-
// ignore
831-
}
832-
await fs.promises.mkdir(serveDir, { recursive: true });
833835

834836
// TODO probably add option to build with tsh check (plain 'build')
835837
await this.runNpmShell({command: 'run build-only', cwd});

0 commit comments

Comments
 (0)