Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async compileAdminUiApp(extensions: AdminUiExtension[] | undefined): Promise {
const compiledAppExists = fs.existsSync(path.join(UI_PATH, 'index.html'));
const extensionsWithId = this.normalizeExtensions(extensions);
if (!compiledAppExists || this.extensionModulesHaveChanged(extensionsWithId)) {
Logger.info('Compiling Admin UI with extensions...', loggerCtx);
await compileAdminUiApp(path.join(__dirname, '../admin-ui'), extensionsWithId);
Logger.info('Completed compilation!', loggerCtx);
} else {
Logger.verbose('Extensions not changed since last run', loggerCtx);
}
}
watchAdminUiApp(extensions: AdminUiExtension[] | undefined, port: number): Watcher {
const extensionsWithId = this.normalizeExtensions(extensions);
Logger.info(`Starting Admin UI in Angular dev server on port ${port}`, loggerCtx);
return watchAdminUiApp(extensionsWithId, port);
}
async compileAdminUiApp(extensions: AdminUiExtension[] | undefined): Promise {
const compiledAppExists = fs.existsSync(path.join(UI_PATH, 'index.html'));
const extensionsWithId = this.normalizeExtensions(extensions);
if (!compiledAppExists || this.extensionModulesHaveChanged(extensionsWithId)) {
Logger.info('Compiling Admin UI with extensions...', loggerCtx);
await compileAdminUiApp(path.join(__dirname, '../admin-ui'), extensionsWithId);
Logger.info('Completed compilation!', loggerCtx);
} else {
Logger.verbose('Extensions not changed since last run', loggerCtx);
}
}
async onVendureBootstrap(): Promise {
const { host, port } = ElasticsearchPlugin.options;
try {
const pingResult = await this.elasticsearchService.checkConnection();
} catch (e) {
Logger.error(`Could not connect to Elasticsearch instance at "${host}:${port}"`, loggerCtx);
Logger.error(JSON.stringify(e), loggerCtx);
return;
}
Logger.info(`Sucessfully connected to Elasticsearch instance at "${host}:${port}"`, loggerCtx);
await this.elasticsearchService.createIndicesIfNotExists();
this.eventBus.ofType(CatalogModificationEvent).subscribe(event => {
if (event.entity instanceof Product || event.entity instanceof ProductVariant) {
return this.elasticsearchIndexService.updateProductOrVariant(event.ctx, event.entity).start();
}
});
const collectionModification$ = this.eventBus.ofType(CollectionModificationEvent);
const closingNotifier$ = collectionModification$.pipe(debounceTime(50));
collectionModification$
.pipe(
buffer(closingNotifier$),
filter(events => 0 < events.length),
map(events => ({