Skip to content

Commit

Permalink
chore: replace lerna with changesets (#1227)
Browse files Browse the repository at this point in the history
For some time, Lerna would generate garbled changelogs.
Replacing it with changesets helps because changesets lets you specify
which packages to bump intead of trying to figure it out on its own.

* replace lerna prepare with yarn workspaces run
* remove publish command from workspace root else yarn tries (and fails) to publish the root
* move cli example out of packages, it's not meant to be published and it confuses yarn
* update publishing instructions
  • Loading branch information
ludofischer committed Nov 11, 2021
1 parent c38f14c commit 50fd32b
Show file tree
Hide file tree
Showing 11 changed files with 670 additions and 2,847 deletions.
10 changes: 10 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.2/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"linked": [],
"access": "public",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": []
}
23 changes: 16 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,28 @@ be edited by hand.

### Releasing

We use lerna and conventional commits to update the changelog and tag releases.
To tag a pre-release and generate the changelog, run:
We use @changesets/cli to update the changelog and tag releases.
First make sure a changeset exists for every change you want to publish. A changeset is a text file
with the description of the change and the affected packages.
To create a changeset run

```
yarn lerna version --conventional-commits --conventional-prerelease --preid rc
yarn changeset
```

It's best to select the affected packages by hand rather than rely on the tools automatically
discovering dependencies. For example, if a change affects a plugin `cssnano-preset-default`,
select the plugin and `cssnano-preset-default` by hand (as well as any other dependent presets).
To tag a release and generate the changelog, run:

```
yarn changeset version
```
Use `--conventional-graduate` to generate the tags for a stable release.

To publish the pre-release to npm, run:
To publish release to npm, run:
```
yarn lerna publish from-package --dist-tag next
yarn changeset publish from-package
```
To publish a stable release, use `latest` instead of `next`.

## Are there other ways of contributing?

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
"all-contributors": "all-contributors add",
"lint": "eslint . --cache --ignore-path .gitignore --ext .js,.mjs",
"fixlint": "yarn lint -- --fix",
"prepare": "lerna run --stream prepare",
"prepare": "yarn workspaces run prepare",
"build:integration": "node ./util/buildFrameworks.mjs",
"pretest": "yarn lint",
"test:only": "cross-env BABEL_ENV=test jest",
"test:coverage": "cross-env BABEL_ENV=test jest --coverage",
"test": "yarn test:coverage",
"deploy": "cd site && GIT_USER=anikethsaha yarn deploy",
"publish": "lerna publish"
"deploy": "cd site && GIT_USER=anikethsaha yarn deploy"
},
"workspaces": [
"./packages/*"
Expand All @@ -24,6 +23,7 @@
"@babel/cli": "^7.15.7",
"@babel/core": "^7.15.5",
"@babel/preset-env": "^7.15.6",
"@changesets/cli": "^2.18.0",
"all-contributors-cli": "^6.20.0",
"babel-jest": "^27.2.1",
"babel-plugin-add-module-exports": "^1.0.2",
Expand All @@ -42,7 +42,6 @@
"html-to-text": "^8.0.0",
"jest": "^27.2.1",
"jest-junit": "^12.1.0",
"lerna": "4.0.0",
"node-fetch": "^2.6.1",
"pleeease-filters": "^4.0.0",
"postcss": "^8.3.0",
Expand Down
Loading

0 comments on commit 50fd32b

Please sign in to comment.