Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(react): support generating components using the path as provided #19608

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Oct 13, 2023

This PR adds consistent directory support to React, Next.js, React Native, and Expo generators.

Starting in v17, users can create components and other artifact by provide a path from the CWD.

# from workspace root
nx g component libs/ui/src/button # generates libs/ui/src/button.tsx under the ui project

# from libs/ui
nx g component src/button.tsx # generates the same as above since we are in the project dir

# other artifacts
nx g hook libs/my-hooks/use-foo/use-foo # react hook under my-hooks project
nx g redux libs/cart-state/cart # redux slice "cart" under cart-state project

Affected generators

  • @nx/react:component
  • @nx/react:hook
  • @nx/react:redux
  • @nx/next:component
  • @nx/next:page
  • @nx/react-native:component
  • @nx/expo:component

@jaysoo jaysoo requested review from a team as code owners October 13, 2023 18:24
@vercel
Copy link

vercel bot commented Oct 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview Oct 16, 2023 6:58pm

packages/expo/src/generators/component/schema.json Outdated Show resolved Hide resolved
packages/next/src/generators/component/component.ts Outdated Show resolved Hide resolved
packages/next/src/generators/component/schema.json Outdated Show resolved Hide resolved
packages/react/src/generators/redux/redux.ts Outdated Show resolved Hide resolved
packages/react/src/generators/redux/schema.d.ts Outdated Show resolved Hide resolved
packages/react/src/generators/redux/schema.json Outdated Show resolved Hide resolved
packages/react/src/generators/redux/schema.json Outdated Show resolved Hide resolved
@jaysoo jaysoo force-pushed the feat/react-component-generators branch from f2c7517 to 0f37037 Compare October 16, 2023 18:44
@jaysoo jaysoo force-pushed the feat/react-component-generators branch from 0f37037 to d36bf65 Compare October 16, 2023 18:53
@FrozenPandaz FrozenPandaz merged commit 513e234 into nrwl:master Oct 16, 2023
2 checks passed
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants