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(nx-python): add projectNameAndRootFormat parameter to poetry project generator #186

Merged
merged 2 commits into from
Nov 10, 2023

Conversation

lucasvieirasilva
Copy link
Owner

This PR adds the projectNameAndRootFormat parameter to the @nxlv/python:poetry-project project generator.

Current Behavior

Currently, the project generator relies on the workspace layout (appsDir = apps and libsDir = libs) to generate the project name + project folder,

However, On Nx v16.8.0 or higher, the generators are prompting the user to choose how Nx will calculate where the project should be located, by using the --projectNameAndRootFormat with as-provided or derived, which the default value for Nx is as-provided.

So, if the workspace is v16.8.0 or higher, and run the command nx generate @nxlv/python:poetry-project myproject to generate the project, the project is going to be created at the root of the repo myproject.

And if you provide directory option with src/myproject, the name of the project will be src-myproject, which could cause some confusion.

As happened here: #182

Expected Behavior

To make this plugin compatible with the previous versions and don't break the generator for those who still using Nx workspaces lower than v16.8.0, I've added the projectNameAndRootFormat parameter to the @nxlv/python:poetry-project project generator as default derived.

For new Nx workspaces, the user should provide the --projectNameAndRootFormat as-provided and work in the Nx is recommending now or add the following configuration to the nx.json:

{
  ...
  "generators": {
    "@nxlv/python:poetry-project": {
      "projectNameAndRootFormat": "as-provided"
    }
  }
  ...
}

I've changed the README.md to instruct new users on how to deal with this change.

Related Issue(s)

Reference #182

@lucasvieirasilva lucasvieirasilva added bug Something isn't working enhancement New feature or request labels Nov 10, 2023
@lucasvieirasilva lucasvieirasilva linked an issue Nov 10, 2023 that may be closed by this pull request
@lucasvieirasilva lucasvieirasilva self-assigned this Nov 10, 2023
@lucasvieirasilva lucasvieirasilva merged commit e0dffbe into main Nov 10, 2023
3 checks passed
github-actions bot pushed a commit that referenced this pull request Nov 10, 2023
# [16.3.0](nx-python-v16.2.0...nx-python-v16.3.0) (2023-11-10)

### Features

* **nx-python:** add `projectNameAndRootFormat` parameter to poetry project generator ([#186](#186)) ([e0dffbe](e0dffbe)), closes [#182](#182)
Copy link

🎉 This PR is included in version 16.3.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NX Cannot find project
1 participant