@oasisdigital/ng-doc-portal-plugin
Version:
Nx plugin for adding the ng-doc-portal system to your nx workspace
46 lines • 2.03 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = buildExecutor;
const tslib_1 = require("tslib");
const devkit_1 = require("@nx/devkit");
const context_1 = require("../../util/context");
const doc_page_loaders_compiler_1 = require("../compiler/doc-page-loaders-compiler");
function buildExecutor(options, context) {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
var _a, e_1, _b, _c;
var _d;
// 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);
// run doc config compiler once
try {
yield compiler.runOnce();
}
catch (err) {
console.error(err);
return { success: false };
}
const configuration = (0, context_1.getAngularConfigTarget)(options, context);
// run ng build
const result = yield (0, devkit_1.runExecutor)({ project: (_d = context.projectName) !== null && _d !== void 0 ? _d : '', target: 'ng-build', configuration }, {}, context);
try {
for (var _e = true, result_1 = tslib_1.__asyncValues(result), result_1_1; result_1_1 = yield result_1.next(), _a = result_1_1.done, !_a; _e = true) {
_c = result_1_1.value;
_e = false;
const res = _c;
if (!res.success)
return res;
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (!_e && !_a && (_b = result_1.return)) yield _b.call(result_1);
}
finally { if (e_1) throw e_1.error; }
}
return { success: true };
});
}
//# sourceMappingURL=executor.js.map