@oasisdigital/ng-doc-portal-plugin
Version:
Nx plugin for adding the ng-doc-portal system to your nx workspace
37 lines • 1.89 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = runServe;
const tslib_1 = require("tslib");
const devkit_1 = require("@nx/devkit");
const rxjs_1 = require("rxjs");
const context_1 = require("../../util/context");
const doc_page_loaders_compiler_1 = require("../compiler/doc-page-loaders-compiler");
function runServe(options, context) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
// create compiler
const configLocation = (0, context_1.getConfigFileLocationFromContext)(options, context);
const docPageLoadersFileLocation = (0, context_1.getDocPageLoadersFileLocationFromContext)(options, context);
const compiler = new doc_page_loaders_compiler_1.DocPageLoadersCompiler(configLocation, docPageLoadersFileLocation);
const compilerWatch = compiler.watch().pipe((0, rxjs_1.shareReplay)(1));
// Run angular serve executor after first initial event from compiler watcher
const configuration = (0, context_1.getAngularConfigTarget)(options, context);
// We let this run and ignore it
(0, rxjs_1.firstValueFrom)(compilerWatch.pipe((0, rxjs_1.switchMap)(() => {
var _a;
return (0, devkit_1.runExecutor)({
project: (_a = context.projectName) !== null && _a !== void 0 ? _a : '',
target: 'ng-serve',
configuration,
}, { watch: true }, context);
})));
// convert the compiler watch ending events to executor resolutions
const compilerWatchPromise = new Promise((resolve) => {
compilerWatch.subscribe({
error: () => resolve({ success: false }),
complete: () => resolve({ success: true }),
});
});
return yield compilerWatchPromise;
});
}
//# sourceMappingURL=executor.js.map