From 1802e67fbc76f416824fa91684f7135011563ab4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Tue, 7 Feb 2023 16:53:15 +0000 Subject: [PATCH] fix(misc): identify workspace schematics correctly using isSchematic option in schema (#14751) Fixes https://github.com/nrwl/nx/issues/14641 --- packages/nx/src/command-line/workspace-generators.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/nx/src/command-line/workspace-generators.ts b/packages/nx/src/command-line/workspace-generators.ts index 9cdbf60e2064f..769f9407d2168 100644 --- a/packages/nx/src/command-line/workspace-generators.ts +++ b/packages/nx/src/command-line/workspace-generators.ts @@ -98,21 +98,29 @@ function compileToolsDir(outDir: string) { function constructCollection() { const generators = {}; + const schematics = {}; readdirSync(generatorsDir).forEach((c) => { const childDir = path.join(generatorsDir, c); if (existsSync(path.join(childDir, 'schema.json'))) { - generators[c] = { + const generatorOrSchematic = { factory: `./${c}`, schema: `./${normalizePath(path.join(c, 'schema.json'))}`, description: `Schematic ${c}`, }; + + const { isSchematic } = readJsonFile(path.join(childDir, 'schema.json')); + if (isSchematic) { + schematics[c] = generatorOrSchematic; + } else { + generators[c] = generatorOrSchematic; + } } }); return { name: 'workspace-generators', version: '1.0', generators, - schematics: generators, + schematics, }; }