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 doesn't update the version of source project #29474

Open
1 of 4 tasks
mxvsh opened this issue Dec 27, 2024 · 1 comment
Open
1 of 4 tasks

Nx doesn't update the version of source project #29474

mxvsh opened this issue Dec 27, 2024 · 1 comment

Comments

@mxvsh
Copy link
Contributor

mxvsh commented Dec 27, 2024

Current Behavior

When I run nx release it only updates versions of the packages that are built inside dist/.
And inside the packages/* folders, Nx doesn't update the versions. It always remains same "0.0.1".

Expected Behavior

It should update version of the projects inside the packages/ folder

GitHub Repo

No response

Steps to Reproduce

  1. Create React Nx workspace (integrated monorepo)
  2. Create packages
  3. Run nx release

Nx Report

Node           : 20.3.0
OS             : darwin-arm64
Native Target  : aarch64-macos
pnpm           : 8.6.2

nx (global)        : 20.0.0
nx                 : 20.2.2
@nx/js             : 20.2.2
@nx/jest           : 20.2.2
@nx/eslint         : 20.2.2
@nx/workspace      : 20.2.2
@nx/devkit         : 20.2.2
@nx/eslint-plugin  : 20.2.2
@nx/playwright     : 20.2.2
@nx/react          : 20.2.2
@nx/vite           : 20.2.2
@nx/web            : 20.2.2
typescript         : 5.6.3
---------------------------------------
Registered Plugins:
@nx/vite/plugin
@nx/eslint/plugin
@nx/playwright/plugin
@nx/jest/plugin

Failure Logs

Package Manager Version

pnpm

Operating System

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

Additional Information

No response

@thdk
Copy link
Contributor

thdk commented Dec 28, 2024

@mxvsh Can you share your nx.json and your project.json files for relevant libs?

If you have a look at the docs here you'll see that you have it currently set up for scenario 2 where the actual version of packages needs to be resolved either from a git tag or by fetching the latest version from the npm registry since as you noticed, the version is not written into the source directories.

If you want to change to scenario 1 you'll have to update your build targets to output to {projectRoot}/dist and adopt the packageRoot option for both the version generator and the publish executor.

nx.json for scenario 1:

  "release": {
    "version": {
      "generatorOptions": {
        "packageRoot": "dist/packages/{projectName}",
      }
    }
  },
  "targetDefaults": {
    "nx-release-publish": {
      "options": {
        "packageRoot": "dist/packages/{projectName}"
      }
    }

It's not a bug but I understand your issue. Every team has their own way of versioning / publishing and nx is trying hard to come up with a tool that can be configured to work for everyone. If it works out the box for you, then you are very lucky :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants