@o3r/workspace
Version:
Workspace tooling of the Otter Framework
53 lines • 1.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ngRegisterProjectTasks = ngRegisterProjectTasks;
const path = require("node:path");
const schematics_1 = require("@o3r/schematics");
/**
* generate the rules to adapt the SDK generated by ng cli
* @param _options Schematic options
* @param targetPath Path where the SDK has been generated
* @param projectName Name of the project
*/
function ngRegisterProjectTasks(_options, targetPath, projectName) {
const project = {
projectType: 'library',
root: targetPath,
sourceRoot: path.posix.join(targetPath, 'src'),
prefix: 'sdk',
architect: {
build: {
builder: '@o3r/core:run-script',
options: {
script: 'build'
}
},
lint: {
builder: '@o3r/core:run-script',
options: {
script: 'lint'
}
},
test: {
builder: '@o3r/core:run-script',
options: {
script: 'test'
}
}
}
};
return (tree, context) => {
const angularJson = (0, schematics_1.getWorkspaceConfig)(tree);
if (!angularJson) {
context.logger.warn('No angular.json file detected, the update will be skipped.');
return tree;
}
angularJson.projects[projectName] = {
...angularJson.projects[projectName],
...project
};
tree.overwrite('/angular.json', JSON.stringify(angularJson, null, 2));
return tree;
};
}
//# sourceMappingURL=rules.ng.js.map