Skip to content

Commit f6f5aac

Browse files
authored
Merge pull request #38 from Mermaid-Chart/PLUG-24-setup-changesets
Setup changesets for automated releases
2 parents 4a0c04c + 9f5f4d5 commit f6f5aac

7 files changed

Lines changed: 544 additions & 23 deletions

File tree

.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@3.0.0/schema.json",
3+
"changelog": ["@changesets/changelog-github", { "repo": "Mermaid-Chart/plugins" }],
4+
"commit": false,
5+
"fixed": [],
6+
"linked": [],
7+
"access": "public",
8+
"baseBranch": "main",
9+
"updateInternalDependencies": "patch",
10+
"ignore": ["mermaid-chart-office-addin", "mermaidchart-google"]
11+
}

.github/workflows/release.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
release:
15+
if: github.repository == 'Mermaid-Chart/plugins'
16+
permissions:
17+
contents: write # to create release (changesets/action)
18+
id-token: write # Required for npm trusted publishing (OIDC)
19+
pull-requests: write # to create pull request (changesets/action)
20+
name: Release
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Repo
24+
uses: actions/checkout@v4
25+
26+
- uses: pnpm/action-setup@v2
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
cache: pnpm
32+
node-version: "24"
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- name: Install Packages
36+
run: pnpm install --frozen-lockfile
37+
38+
- name: Create Release Pull Request or Publish to npm
39+
id: changesets
40+
uses: changesets/action@v1
41+
with:
42+
version: pnpm changeset:version
43+
publish: pnpm changeset:publish
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46+
NPM_CONFIG_PROVENANCE: true

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,19 @@
22

33
This repository contains the source code for the Mermaid Chart plugins.
44

5+
## Releasing
6+
7+
This repo uses [Changesets](https://github.com/changesets/changesets) for versioning and publishing packages to npm.
8+
9+
When you make changes that should be released:
10+
11+
1. Run `pnpm changeset`
12+
2. Select the affected package(s) and version bump (patch/minor/major)
13+
3. Add a summary of the change
14+
4. Commit the changeset file along with your code changes
15+
16+
After your PR is merged to `main`, the release workflow will create a "Version Packages" PR. Merging that PR will publish the updated package(s) to npm.
17+
518
## API Documentation
619

720
The OpenAPI YAML file is located at [./openapi.yaml](./openapi.yaml).

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,19 @@
44
"private": "true",
55
"description": "",
66
"scripts": {
7-
"test": "echo \"Error: no test specified\" && exit 1"
7+
"test": "echo \"Error: no test specified\" && exit 1",
8+
"changeset": "changeset",
9+
"changeset:version": "changeset version && pnpm install && git add --all",
10+
"changeset:publish": "changeset publish"
811
},
912
"keywords": [],
1013
"contributors": [
1114
"Sidharth Vinod (https://sidharth.dev)"
1215
],
1316
"license": "MIT",
1417
"devDependencies": {
18+
"@changesets/changelog-github": "^0.5.2",
19+
"@changesets/cli": "^2.29.8",
1520
"@cspell/eslint-plugin": "^7.3.2",
1621
"esbuild": "^0.19.2",
1722
"eslint": "^8.48.0",

packages/sdk/src/errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ export class OAuthError extends Error {
1515
* This corresponds to HTTP 402 status code from the repair API.
1616
*/
1717
export class AICreditsLimitExceededError extends Error {
18-
constructor(message: string = 'AI credits limit exceeded') {
18+
constructor(message = 'AI credits limit exceeded') {
1919
super(message);
2020
this.name = 'AICreditsLimitExceededError';
2121
}

0 commit comments

Comments
 (0)