Skip to content

Commit 7c14fd1

Browse files
Docs/versioning and publishing (#45)
* chore: add config option in lerna.json * docs: update README.md * docs: details about lerna version * docs: tweak in publish docs --------- Co-authored-by: Pierre Zimmermann <64224599+pierrezimmermannbam@users.noreply.github.com>
1 parent 7997407 commit 7c14fd1

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

README.md

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,27 @@ Here are some useful commands:
3232

3333
## Publishing a new version of a package
3434

35-
If this is the first time the package is published to npm, running `yarn lerna publish --no-private` [doesn't seem to work](https://github.com/lerna/lerna/issues/1821). Instead, you should `cd` into your package and run `yarn publish --access public`. `yarn` will then ask the new version the package should have.
36-
37-
If the package has already been published on npm, you can use `yarn lerna publish --no-private` in the root directory of the project.
38-
39-
For each of these two tasks, you will need to have an account on [npmjs.com](https://www.npmjs.com/) and to be added to the [@bam.tech](https://www.npmjs.com/settings/bam.tech/packages) organization.
35+
The publication is done automatically by this [Github Workflow](.github/workflows/publish.yml) when a new tag is pushed to the repository.
36+
All you have to do is the versioning of the packages you want to publish.
37+
38+
> You need to be on the main branch and have the repo write access to publish a new version.
39+
40+
Run `yarn lerna version` to start the process. It will ask you which packages you want to publish and which version you want to publish them under.
41+
42+
```bash
43+
? Select a new version (currently 1.0.0) (Use arrow keys)
44+
❯ Patch (1.0.1) # bug fixes
45+
Minor (1.1.0) # new features
46+
Major (2.0.0) # breaking changes
47+
Prepatch (1.0.1-alpha.0)
48+
Preminor (1.1.0-alpha.0)
49+
Premajor (2.0.0-alpha.0)
50+
Custom Prerelease
51+
Custom Version
52+
```
53+
54+
After you have selected the packages and the versions, Lerna will push a new tagged commit with the version bumps in `package.json` files.
55+
The pushed tag will trigger the Github Workflow which will publish the packages to NPM.
4056

4157
## Running commands
4258

lerna.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
33
"useWorkspaces": true,
4-
"version": "independent"
4+
"version": "independent",
5+
"packages": ["packages/*"],
6+
"command": {
7+
"version": {
8+
"noPrivate": true
9+
}
10+
}
511
}

0 commit comments

Comments
 (0)