File tree Expand file tree Collapse file tree 3 files changed +12
-9
lines changed
commands/createApp/templates Expand file tree Collapse file tree 3 files changed +12
-9
lines changed Original file line number Diff line number Diff line change @@ -61,13 +61,14 @@ if (import.meta.url === `file://${process.argv[1]}`) {
61
61
62
62
const port = 3500;
63
63
64
- await admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' });
65
- console.log('Bundling AdminForth SPA done.');
64
+ admin.bundleNow({ hotReload: process.env.NODE_ENV === 'development' }).then(() => {
65
+ console.log('Bundling AdminForth SPA done.');
66
+ });
66
67
67
- admin.express.serve(app)
68
+ admin.express.serve(app);
68
69
69
70
admin.discoverDatabases().then(async () => {
70
- if (! await admin.resource('adminuser').get([Filters.EQ('email', 'adminforth')]) ) {
71
+ if (await admin.resource('adminuser').count() === 0 ) {
71
72
await admin.resource('adminuser').create({
72
73
email: 'adminforth',
73
74
password_hash: await AdminForth.Utils.generatePasswordHash('adminforth'),
Original file line number Diff line number Diff line change @@ -285,8 +285,9 @@ if (import.meta.url === `file://${process.argv[1]}`) {
285
285
app .use (express .json ());
286
286
const port = 3500 ;
287
287
288
- await admin .bundleNow ({ hotReload: process .env .NODE_ENV === ' development' });
289
- console .log (' Bundling AdminForth SPA done.' );
288
+ admin .bundleNow ({ hotReload: process .env .NODE_ENV === ' development' }).then (() => {
289
+ console .log (' Bundling AdminForth SPA done.' );
290
+ });
290
291
291
292
// api to server recent posts
292
293
app .get (' /api/posts' , async (req , res ) => {
Original file line number Diff line number Diff line change @@ -299,14 +299,15 @@ if (import.meta.url === `file://${process.argv[1]}`) {
299
299
const port = 3500 ;
300
300
301
301
// needed to compile SPA. Call it here or from a build script e.g. in Docker build time to reduce downtime
302
- await admin .bundleNow ({ hotReload: process .env .NODE_ENV === ' development' });
303
- console .log (' Bundling AdminForth done. For faster serving consider calling bundleNow() from a build script.' );
302
+ admin .bundleNow ({ hotReload: process .env .NODE_ENV === ' development' }).then (() => {
303
+ console .log (' Bundling AdminForth SPA done.' );
304
+ });
304
305
305
306
// serve after you added all api
306
307
admin .express .serve (app )
307
308
308
309
admin .discoverDatabases ().then (async () => {
309
- if (! await admin .resource (' adminuser' ).get ([ Filters . EQ ( ' email ' , ' adminforth ' )]) ) {
310
+ if (await admin .resource (' adminuser' ).count () === 0 ) {
310
311
await admin .resource (' adminuser' ).create ({
311
312
email: ' adminforth' ,
312
313
passwordHash: await AdminForth .Utils .generatePasswordHash (' adminforth' ),
You can’t perform that action at this time.
0 commit comments