@oasisdigital/ng-doc-portal-plugin
Version:
Nx plugin for adding the ng-doc-portal system to your nx workspace
46 lines • 1.98 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getAngularConfigTarget = getAngularConfigTarget;
exports.getConfigFileLocationFromContext = getConfigFileLocationFromContext;
exports.getDocPageLoadersFileLocationFromContext = getDocPageLoadersFileLocationFromContext;
function getAngularConfigTarget(options, _context) {
return options['ngConfigTarget'];
}
function getProjects(context) {
var _a, _b, _c;
// TODO: remove `context.workspace` when on nx v17
const projects = (_b = (_a = context.projectsConfigurations) === null || _a === void 0 ? void 0 : _a.projects) !== null && _b !== void 0 ? _b : (_c = context.workspace) === null || _c === void 0 ? void 0 : _c.projects;
if (projects) {
return projects;
}
else {
throw new Error('Unable to find projects in workspace...');
}
}
function getProject(context) {
if (context.projectName) {
return getProjects(context)[context.projectName];
}
else {
throw new Error("Unable to find project's configuration...");
}
}
function getRelativeRootFromProject(project) {
return project.root.replace(/\\/g, '/');
}
function getConfigFileLocationFromContext(options, context) {
const project = getProject(context);
const projectRelativeRoot = getRelativeRootFromProject(project);
const defaultconfigFileLocation = `${projectRelativeRoot}/ng-doc-portal-config.json`;
let configFileLocation = options.configFile;
if (configFileLocation) {
configFileLocation = `${configFileLocation}`;
}
return configFileLocation !== null && configFileLocation !== void 0 ? configFileLocation : defaultconfigFileLocation;
}
function getDocPageLoadersFileLocationFromContext(_options, context) {
const project = getProject(context);
const projectRelativeRoot = getRelativeRootFromProject(project);
return `${projectRelativeRoot}/src/app/doc-page-loaders.ts`;
}
//# sourceMappingURL=context.js.map