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 release output wrong prerelease tag & versions both package.json #23235

Open
1 of 4 tasks
kaankoken opened this issue May 8, 2024 · 2 comments
Open
1 of 4 tasks

nx release output wrong prerelease tag & versions both package.json #23235

kaankoken opened this issue May 8, 2024 · 2 comments

Comments

@kaankoken
Copy link

Current Behavior

In mono repo configuration, independent mode, everything is perfectly fine when I run nx release version. However, whenever I try to create a prerelease with the flags of --specifier=prerelease --preid="rc" versioning goes so wrong.

  • The first problem is that when I try to run nx release version --preid="rc": it does not assign --specifier as prerelease. I have to assign it manually.
# Output

nx release version --verbose --preid="rc" --dry-run

 NX   Running release version for project: proj2

proj2 🔍 Reading data for package "proj2" from apps/proj2/package.json
proj2 📄 Resolved the current version as 0.2.0 from git tag "proj2@v0.2.0".
proj2 📄 Resolved the specifier as "patch" using git history and the conventional commits standard.
proj2 ✍️  New version 0.2.1 written to apps/proj2/package.json

 NX   Running release version for project: proj1

proj1 🔍 Reading data for package "proj1" from apps/proj1/package.json
proj1 📄 Resolved the current version as 0.1.2 from git tag "proj1@v0.1.2".
proj1 🚫 No changes were detected using git history and the conventional commits standard.
proj1 🚫 Skipping versioning "proj1" as no changes were detected.

UPDATE apps/proj2/package.json [dry-run]

    "private": true,
-   "version": "0.2.0"
+   "version": "0.2.1"
  }
  • The second problem is that when I introduced the specifier, it updated both package.json file
# Output

nx release version --verbose --preid="rc" --specifier=prerelease --dry-run

 NX   Running release version for project: proj2

proj2 🔍 Reading data for package "proj2" from apps/proj2/package.json
proj2 📄 Resolved the current version as 0.2.0 from git tag "proj2@v0.2.0".
proj2 📄 Using the provided version specifier "prerelease".
proj2 ✍️  New version 0.2.1-rc.0 written to apps/proj2/package.json

 NX   Running release version for project: proj1

proj1 🔍 Reading data for package "proj1" from apps/proj1/package.json
proj1 📄 Resolved the current version as 0.1.2 from git tag "proj1@v0.1.2".
proj1 📄 Using the provided version specifier "prerelease".
proj1 ✍️  New version 0.1.3-rc.0 written to apps/proj1/package.json

UPDATE apps/proj2/package.json [dry-run]

    "private": true,
-   "version": "0.2.0"
+   "version": "0.2.1-rc.0"
  }

UPDATE apps/proj1/package.json [dry-run]

    "private": true,
-   "version": "0.1.2"
+   "version": "0.1.3-rc.0"
  }
  • The last problem is that If the prerelease commit has BREAKING CHANGE or ! in a commit, it discards the breaking change part.

Commit Message: fix!: try prerelease

# prerelease output

nx release version --verbose --preid="rc" --specifier=prerelease --dry-run

 NX   Running release version for project: proj2

proj2 🔍 Reading data for package "proj2" from apps/proj2/package.json
proj2 📄 Resolved the current version as 0.2.0 from git tag "proj2@v0.2.0".
proj2 📄 Using the provided version specifier "prerelease".
proj2 ✍️  New version 0.2.1-rc.0 written to apps/proj2/package.json

 NX   Running release version for project: proj1

proj1 🔍 Reading data for package "proj1" from apps/proj1/package.json
proj1 📄 Resolved the current version as 0.1.2 from git tag "proj1@v0.1.2".
proj1 📄 Using the provided version specifier "prerelease".
proj1 ✍️  New version 0.1.3-rc.0 written to apps/proj1/package.json

UPDATE apps/proj2/package.json [dry-run]

    "private": true,
-   "version": "0.2.0"
+   "version": "0.2.1-rc.0"
  }

UPDATE apps/proj1/package.json [dry-run]

    "private": true,
-   "version": "0.1.2"
+   "version": "0.1.3-rc.0"
  }

# Release output

 nx release version --verbose --dry-run

 NX   Running release version for project: proj2

proj2 🔍 Reading data for package "proj2" from apps/proj2/package.json
proj2 📄 Resolved the current version as 0.2.0 from git tag "proj2@v0.2.0".
proj2 📄 Resolved the specifier as "major" using git history and the conventional commits standard.
proj2 ✍️  New version 1.0.0 written to apps/proj2/package.json

 NX   Running release version for project: proj1

proj1 🔍 Reading data for package "proj1" from apps/proj1/package.json
proj1 📄 Resolved the current version as 0.1.2 from git tag "proj1@v0.1.2".
proj1 🚫 No changes were detected using git history and the conventional commits standard.
proj1 🚫 Skipping versioning "proj1" as no changes were detected.

UPDATE apps/proj2/package.json [dry-run]

    "private": true,
-   "version": "0.2.0"
+   "version": "1.0.0"
  }






### Expected Behavior

For the first problem, when **--preid** is introduced as a command, it should assign `specifier` itself.
For the second problem, I do not except that both `package.json` to be updated.
For the last one, if the the latest tag was `proj2-v0.1.0`, and breaking change commit introduced to code base even if **prerelease** versioning enabled, I excepted to be version `proj2-v1.0.0-rc.0`

### GitHub Repo

_No response_

### Steps to Reproduce

1. Create a project with two **independent** package.
2. Add the configuration to `nx.json`
```bash
  "release": {
    "projects": [
      "apps/*"
    ],
    "projectsRelationship": "independent",
    "releaseTagPattern": "{projectName}@v{version}",
    "conventionalCommits": {
      "types": {
        "deps": {
          "semverBump": "patch"
        },
        "revert": {
          "semverBump": "patch"
        }
      }
    },
    "changelog": {
      "projectChangelogs": false,
      "workspaceChangelog": false
    },
    "version": {
      "conventionalCommits": true,
      "git": {
        "tag": true,
        "commit": true,
        "stageChanges": true
      }
    }
  },
  1. Create an initial versioning by running: nx release version --first-release
  2. Create a new commit & to check preid work on itself(for the first problem mentioned) run, nx release version --preid="rc"
  3. Create a new commit & run nx release version --preid="rc" --specifier=prerelease
  4. Create a new commit contains breaking change & run nx release version --preid="rc" --specifier=prerelease

Nx Report

NX   Report complete - copy this into the issue template

Node   : 21.7.3
OS     : darwin-arm64
pnpm   : 9.0.4

nx (global)    : 19.0.1
nx             : 19.0.0
@nx/js         : 19.0.0
@nx/workspace  : 19.0.0
@nrwl/tao      : 19.0.1
---------------------------------------
The following packages should match the installed version of nx
  - @nrwl/tao@19.0.1

To fix this, run `nx migrate nx@19.0.1`

Failure Logs

No response

Package Manager Version

pnpm --version 9.0.4

Operating System

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

Additional Information

No response

@kaankoken
Copy link
Author

any update @JamesHenry @FrozenPandaz ?

@kaankoken
Copy link
Author

@AgentEnder any updates?

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

3 participants