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

Nx generates invalid names for remote projects with multi-word names #27901

Closed
1 of 4 tasks
stacho91 opened this issue Sep 13, 2024 · 1 comment · Fixed by #27990
Closed
1 of 4 tasks

Nx generates invalid names for remote projects with multi-word names #27901

stacho91 opened this issue Sep 13, 2024 · 1 comment · Fixed by #27990
Assignees

Comments

@stacho91
Copy link

stacho91 commented Sep 13, 2024

Current Behavior

When creating a new remote project with a multi-word name using the Nx CLI (as the --name argument), regardless of the notation used (camelCase, underscore, or dot notation), Nx generates a hyphenated name, leading to a validation conflict.

nx g @nx/react:remote --name=myRemote --directory="apps/myRemote" --dynamic=true

NX Generating @nx/react:remote

✔ Which stylesheet format would you like to use? · none
✔ Which E2E test runner would you like to use? · none
✔ Which bundler do you want to use to build the application? · webpack
✔ What should be the project name and where should it be generated? · myRemote @ apps/myRemote

NX Invalid remote name provided: my-remote. The name can only contain letters, digits, underscores, and dollar signs.

Expected Behavior

The Nx CLI should correctly handle multi-word names for remote projects, generating valid names regardless of the notation used.

GitHub Repo

No response

Steps to Reproduce

  1. Install the latest Nx CLI using npm install -g nx
  2. Generate a new workspace with npx create-nx-workspace@latest
  3. Attempt to generate a new 'remote' project with a multi-word name, like so:
    nx g @nx/react:remote --name=myRemote --directory="apps/myRemote" --dynamic=true

Nx Report

Node           : 18.19.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.3

nx (global)        : 19.7.3
nx                 : 19.7.3
@nx/js             : 19.7.3
@nx/jest           : 19.7.3
@nx/linter         : 19.7.3
@nx/eslint         : 19.7.3
@nx/workspace      : 19.7.3
@nx/cypress        : 19.7.3
@nx/devkit         : 19.7.3
@nx/eslint-plugin  : 19.7.3
@nx/react          : 19.7.3
@nrwl/tao          : 19.7.3
@nx/web            : 19.7.3
@nx/webpack        : 19.7.3
typescript         : 5.5.4

Failure Logs

No response

Package Manager Version

No response

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@Coly010 Coly010 self-assigned this Sep 16, 2024
Coly010 added a commit that referenced this issue Sep 19, 2024
…27901 (#27990)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->
React Module Federation generators were normalizing names and using them
incorrectly


## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->
The host and remote generators should always use the name provided by
the determineProjectNameAndRootOpitons

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #27901
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

2 participants