-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Description
Current Behavior
When you have a local (nx plugin) generator that imports from @nx/devkit it also compiles and executes the barrel file (index.ts/js) in your tmp folder. It doesn't matter if the tmp folder is ignored (git) / excluded (tsconfig).
To illustrate the issue I created an example repo (https://github.com/Roozenboom/nx-examples/tree/local-generator-tmp-index) that has a nx plugin with a simple generator and a tmp/index.ts file that only does a console.log. When the generator is executed the console.log is also displayed.

When the imports of @nx/devkit are removed from the generator the console.log from the tmp folder is not shown anymore.

result:

The issue is very specific to index (barrel) files in the tmp folder. If I rename the folder to for example 'temp' or the file to main.ts the console.log is not displayed.
Expected Behavior
I would not expect the tmp/index.ts file to be compiled/executed when I run a generator.
GitHub Repo
Steps to Reproduce
- Checkout branch
https://github.com/Roozenboom/nx-examples/tree/local-generator-tmp-index - Install dependencies:
yarn install - Execute generator:
yarn nx g @nx-example/local-nx-plugin:example-generator test --dry-run
Files to check are:
- tools/local-nx-plugin/src/generators/example-generator/generator.ts
- tmp/index.ts
Nx Report
Node : 20.6.1
OS : darwin-arm64
yarn : 1.22.19
nx : 16.8.1
@nx/js : 16.8.1
@nx/jest : 16.8.1
@nx/linter : 16.8.1
@nx/workspace : 16.8.1
@nx/angular : 16.8.1
@nx/cypress : 16.8.1
@nx/devkit : 16.8.1
@nx/eslint-plugin : 16.8.1
@nx/plugin : 16.8.1
@nx/react : 16.8.1
@nrwl/tao : 16.8.1
@nx/web : 16.8.1
@nx/webpack : 16.8.1
nx-cloud : 16.4.0
typescript : 5.1.6
---------------------------------------
Community plugins:
@ngrx/component-store : 16.0.1
@ngrx/effects : 16.0.1
@ngrx/entity : 16.0.1
@ngrx/router-store : 16.0.1
@ngrx/store : 16.0.1
@ngrx/store-devtools : 16.0.1
---------------------------------------
Local workspace plugins:
@nx-example/local-nx-pluginFailure Logs
No response
Package Manager Version
No response
Operating System
- macOS
- Linux
- Windows
- Other (Please specify)
Additional Information
No response