question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to tag and publish an initial v1.0.0 with conventional commits?

See original GitHub issue

I’m having a hard time figuring out how can I tag and publish an initial v1.0.0 with conventional commits using lerna publish.

This is my lerna.json:

{
  "version": "independent",
  "npmClient": "yarn",
  "useWorkspaces": true,
  "stream": true,
  "command": {
    "publish": {
      "registry": "http://localhost:4873",
      "verifyAccess": false
    },
    "version": {
      "allowBranch": "master",
      "conventionalCommits": true,
      "exact": true,
      "message": "chore(release): update release notes and package versions",
      "noCommitHooks": true
    }
  }
}

Now let’s say I’m working on my first initial version and I have a single package (not relevant to have more for the purpose of this issue) which has "version": "1.0.0" in package.json.

If I make fix: ... commits, lerna publish will suggest the next version to be v1.0.1, if I make feat: ... commits, lerna publish will suggest the next version to be v1.1.0. Even if I set "version": "0.0.0" in package.json, fix: ... will lead to v0.0.1 and feat: ... will lead to v0.1.0.

The only I’ve found to have lerna publish to tag and publish the first version as v1.0.0 is to have the major version in package.json set to 0 (minor and patch can be anything) and then make a BREAKING CHANGE commit. That way lerna publish will suggest the next version to be v1.0.0.

But it doesn’t feel right to add BREAKING CHANGE to a commit just for the purpose of tagging a first release as v1.0.0. There’s not breaking change (it’s the initial version after all) and that will be added to CHANGELOG.md, which doesn’t make sense.

How can I tag and publish the first initial version of my package as v1.0.0 with a single entry on my CHANGELOG.md something like feat: initial version?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5

github_iconTop GitHub Comments

3reactions
brianjquinncommented, Sep 4, 2020

yeah i understand aligning the behavior with node for 0.x.x, so no arguments there - it just seems like there is no automated way to initially create a package in a monorepo and publish it as 1.0.0 using conventional-commits … running the conventional graduate makes sense, but I’m still unclear how I would automate that since you are required to specify the specific package you want to graduate (otherwise it automatically does all of the pre-release packages in a similar fashion to force publish) … maybe the graduation process isn’t meant to be automated with conventional commits, which is disappointing because otherwise it works flawlessly

2reactions
rfgamaralcommented, Nov 5, 2019

After a bit more digging and testing I’ve realized I can just call lerna publish 1.0.0 to publish the first initial version, no matter the fixes, feats or breaking changes in commit messages (everything will be properly added to the CHANGELOG.md under 1.0.0).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conventional Commits
The Conventional Commits specification is a lightweight convention on top of commit messages. It provides an easy set of rules for creating an...
Read more >
Automate Semantic Versioning with Conventional Commits
Updating the package.json and CHANGELOG based on the commit history. Before configuring the updates, you need to make sure that your package.
Read more >
Git - Tagging - Git SCM
A lightweight tag is very much like a branch that doesn't change — it's just a pointer to a specific commit. Annotated tags,...
Read more >
Supercharge your Java Projects with Conventional Commits ...
tl;dr end! Semantic Versioning. First, let's talk about the idea of a Semantic Version. A semantic version is nothing more than a versioning ......
Read more >
Git commit message convention that you can follow!
Tagged with github, webdev, productivity, git. ... https://www.conventionalcommits.org/en/v1.0.0/ · https://gist.github.com/joshbuchea/ ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found