Skip to content

Commit a059ff0

Browse files
committed
fix: show cache missing downtime error message only in runtime (cache im most cases missing in buildTime, so doesnt make sense to show error message)
AdminForth/1510/i-got-this-recommendation-thou
1 parent 19a9cda commit a059ff0

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

adminforth/commands/createApp/templates/index.ts.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ if (fileURLToPath(import.meta.url) === path.resolve(process.argv[1])) {
7878

7979
const port = 3500;
8080

81-
admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' }).then(() => {
81+
admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development', buildTime: false }).then(() => {
8282
logger.info('Bundling AdminForth SPA done.');
8383
});
8484

adminforth/modules/codeInjector.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ class CodeInjector implements ICodeInjector {
10831083
return outPath;
10841084
}
10851085

1086-
async bundleNow({ hotReload = false }: { hotReload: boolean }) {
1086+
async bundleNow({ hotReload = false, buildTime = true }: { hotReload: boolean, buildTime?: boolean }) {
10871087
console.log(`${this.adminforth.formatAdminForth()} Bundling ${hotReload ? 'and listening for changes (🔥 Hotreload)' : ' (no hot reload)'}`);
10881088
this.adminforth.runningHotReload = hotReload;
10891089

@@ -1158,7 +1158,9 @@ class CodeInjector implements ICodeInjector {
11581158
oldHashForFiles = await fs.promises.readFile(path.join(this.spaTmpPath(), 'hashes.json'), 'utf-8');
11591159
} catch (e) {
11601160
// ignore if file doesn't exist, it is only for debugging
1161-
console.log(`Build cache not found, building now (downtime) please consider running npx adminforth bundle at build time to avoid downtimes at runtime`);
1161+
if (!buildTime) {
1162+
console.log(`Build cache not found, building now (downtime) please consider running npx adminforth bundle at build time to avoid downtimes at runtime`);
1163+
}
11621164
}
11631165
const root = this.spaTmpPath();
11641166
const hashMap = await this.computeSourcesHashMap(root, root, {});

0 commit comments

Comments
 (0)