From d448cdc0787eb381df6ae96053cc1ab9015aa884 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leosvel=20P=C3=A9rez=20Espinosa?= Date: Wed, 1 Feb 2023 17:33:53 +0100 Subject: [PATCH] fix(misc): identify workspace schematics correctly using isSchematic option in schema --- 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 9cdbf60e2064f8..769f9407d21684 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, }; }