@nestjs/cli
Version:
The Nest CLI: create NestJS applications, generate modules, controllers and CRUD resources, and build, run and watch projects and monorepos.
19 lines (18 loc) • 574 B
JavaScript
import { NodeWorkflow } from '@angular-devkit/schematics/tools/index.js';
/**
* Whether the schematics `collection` resolves from the current project.
*/
export function isCollectionInstalled(collection) {
// Without `resolvePaths`, the workflow resolves collections relative to the
// CLI's own install rather than the project.
const workflow = new NodeWorkflow(process.cwd(), {
resolvePaths: [process.cwd()],
});
try {
workflow.engine.createCollection(collection);
return true;
}
catch {
return false;
}
}