From ca2c5a63dc6efd9efa1b3256350a1792f84f8afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Fri, 18 Aug 2023 10:09:12 +0100 Subject: [PATCH] fix(node): provide calling generator --- packages/devkit/src/generators/project-name-and-root-utils.ts | 2 +- packages/node/src/generators/application/application.ts | 1 + packages/node/src/generators/e2e-project/e2e-project.ts | 2 ++ packages/node/src/generators/library/library.ts | 1 + 4 files changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/devkit/src/generators/project-name-and-root-utils.ts b/packages/devkit/src/generators/project-name-and-root-utils.ts index 4f2fddf0f20c7e..74995d2489366a 100644 --- a/packages/devkit/src/generators/project-name-and-root-utils.ts +++ b/packages/devkit/src/generators/project-name-and-root-utils.ts @@ -14,7 +14,7 @@ export type ProjectNameAndRootFormat = 'as-provided' | 'derived'; export type ProjectGenerationOptions = { name: string; projectType: ProjectType; - callingGenerator: string; + callingGenerator: string | undefined; directory?: string; importPath?: string; projectNameAndRootFormat?: ProjectNameAndRootFormat; diff --git a/packages/node/src/generators/application/application.ts b/packages/node/src/generators/application/application.ts index 4422139281c5ad..a7349b4c059710 100644 --- a/packages/node/src/generators/application/application.ts +++ b/packages/node/src/generators/application/application.ts @@ -466,6 +466,7 @@ async function normalizeOptions( directory: options.directory, projectNameAndRootFormat: options.projectNameAndRootFormat, rootProject: options.rootProject, + callingGenerator: '@nx/node:application', }); options.rootProject = appProjectRoot === '.'; options.projectNameAndRootFormat = projectNameAndRootFormat; diff --git a/packages/node/src/generators/e2e-project/e2e-project.ts b/packages/node/src/generators/e2e-project/e2e-project.ts index c3079099146a52..769dec9fa03cb6 100644 --- a/packages/node/src/generators/e2e-project/e2e-project.ts +++ b/packages/node/src/generators/e2e-project/e2e-project.ts @@ -168,6 +168,8 @@ async function normalizeOptions( projectNameAndRootFormat: options.rootProject ? 'as-provided' : options.projectNameAndRootFormat, + // this is an internal generator, don't save defaults + callingGenerator: undefined, }); return { diff --git a/packages/node/src/generators/library/library.ts b/packages/node/src/generators/library/library.ts index 7b3431bc22032b..237c787b8c7b83 100644 --- a/packages/node/src/generators/library/library.ts +++ b/packages/node/src/generators/library/library.ts @@ -94,6 +94,7 @@ async function normalizeOptions( directory: options.directory, importPath: options.importPath, projectNameAndRootFormat: options.projectNameAndRootFormat, + callingGenerator: '@nx/node:library', }); options.projectNameAndRootFormat = projectNameAndRootFormat;