Skip to content

Commit d358089

Browse files
authored
Replaced lerna-changelog with changesets. Installed update-workspace-root-version. (#242)
* chore: Replaced lerna-changelog with changesets * chore: Moved CHANGELOG.md to the package * chore: Installed update-workspace-root-version * chore: Added lockfile * chore: Added changeset --------- Co-authored-by: ijlee2 <ijlee2@users.noreply.github.com>
1 parent 3004eb3 commit d358089

File tree

12 files changed

+572
-456
lines changed

12 files changed

+572
-456
lines changed

.changeset/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Changesets
2+
3+
Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
4+
with multi-package repos, or single-package repos to help you version and publish your code. You can
5+
find the full documentation for it [in our repository](https://github.com/changesets/changesets)
6+
7+
We have a quick list of common questions to get you started engaging with this project in
8+
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)

.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/config@2.3.0/schema.json",
3+
"changelog": "./format-changelogs.cjs",
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": []
11+
}

.changeset/format-changelogs.cjs

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
const { getInfo } = require('@changesets/get-github-info');
2+
3+
const repo = 'ijlee2/ember-container-query';
4+
5+
async function analyze(changeset) {
6+
const { links: info } = await getInfo({
7+
commit: changeset.commit,
8+
repo,
9+
});
10+
11+
const contributor = info.user ? `(${info.user})` : undefined;
12+
const link = info.pull ?? info.commit ?? undefined;
13+
const summary = (changeset.summary ?? '').split('\n')[0].trim();
14+
15+
return {
16+
contributor,
17+
link,
18+
summary,
19+
};
20+
}
21+
22+
async function summarize(changeset) {
23+
const { contributor, link, summary } = await analyze(changeset);
24+
25+
const line = [link, summary, contributor].filter(Boolean).join(' ');
26+
27+
return `- ${line}`;
28+
}
29+
30+
async function getDependencyReleaseLine(changesets) {
31+
try {
32+
const lines = await Promise.all(changesets.map(summarize));
33+
34+
return lines.join('\n');
35+
} catch (error) {
36+
console.error(`ERROR: getDependencyReleaseLine (${error.message})`);
37+
38+
return '';
39+
}
40+
}
41+
42+
async function getReleaseLine(changeset) {
43+
try {
44+
return summarize(changeset);
45+
} catch (error) {
46+
console.error(`ERROR: getReleaseLine (${error.message})`);
47+
48+
return '';
49+
}
50+
}
51+
52+
module.exports = {
53+
getDependencyReleaseLine,
54+
getReleaseLine,
55+
};

.changeset/metal-foxes-watch.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"docs-app": major
3+
"test-app": major
4+
---
5+
6+
Made package version independent

CONTRIBUTING.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,21 @@ You can get started in 2 steps:
5454

5555
1. Generate a [personal access token](https://github.com/settings/tokens/) in GitHub, with default values for scopes (none selected).
5656

57-
1. Run the `release:changelog` script. This generates a text that you can add to `CHANGELOG.md`.
57+
1. Run the `release:changelog` script. This removes changesets, updates the package versions, and updates the `CHANGELOG`'s.
5858
5959
```sh
6060
# From the workspace root
61-
GITHUB_AUTH=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
61+
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
62+
```
63+
64+
The `release:changelog` script also updated the workspace root's version (by following the highest version formula). We will use it to name the tag that will be published.
65+
66+
```
67+
# Highest version formula
68+
workspace root version = max(
69+
max(all package versions),
70+
workspace root version + 0.0.1,
71+
);
6272
```
6373

6474
1. [Create a tag](https://github.com/ijlee2/ember-container-query/releases/new) and provide release notes. The tag name should match the package version.

docs-app/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# docs-app

docs-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "docs-app",
3-
"version": "5.0.11",
3+
"version": "0.0.0",
44
"private": true,
5-
"description": "Container queries using Ember modifiers",
5+
"description": "docs-app for ember-container-query",
66
"keywords": [
77
"container-queries",
88
"container-query",

package.json

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,33 +17,25 @@
1717
"lint": "pnpm --filter '*' lint",
1818
"lint:fix": "pnpm --filter '*' lint:fix",
1919
"prepare": "pnpm build:addon",
20-
"release:changelog": "lerna-changelog",
21-
"release:publish": "pnpm --recursive publish",
20+
"release:changelog": "changeset version; update-workspace-root-version",
21+
"release:publish": "pnpm build && changeset publish",
2222
"start": "concurrently 'pnpm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
2323
"start:addon": "pnpm --filter ember-container-query start",
2424
"start:docs-app": "pnpm --filter docs-app start",
2525
"start:test-app": "pnpm --filter test-app start",
2626
"test": "pnpm --filter '*' test"
2727
},
2828
"devDependencies": {
29+
"@changesets/cli": "^2.27.7",
30+
"@changesets/get-github-info": "^0.6.0",
2931
"concurrently": "^8.2.2",
30-
"lerna-changelog": "^2.2.0"
32+
"update-workspace-root-version": "^0.3.0"
3133
},
3234
"packageManager": "pnpm@9.7.0",
3335
"engines": {
3436
"node": "18.* || >= 20",
3537
"pnpm": ">= 9"
3638
},
37-
"changelog": {
38-
"labels": {
39-
"breaking": "Breaking Change",
40-
"bug": "Bug Fix",
41-
"enhance: code": "Enhancement",
42-
"enhance: dependency": "Internal",
43-
"enhance: documentation": "Documentation",
44-
"user feedback": "User Feedback"
45-
}
46-
},
4739
"pnpm": {
4840
"overrides": {
4941
"eslint-plugin-import@2.29.1>tsconfig-paths": "^4.2.0"
File renamed without changes.

0 commit comments

Comments
 (0)