nrwl / nx

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

Nx release doesn't update the right package.json files #28678

Open njsokol opened 2 weeks ago

njsokol commented 2 weeks ago

Current Behavior

Context:

Whats happening: When running nx release the correct versions of "to" are being interpreted and added to the output, but they are being added to the dist/package.json not the <package>/package.json

UPDATE packages/react-components/react-button/dist/package.json [dry-run]

    "name": "@company/react-button",
-   "version": "0.1.0",
+   "version": "0.1.1",
    "description": "A button component for the library",

    "dependencies": {
-     "@company/react-theme": "0.0.0"
+     "@company/react-theme": "0.1.0"
    },

  }
+

This is great in that it's updating the packages "/dist" because when I publish, all the versions are now correct in the published files and folders. But my problem is that then in the repo, if I were to run the release again, my source files are now saying the <package>/package.json is still at 0.1.0 and not 0.1.1 as it should have been from the previous release.

Expected Behavior

Doing the release should update the <package>/package.json file to match what was just published.

GitHub Repo

No response

Steps to Reproduce

Can't reproduce as the library is private

Nx Report

Node : 20.12.2 OS : linux-x64 Native Target : x86_64-linux pnpm : 8.15.8

nx : 20.0.3 @nx/js : 20.0.3 @nx/jest : 20.0.3 @nx/eslint : 20.0.3 @nx/workspace : 20.0.3 @nx/cypress : 20.0.3 @nx/devkit : 20.0.3 @nrwl/devkit : 18.3.3 @nx/eslint-plugin : 20.0.3 @nx/playwright : 20.0.3 @nx/plugin : 20.0.3 @nx/storybook : 20.0.3 @nrwl/tao : 19.8.8 @nx/vite : 20.0.3 @nx/web : 20.0.3 @nx/webpack : 20.0.3 typescript : 5.4.5

Registered Plugins: @nx/storybook/plugin @nx/eslint/plugin @nx/playwright/plugin

Failure Logs

No response

Package Manager Version

No response

Operating System

Additional Information

No response

jgsmarques commented 2 days ago

I'm having a similar issue with version 20.1.0, where during the release process all dist/**/package.json get updated with the correct new version, but the packages/**/package.json still have 0.0.1, which was the original version.

This leads to another issue which is a subsequent run of the release for a package without changes will try to publish the 0.0.1 package again, and will fail (because it already exists, probably). No idea why the release step will do this though, since the dry run correctly identifies that the package has not been changed and should not be bumped nor should the changelog be generated