Skip to content

Commit 6c59698

Browse files
authored
chore: add changeset tool (#919)
Signed-off-by: Tomás Migone <[email protected]>
1 parent c557297 commit 6c59698

File tree

4 files changed

+722
-25
lines changed

4 files changed

+722
-25
lines changed

.changeset/config.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": "@changesets/cli/changelog",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "restricted",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

README.md

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -65,21 +65,38 @@ $ yarn
6565
$ yarn build
6666
```
6767

68-
### Versioning a package
68+
### Versioning and publishing packages
6969

70-
To version a package, run the following command from the root of the repository:
70+
We use [changesets](https://github.com/changesets/changesets) to manage package versioning, this ensures that all packages are versioned together in a consistent manner and helps with generating changelogs.
71+
72+
#### Step 1: Creating a changeset
73+
74+
A changeset is a file that describes the changes that have been made to the packages in the repository. To create a changeset, run the following command from the root of the repository:
7175

7276
```bash
73-
# Change directory to the package you want to version
74-
$ cd packages/<package-name>
77+
$ yarn changeset
78+
```
79+
80+
Changeset files are stored in the `.changeset` directory until they are packaged into a release. You can commit these files and even merge them into your main branch without publishing a release.
81+
82+
#### Step 2: Creating a package release
83+
84+
When you are ready to create a new package release, run the following command to package all changesets, this will also bump package versions and dependencies:
7585

76-
# Bump the version
77-
$ yarn version <major|minor|patch>
86+
```bash
87+
$ yarn changeset version
7888
```
7989

80-
__Note on cross referenced packages__: Bumping the version of a package that is cross referenced by another package will automatically bump the dependency version in the other package. For example, if you bump the version of `sdk` from `0.0.1` to `0.0.2`, the required version of `sdk` in the `contracts` package will automatically be bumped to `0.0.2`. Depending on the nature of the change you might need to bump (and publish) a new version of the `contracts` package as well.
90+
### Step 3: Tagging the release
91+
92+
After creating a package release, you will need to tag the release commit with the version number. To do this, run the following command from the root of the repository:
93+
94+
```bash
95+
$ yarn changeset tag
96+
$ git push --follow-tags
97+
```
8198

82-
### Publishing a package
99+
#### Step 4: Publishing a package release
83100

84101
Packages are published and distributed via NPM. To publish a package, run the following command from the root of the repository:
85102

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"test": "yarn workspaces foreach --all --parallel --verbose --interlaced run test"
2020
},
2121
"devDependencies": {
22+
"@changesets/cli": "^2.27.1",
2223
"@commitlint/cli": "^18.4.3",
2324
"@commitlint/config-conventional": "^18.4.3",
2425
"husky": "^8.0.3"

0 commit comments

Comments
 (0)