nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.82k stars 2.38k forks source link

Filename generated without "use-" prefix for hooks generated with "as-provided" flag #26840

Open vigneshTheDev opened 4 months ago

vigneshTheDev commented 4 months ago

Current Behavior

When we run this command:

nx g @nx/react:hook --export false --directory apps/webapp/src/app/hooks/ --nameAndDirectoryFormat as-provided --name useboard --dry-run

This outputs:

CREATE apps/webapp/src/app/hooks/board.spec.tsx
CREATE apps/webapp/src/app/hooks/board.ts

Expected Behavior

It should output:

CREATE apps/webapp/src/app/hooks/use-board.spec.tsx
CREATE apps/webapp/src/app/hooks/use-board.ts

GitHub Repo

No response

Steps to Reproduce

  1. Clone the repo: git clone git@github.com:nrwl/nx-examples.git
  2. Install dependencies: cd nx-examples && yarn
  3. Generate new hook: npx nx g @nx/react:hook --export false --directory apps/cart/src/app/hooks/ --nameAndDirectoryFormat as-provided --name usediscount --dry-run

Nx Report

NX   Report complete - copy this into the issue template

Node   : 20.15.0
OS     : darwin-arm64
yarn   : 1.22.22

nx                 : 19.4.0-rc.0
@nx/js             : 19.4.0-rc.0
@nx/jest           : 19.4.0-rc.0
@nx/linter         : 19.4.0-rc.0
@nx/eslint         : 19.4.0-rc.0
@nx/workspace      : 19.4.0-rc.0
@nx/angular        : 19.4.0-rc.0
@nx/cypress        : 19.4.0-rc.0
@nx/devkit         : 19.4.0-rc.0
@nx/eslint-plugin  : 19.4.0-rc.0
@nx/react          : 19.4.0-rc.0
@nrwl/tao          : 19.4.0-rc.0
@nx/web            : 19.4.0-rc.0
@nx/webpack        : 19.4.0-rc.0
typescript         : 5.4.3
---------------------------------------
Registered Plugins:
@nx/eslint/plugin
@nx/cypress/plugin
@nx/jest/plugin
---------------------------------------
Community plugins:
@ngrx/component-store : 18.0.1
@ngrx/effects         : 18.0.1
@ngrx/entity          : 18.0.1
@ngrx/operators       : 18.0.1
@ngrx/router-store    : 18.0.1
@ngrx/store           : 18.0.1
@ngrx/store-devtools  : 18.0.1

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

xiongemi commented 2 months ago

i think it might be fixed by https://github.com/nrwl/nx/pull/27714/files