Skip to content

Commit

Permalink
Replaced lerna-changelog with changesets. Installed update-workspace-…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
  • Loading branch information
ijlee2 and ijlee2 authored Aug 29, 2024
1 parent 3004eb3 commit d358089
Show file tree
Hide file tree
Showing 12 changed files with 572 additions and 456 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": "./format-changelogs.cjs",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
55 changes: 55 additions & 0 deletions .changeset/format-changelogs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
const { getInfo } = require('@changesets/get-github-info');

const repo = 'ijlee2/ember-container-query';

async function analyze(changeset) {
const { links: info } = await getInfo({
commit: changeset.commit,
repo,
});

const contributor = info.user ? `(${info.user})` : undefined;
const link = info.pull ?? info.commit ?? undefined;
const summary = (changeset.summary ?? '').split('\n')[0].trim();

return {
contributor,
link,
summary,
};
}

async function summarize(changeset) {
const { contributor, link, summary } = await analyze(changeset);

const line = [link, summary, contributor].filter(Boolean).join(' ');

return `- ${line}`;
}

async function getDependencyReleaseLine(changesets) {
try {
const lines = await Promise.all(changesets.map(summarize));

return lines.join('\n');
} catch (error) {
console.error(`ERROR: getDependencyReleaseLine (${error.message})`);

return '';
}
}

async function getReleaseLine(changeset) {
try {
return summarize(changeset);
} catch (error) {
console.error(`ERROR: getReleaseLine (${error.message})`);

return '';
}
}

module.exports = {
getDependencyReleaseLine,
getReleaseLine,
};
6 changes: 6 additions & 0 deletions .changeset/metal-foxes-watch.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"docs-app": major
"test-app": major
---

Made package version independent
14 changes: 12 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,21 @@ You can get started in 2 steps:

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

1. Run the `release:changelog` script. This generates a text that you can add to `CHANGELOG.md`.
1. Run the `release:changelog` script. This removes changesets, updates the package versions, and updates the `CHANGELOG`'s.
```sh
# From the workspace root
GITHUB_AUTH=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
GITHUB_TOKEN=<YOUR_PERSONAL_ACCESS_TOKEN> pnpm release:changelog
```
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.

```
# Highest version formula
workspace root version = max(
max(all package versions),
workspace root version + 0.0.1,
);
```

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.
Expand Down
1 change: 1 addition & 0 deletions docs-app/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# docs-app
4 changes: 2 additions & 2 deletions docs-app/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "docs-app",
"version": "5.0.11",
"version": "0.0.0",
"private": true,
"description": "Container queries using Ember modifiers",
"description": "docs-app for ember-container-query",
"keywords": [
"container-queries",
"container-query",
Expand Down
18 changes: 5 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,33 +17,25 @@
"lint": "pnpm --filter '*' lint",
"lint:fix": "pnpm --filter '*' lint:fix",
"prepare": "pnpm build:addon",
"release:changelog": "lerna-changelog",
"release:publish": "pnpm --recursive publish",
"release:changelog": "changeset version; update-workspace-root-version",
"release:publish": "pnpm build && changeset publish",
"start": "concurrently 'pnpm:start:*' --restart-after 5000 --prefix-colors cyan,white,yellow",
"start:addon": "pnpm --filter ember-container-query start",
"start:docs-app": "pnpm --filter docs-app start",
"start:test-app": "pnpm --filter test-app start",
"test": "pnpm --filter '*' test"
},
"devDependencies": {
"@changesets/cli": "^2.27.7",
"@changesets/get-github-info": "^0.6.0",
"concurrently": "^8.2.2",
"lerna-changelog": "^2.2.0"
"update-workspace-root-version": "^0.3.0"
},
"packageManager": "[email protected]",
"engines": {
"node": "18.* || >= 20",
"pnpm": ">= 9"
},
"changelog": {
"labels": {
"breaking": "Breaking Change",
"bug": "Bug Fix",
"enhance: code": "Enhancement",
"enhance: dependency": "Internal",
"enhance: documentation": "Documentation",
"user feedback": "User Feedback"
}
},
"pnpm": {
"overrides": {
"[email protected]>tsconfig-paths": "^4.2.0"
Expand Down
File renamed without changes.
Loading

0 comments on commit d358089

Please sign in to comment.