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 (#14751)

Fixes #14641
  • Loading branch information
leosvelperez committed Feb 7, 2023
1 parent 5551fcc commit 1802e67
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

1 comment on commit 1802e67

@vercel
Copy link

@vercel vercel bot commented on 1802e67 Feb 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-nrwl.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.