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

getProjects is missing tags data for the root project #26530

Closed
1 of 4 tasks
tetarchus opened this issue Jun 12, 2024 · 1 comment · Fixed by #27138
Closed
1 of 4 tasks

getProjects is missing tags data for the root project #26530

tetarchus opened this issue Jun 12, 2024 · 1 comment · Fixed by #27138

Comments

@tetarchus
Copy link

Current Behavior

Running getProjects from nx/src/devkit-exports or @nx/devkit ignores any defined tags in the nx property of a package.json file (including at root), as well as any targets from npm scripts, including properties such as dependsOn defined within the nx.targets key of the package.json file.

Expected Behavior

The output ProjectConfiguration includes tags and targets defined in the nx object from the package.json file, or in the targets from scripts.

GitHub Repo

https://github.com/tetarchus/nx-root-repro

Steps to Reproduce

Repro is as basic as possible to reproduce output

  1. Clone repro and install dependencies

  2. Run nx project @nx-root-repro/source --web or nx project www --web

  3. Displayed tags matches those defined in the relevant package.json file:
    Screenshot 2024-06-12 at 18 27 52

  4. Run nx check (simply runs a small .js file that calls getProjects on the cwd tree)

  5. Output does not include the tags, the inferred Project Type of library, or any targets (from scripts, or with data from targets key in the nx section of package.json:

Map(2) {
  'www' => { root: 'apps/www', name: 'www' },
  '@nx-root-repro/source' => { root: '.', name: '@nx-root-repro/source' }
}

Nx Report

Node   : 20.14.0
OS     : darwin-x64
npm    : 10.7.0

nx (global)    : 19.2.3
nx             : 19.2.3
@nx/js         : 19.2.3
@nx/workspace  : 19.2.3
@nx/devkit     : 19.2.3
@nrwl/tao      : 19.2.3
typescript     : 5.4.5

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

It seems that regardless of the content of the nx key in package.json, the output ProjectConfiguration for the root project only ever contains its name, and the root of ..

Having the tags and targets data returned (as well as other 'accepted' properties, which according to IDE autocompletion, include ignore, implicitDependencies and namedInputs) would allow utilising the root project in the same way as other projects (e.g - filtering the projects based on tags).

ZackDeRose pushed a commit to ZackDeRose/nx that referenced this issue Aug 8, 2024
<!-- 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
Calling `updateProjectConfiguration` on a package json based project
fails

## Expected Behavior
Calling `updateProjectConfiguration` on a package json based project
works

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

Fixes nrwl#26530
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 Aug 26, 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.

3 participants