Skip to content

Commit

Permalink
fix(misc): identify workspace schematics correctly using isSchematic …
Browse files Browse the repository at this point in the history
…option in schema
  • Loading branch information
leosvelperez committed Feb 1, 2023
1 parent d9b89e4 commit d448cdc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions packages/nx/src/command-line/workspace-generators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
}

Expand Down

0 comments on commit d448cdc

Please sign in to comment.