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

lerna version always bump a patch version #3425

Closed
1aron opened this issue Nov 12, 2022 · 2 comments
Closed

lerna version always bump a patch version #3425

1aron opened this issue Nov 12, 2022 · 2 comments

Comments

@1aron
Copy link

1aron commented Nov 12, 2022

Current Behavior

Lerna has done a very good job in all aspects, but the version bumping and difference analysis are a bit unsatisfactory.

Here is our file structure:

css
└───packages
│   └─── css
│   └─── compiler
│   └─── vite
│   README.md
│   lerna.json    
│   ...

We set changelogPreset: "conventionalcommits" and deliberately tested the following commits:

  • Change some files in the packages/css and commit with chore: css
  • Change some files in the packages/vite and commit with feat: vite
  • Change some files in the packages/compiler and commit with fix: compiler

Execute lerna version in beta branch:

lerna info getChangelogConfig Auto-prefixing conventional-changelog preset "conventionalcommits"
lerna info getChangelogConfig Successfully resolved preset "conventional-changelog-conventionalcommits"

Changes:
 - @master/css.compiler: 2.0.0-beta.19 => 2.0.0-beta.20
 - @master/css:          2.0.0-beta.41 => 2.0.0-beta.42
 - @master/css.vite:     2.0.0-beta.19 => 2.0.0-beta.20

Related Issues & Problems:

  1. feat(version): bump prerelease versions from conventional commits (#2… #3362
  2. lerna version --conventional-commits bumping non impacting commits #1569
  3. Bump version without following conventional commits.
  4. Always bump patch version even without adding any semantic prefix.

Expected Behavior

Since the title of the @master/css commit is prefixed with chore:, it should not bump a patch version.

Changes:
+ @master/css.compiler: 2.0.0-beta.19 => 2.0.0-beta.20
- @master/css:          2.0.0-beta.41 => 2.0.0-beta.42
+ @master/css.vite:     2.0.0-beta.19 => 2.0.0-beta.20

Version bumpings should follow the conventions of changesets and semantic-releases.

If lerna version --conventional-commits doesn't depend on releaseType to tell if a release version or changelog is required, but always releases a patch version, then I'd say it's completely unavailable on CI.

Because you can't assume that any commit requires a release version, e.g. chore, docs, etc.

Using lerna instead of changesets and semantic-releases is one step away!

Steps to Reproduce

https://github.com/master-co/css/tree/beta

As above, try modifying some files and adding comments:

chore: css
feat: vite
fix: compiler
lerna version

Failure Logs / Configuration

lerna.json

{
    "$schema": "node_modules/lerna/schemas/lerna-schema.json",
    "useWorkspaces": true,
    "version": "independent",
    "changelogPreset": "conventionalcommits",
    "command": {
        "version": {
            "message": "chore(release): publish",
            "conventionalCommits": true,
            "conventionalBumpPrerelease": true
        }
    }
}

package.json

{
    "name": "root",
    "version": "0.0.0",
    "scripts": {
        "bootstrap": "lerna bootstrap"
    },
    "repository": {
        "type": "git",
        "url": "https://github.com/master-co/css.git"
    },
    "workspaces": [
        "packages/*"
    ],
    "devDependencies": {
        "@commitlint/cli": "^17.2.0",
        "@commitlint/config-conventional": "^17.2.0",
        "@swc/core": "^1.3.9",
        "@swc/jest": "^0.2.23",
        "@types/jest": "^29.2.0",
        "@types/node": "^18.11.0",
        "@typescript-eslint/eslint-plugin": "^5.40.1",
        "@typescript-eslint/parser": "^5.40.1",
        "dedent": "^0.7.0",
        "esbuild": "^0.15.10",
        "eslint": "^8.25.0",
        "husky": "^8.0.2",
        "jest": "^29.2.2",
        "jest-environment-jsdom": "^29.3.1",
        "jest-puppeteer": "^6.1.1",
        "lerna": "^6.0.3",
        "puppeteer": "^19.2.2",
        "typescript": "^4.8.4"
    }
}

Environment

 Environment info:

  System:
    OS: macOS 12.5
    CPU: (8) arm64 Apple M2
  Binaries:
    Node: 17.9.1 - ~/.nvm/versions/node/v17.9.1/bin/node
    npm: 8.11.0 - ~/.nvm/versions/node/v17.9.1/bin/npm
  Utilities:
    Git: 2.37.3 - /opt/homebrew/bin/git
  npmPackages:
    lerna: ^6.0.3 => 6.0.3 
@amorscher
Copy link
Contributor

amorscher commented Nov 12, 2022

I think #3362 is not released yet that is why the behavior is not inlcuded in 6.0.3. I tried it with a locally built version and I get following bumps:

* 6aed03a chore: css
* 3e82280 fix: compiler
* ff62267 feat: vite

results in:

Changes:
 - @master/css.compiler: 2.0.0-beta.19 => 2.0.1-beta.0
 - @master/css: 2.0.0-beta.41 => 2.0.1-beta.0
 - @master/css.vite: 2.0.0-beta.19 => 2.1.0-beta.0

@1aron
Copy link
Author

1aron commented Nov 13, 2022

@amorscher chore shouldn't bump any version. So @master/css should be excluded from the change.

@1aron 1aron closed this as completed Nov 13, 2022
@1aron 1aron reopened this Nov 13, 2022
@1aron 1aron closed this as completed Nov 15, 2022
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