Skip to content

Commit

Permalink
ci: switch from lerna to changesets for publishing new versions
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbert authored and YourivHDenHaag committed Nov 11, 2024
1 parent 400e01c commit 4890eb1
Show file tree
Hide file tree
Showing 9 changed files with 491 additions and 1,669 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
22 changes: 9 additions & 13 deletions .github/workflows/cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -114,22 +114,18 @@ jobs:
- name: build library
run: pnpm run build

- name: lerna version
- name: Publish to GitHub repository
uses: changesets/action@aba318e9165b45b7948c60273e0b72fce0a64eb9 # v1.4.7
id: changeset
env:
GITHUB_TOKEN: ${{ secrets.GH_ADMIN_TOKEN }}
GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
GIT_AUTHOR_NAME: "NL Design System"
GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
GIT_COMMITTER_NAME: "NL Design System"
run: |
git push --set-upstream origin HEAD
pnpm run release
- name: lerna publish
env:
NPM_ACCESS_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
run: |
pnpm config set "//registry.npmjs.org/:_authToken" "${NPM_ACCESS_TOKEN}"
pnpm config set access public
pnpm run publish
pnpm config delete "//registry.npmjs.org/:_authToken"
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
with:
commit: "docs(release): design system packages"
setupGitUser: false
title: "docs(release): design system packages"
publish: "pnpm run publish"
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ package.json
pnpm-lock.yaml
yarn.lock
storybook-static

# Ignore changeset files, because they are temporary and frequently contributed by non-developers
.changeset/*.md
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ For convenience, all criteria relevant for contributors are listed below, with t

- Version control MUST be maintained for all written code.
- All decisions MUST be documented using commit messages, so that components can be versioned accordingly. If a contribution stems from an issue or discussion, they MUST always be linked.
- Component versioning is done through Lerna, by maintainers of the repository. Collaborators do not need to increment versions.
- Component versioning is done through pnpm changesets. Collaborators need to create a changeset using `pnpm -w changeset`.

- **[Use a coherent style](https://standard.publiccode.net/criteria/style.html)**

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,7 @@ Be sure to install IDE plugins for ESlint, Prettier, JSONLint and Stylelint if a
The project folders are structured in the following way:
The `src` folder houses both our `components` and our storybook `stories`, these are both in their own folders.
Our components are sorted into several categories, where each category has its own parent folder.
All of our components are their own package and managed with lerna, docs are available [here](https://lerna.js.org/).
Similarly, each category is its own package managed with lerna.
All of our components are their own package and managed with pnpm.

#### Adding components

Expand All @@ -84,7 +83,7 @@ We don't need to re-run the command over-and-over because storybook should detec

##### Creating a new package for a new component

In order to create a new lerna package we need to create a package.json file for it inside it's folder.
In order to create a new npm package we need to create a package.json file for it inside it's folder.
Start by filling it with the following information:

```json
Expand Down
21 changes: 0 additions & 21 deletions lerna.json

This file was deleted.

16 changes: 4 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,11 @@
"bugs": "https://github.com/nl-design-system/denhaag/issues",
"repository": {
"type": "git",
"url": "https://github.com/nl-design-system/denhaag.git"
"url": "https://github.com/nl-design-system/denhaag.git",
"directory": "."
},
"license": "EUPL-1.2",
"author": "Municipality of The Hague",
"workspaces": [
"packages/*",
"components/*",
"proprietary/*"
],
"scripts": {
"build": "pnpm run build:library && pnpm run build:storybook",
"build:library": "pnpm run --recursive build",
Expand All @@ -31,9 +27,7 @@
"prepare": "husky",
"preinstall": "npx only-allow pnpm",
"prettier": "prettier --write .",
"publish": "lerna publish from-package --yes",
"release": "lerna version prerelease --no-changelog --no-private --no-commit-hooks --yes",
"release-denhaag-nl": "lerna version prerelease --no-changelog --no-private --no-commit-hooks --yes --no-git-tag-version --preid www-denhaag-nl",
"publish": "changeset publish",
"storybook": "npm-run-all --parallel watch:*",
"test-update": "npm-run-all --sequential lint typecheck build",
"update-patch": "npm-check-updates --configFileName .ncurc.patch.js",
Expand All @@ -51,11 +45,9 @@
"sass": "1.77.8"
},
"devDependencies": {
"@changesets/cli": "2.27.7",
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@lerna-lite/cli": "3.7.1",
"@lerna-lite/publish": "3.7.1",
"@lerna-lite/version": "3.7.1",
"@rollup/plugin-commonjs": "26.0.1",
"@rollup/plugin-node-resolve": "15.2.3",
"@svgr/rollup": "8.1.0",
Expand Down
Loading

0 comments on commit 4890eb1

Please sign in to comment.