diff --git a/packages/nest/src/generators/resource/resource.ts b/packages/nest/src/generators/resource/resource.ts index ff9c3dd823..628a92e01e 100644 --- a/packages/nest/src/generators/resource/resource.ts +++ b/packages/nest/src/generators/resource/resource.ts @@ -2,6 +2,7 @@ import type { Tree } from '@nrwl/devkit'; import { convertNxGenerator } from '@nrwl/devkit'; import type { NestGeneratorWithLanguageOption, + NestGeneratorWithResourceOption, NestGeneratorWithTestOption, NormalizedOptions, } from '../utils'; @@ -12,7 +13,8 @@ import { } from '../utils'; export type ResourceGeneratorOptions = NestGeneratorWithLanguageOption & - NestGeneratorWithTestOption; + NestGeneratorWithTestOption & + NestGeneratorWithResourceOption; export function resourceGenerator( tree: Tree, diff --git a/packages/nest/src/generators/utils/types.ts b/packages/nest/src/generators/utils/types.ts index a4dc24c239..03ae3f1933 100644 --- a/packages/nest/src/generators/utils/types.ts +++ b/packages/nest/src/generators/utils/types.ts @@ -16,6 +16,12 @@ export type NestSchematic = | 'resolver' | 'resource' | 'service'; +export type TransportLayer = + | 'rest' + | 'graphql-code-first' + | 'graphql-schema-first' + | 'microservice' + | 'ws'; export type NestGeneratorOptions = { name: string; @@ -33,6 +39,11 @@ export type NestGeneratorWithTestOption = NestGeneratorOptions & { unitTestRunner?: UnitTestRunner; }; +export type NestGeneratorWithResourceOption = NestGeneratorOptions & { + type?: TransportLayer; + crud?: boolean; +}; + export type NormalizedOptions = { name: string; sourceRoot: string;