Skip to content

Commit

Permalink
fix(create): Fix broken bootstrap when populating data
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelbromley committed Mar 9, 2021
1 parent 31ba228 commit 5dcf6e5
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions packages/create/src/create-vendure-app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ program
})
.option(
'--log-level <logLevel>',
"Log level, either 'silent', 'info', or 'verbose'",
`Log level, either 'silent', 'info', or 'verbose'`,
/^(silent|info|verbose)$/i,
'silent',
)
Expand Down Expand Up @@ -217,6 +217,7 @@ async function createApp(
: logLevel === 'verbose'
? LogLevel.Verbose
: LogLevel.Info;

const bootstrapFn = async () => {
await checkDbConnection(config.dbConnectionOptions, root);
const _app = await bootstrap({
Expand All @@ -231,25 +232,20 @@ async function createApp(
synchronize: true,
},
logger: new DefaultLogger({ level: vendureLogLevel }),
workerOptions: {
runInMainProcess: true,
},
importExportOptions: {
importAssetsDir: path.join(assetsDir, 'images'),
},
});
_app.get(JobQueueService).start();
await _app.get(JobQueueService).start();
return _app;
};
let app: any;
if (populateProducts) {
app = await populate(
bootstrapFn,
initialDataPath,
path.join(assetsDir, 'products.csv'),
);
} else {
app = await populate(bootstrapFn, initialDataPath);
}

const app = await populate(
bootstrapFn,
initialDataPath,
populateProducts ? path.join(assetsDir, 'products.csv') : undefined,
);

// Pause to ensure the worker jobs have time to complete.
if (isCi) {
console.log('[CI] Pausing before close...');
Expand Down

0 comments on commit 5dcf6e5

Please sign in to comment.