nx-electron
Version:
Electron Plugin for Nx
21 lines • 886 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getSourceRoot = getSourceRoot;
const devkit_1 = require("@nx/devkit");
function getSourceRoot(context) {
var _a;
const projectName = context.projectName;
if (!projectName) {
throw new Error('Executor context does not have a project name.');
}
if (!context.projectGraph) {
throw new Error('Executor context does not include a project graph.');
}
const { projects } = (0, devkit_1.readProjectsConfigurationFromProjectGraph)(context.projectGraph);
const { sourceRoot, root } = (_a = projects[projectName]) !== null && _a !== void 0 ? _a : {};
if (sourceRoot && root) {
return { sourceRoot, projectRoot: root };
}
throw new Error('Project does not have a sourceRoot or root. Please define both.');
}
//# sourceMappingURL=workspace.js.map