Skip to content

Commit

Permalink
fix(core): throw an error if user tries generating/executing from a p…
Browse files Browse the repository at this point in the history
…ackage which does not support it (#4835)
  • Loading branch information
FrozenPandaz committed Feb 19, 2021
1 parent 4522a90 commit 95848ca
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/tao/src/shared/workspace.ts
Expand Up @@ -324,6 +324,13 @@ export class Workspaces {
const executorsFile = packageJson.executors
? packageJson.executors
: packageJson.builders;

if (!executorsFile) {
throw new Error(
`The "${nodeModule}" package does not support Nx executors.`
);
}

const executorsFilePath = require.resolve(
path.join(path.dirname(packageJsonPath), executorsFile)
);
Expand Down Expand Up @@ -361,6 +368,13 @@ export class Workspaces {
const generatorsFile = packageJson.generators
? packageJson.generators
: packageJson.schematics;

if (!generatorsFile) {
throw new Error(
`The "${collectionName}" package does not support Nx generators.`
);
}

generatorsFilePath = require.resolve(
path.join(path.dirname(packageJsonPath), generatorsFile)
);
Expand Down

0 comments on commit 95848ca

Please sign in to comment.