angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.73k stars 11.98k forks source link

Cli tries to find the project to create from component schematic when calling library schematic #24615

Closed danjor closed 1 year ago

danjor commented 1 year ago

Command

generate

Is this a regression?

The previous version in which this bug was not present was

15.1.1

Description

With angular CLI version 14, and v15 (all except 15.1.1)

Calling this yarn nx generate @nrwl/angular:library my-lib --directory=package.json --verbose Cause the CLI fail in node_modules\@schematics\angular\component\index.js:32:19 without even calling workspace library schematic and angular library schematic either with error :

SchematicsException [Error]: Project "my-lib" does not exist.
    at C:\Users\a786953\projets\idaas_front_end\src\node_modules\@schematics\angular\component\index.js:32:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

 >  NX   Project "my-lib" does not exist.

Minimal Reproduction

With angular CLI version 14, and v15 (all except 15.1.1)

Calling this yarn nx generate @nrwl/angular:library my-lib --directory=package.json --verbose Cause the CLI to fail in node_modules\@schematics\angular\component\index.js:32:19 without even calling workspace library schematic and angular library schematic either with error :

SchematicsException [Error]: Project "my-lib" does not exist.
    at C:\Users\a786953\projets\idaas_front_end\src\node_modules\@schematics\angular\component\index.js:32:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

 >  NX   Project "my-lib" does not exist.

Full Output :

yarn nx generate @nrwl/angular:library my-lib --directory=package.json --verbose
yarn run v1.22.17
$ nx generate @nrwl/angular:library my-lib --directory=package.json --verbose

>  NX  Generating @nrwl/angular:library

**[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic**
Project 'main-project' contains extension with invalid name (files).
Project 'storybook-static' contains extension with invalid name (generatedAt).
Project 'storybook-static' contains extension with invalid name (builder).
Project 'storybook-static' contains extension with invalid name (hasCustomBabel).
Project 'storybook-static' contains extension with invalid name (hasCustomWebpack).
Project 'storybook-static' contains extension with invalid name (hasStaticDirs).
Project 'storybook-static' contains extension with invalid name (hasStorybookEslint).
Project 'storybook-static' contains extension with invalid name (refCount).
Project 'storybook-static' contains extension with invalid name (metaFramework).
Project 'storybook-static' contains extension with invalid name (storybookVersion).
Project 'storybook-static' contains extension with invalid name (language).
Project 'storybook-static' contains extension with invalid name (storybookPackages).
Project 'storybook-static' contains extension with invalid name (framework).
Project 'storybook-static' contains extension with invalid name (addons).
Project 'storybook-static' contains extension with invalid name (files).
**[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic**
Project 'main-project' contains extension with invalid name (files).
Project 'storybook-static' contains extension with invalid name (generatedAt).
Project 'storybook-static' contains extension with invalid name (builder).
Project 'storybook-static' contains extension with invalid name (hasCustomBabel).
Project 'storybook-static' contains extension with invalid name (hasCustomWebpack).
Project 'storybook-static' contains extension with invalid name (hasStaticDirs).
Project 'storybook-static' contains extension with invalid name (hasStorybookEslint).
Project 'storybook-static' contains extension with invalid name (refCount).
Project 'storybook-static' contains extension with invalid name (metaFramework).
Project 'storybook-static' contains extension with invalid name (storybookVersion).
Project 'storybook-static' contains extension with invalid name (language).
Project 'storybook-static' contains extension with invalid name (storybookPackages).
Project 'storybook-static' contains extension with invalid name (framework).
Project 'storybook-static' contains extension with invalid name (addons).
Project 'storybook-static' contains extension with invalid name (files).
**[NX] Angular devkit called `writeWorkspace`, this may have had unintended consequences in workspace.json
[NX] Double check workspace.json before proceeding
[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic**
Project 'main-project' contains extension with invalid name (files).
Project 'storybook-static' contains extension with invalid name (generatedAt).
Project 'storybook-static' contains extension with invalid name (builder).
Project 'storybook-static' contains extension with invalid name (hasCustomBabel).
Project 'storybook-static' contains extension with invalid name (hasCustomWebpack).
Project 'storybook-static' contains extension with invalid name (hasStaticDirs).
Project 'storybook-static' contains extension with invalid name (hasStorybookEslint).
Project 'storybook-static' contains extension with invalid name (refCount).
Project 'storybook-static' contains extension with invalid name (metaFramework).
Project 'storybook-static' contains extension with invalid name (storybookVersion).
Project 'storybook-static' contains extension with invalid name (language).
Project 'storybook-static' contains extension with invalid name (storybookPackages).
Project 'storybook-static' contains extension with invalid name (framework).
Project 'storybook-static' contains extension with invalid name (addons).
Project 'storybook-static' contains extension with invalid name (files).
SchematicsException [Error]: Project "my-lib" does not exist.
    at C:\project\src\node_modules\@schematics\angular\component\index.js:32:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

 >  NX   Project "my-lib" does not exist.

Error: Project "my-lib" does not exist.
    at C:\project\src\node_modules\@schematics\angular\component\index.js:32:19
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
Done in 57.42s.

With angular CLI version 15.1.1, and angular CLI 14, it worked :

yarn nx generate @nrwl/angular:library my-lib --directory=package.json --verbose
yarn run v1.22.17
$ nx generate @nrwl/angular:library my-lib --directory=package.json --verbose

>  NX  Generating @nrwl/angular:library

[NX] Angular devkit called `writeWorkspace`, this may have had unintended consequences in workspace.json
[NX] Double check workspace.json before proceeding

UPDATE nx.json
UPDATE workspace.json
[...]
UPDATE tsconfig.base.json
Done in 54.74s.

I can see that in the log for the case that didn't worked I have this print that I don't have in the working output log :

[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic

Exception or Error

No response

Your Environment

"@angular/cli": "15.1.3",

Anything else relevant?

No response

alan-agius4 commented 1 year ago

I'm sorry, but this issue is not caused by Angular CLI.

Please file an issue in the NX project.

angular-automatic-lock-bot[bot] commented 1 year ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.