Skip to content

Commit d8edb0b

Browse files
committed
chore: setup changesets
(fingers crossed this actually works)
1 parent ce7f10b commit d8edb0b

File tree

4 files changed

+78
-3
lines changed

4 files changed

+78
-3
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: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@svitejs/changesets-changelog-github-compact",
5+
{ "repo": "sveltejs/acorn-typescript" }
6+
],
7+
"commit": false,
8+
"fixed": [],
9+
"linked": [],
10+
"access": "public",
11+
"baseBranch": "main",
12+
"updateInternalDependencies": "patch",
13+
"ignore": []
14+
}

.github/workflows/release.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions: {}
9+
jobs:
10+
release:
11+
# prevents this action from running on forks
12+
if: github.repository == 'sveltejs/acorn-typescript'
13+
permissions:
14+
contents: write # to create release (changesets/action)
15+
id-token: write # OpenID Connect token needed for provenance
16+
pull-requests: write # to create pull request (changesets/action)
17+
name: Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout Repo
21+
uses: actions/checkout@v4
22+
with:
23+
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
24+
fetch-depth: 0
25+
- uses: pnpm/[email protected]
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: 22.x
30+
cache: pnpm
31+
32+
- run: pnpm install --frozen-lockfile
33+
34+
- name: Create Release Pull Request or Publish to npm
35+
id: changesets
36+
uses: changesets/action@v1
37+
with:
38+
# This expects you to have a script called release which does a build for your packages and calls changeset publish
39+
publish: pnpm changeset:release
40+
version: pnpm changeset:version
41+
env:
42+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
NPM_CONFIG_PROVENANCE: true
44+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
45+
46+
# TODO alert discord
47+
# - name: Send a Slack notification if a publish happens
48+
# if: steps.changesets.outputs.published == 'true'
49+
# # You can do something when a publish happens.
50+
# run: my-slack-bot send-notification --message "A new version of ${GITHUB_REPOSITORY} was published!"

package.json

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "acorn-typescript",
3-
"version": "1.4.13",
2+
"name": "@sveltejs/acorn-typescript",
3+
"version": "1.0.0",
44
"description": "Acorn plugin that parses TypeScript",
55
"type": "module",
66
"types": "index.d.ts",
@@ -12,7 +12,9 @@
1212
"build": "esbuild src/index.ts --bundle --format=esm --outfile=index.js --platform=node --external:acorn",
1313
"format": "prettier --write .",
1414
"test": "vitest run",
15-
"test:test262": "npm run build && node ./__test__/run_test262.js"
15+
"test:test262": "npm run build && node ./__test__/run_test262.js",
16+
"changeset:version": "changeset version && git add --all",
17+
"changeset:release": "changeset publish"
1618
},
1719
"exports": {
1820
".": {
@@ -31,6 +33,7 @@
3133
},
3234
"homepage": "https://github.com/sveltejs/acorn-typescript#readme",
3335
"devDependencies": {
36+
"@changesets/cli": "^2.27.11",
3437
"acorn": "~8.9.0",
3538
"acorn-jsx": "~5.3.2",
3639
"esbuild": "^0.25.0",

0 commit comments

Comments
 (0)