@rxap/schematics-ts-morph
Version:
This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in
18 lines • 1.05 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.HasProjectFeature = HasProjectFeature;
const schematics_1 = require("@angular-devkit/schematics");
const workspace_utilities_1 = require("@rxap/workspace-utilities");
const path_1 = require("path");
function HasProjectFeature(host, { project, feature, }) {
if (!feature) {
throw new schematics_1.SchematicsException(`The feature option is not set. Can not determine if the project '${project}' has the feature.`);
}
if (!(0, workspace_utilities_1.HasProject)(host, project)) {
throw new schematics_1.SchematicsException(`The feature '${feature}' does not exists. The project '${project}' does not exists.`);
}
const projectSourceRoot = (0, workspace_utilities_1.GetProjectSourceRoot)(host, project);
return host.exists((0, path_1.join)(projectSourceRoot, `feature/${feature}/index.ts`)) ||
host.exists((0, path_1.join)(projectSourceRoot, `feature/${feature}/routes.ts`));
}
//# sourceMappingURL=has-project-feature.js.map