Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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).
14 changes: 14 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.1.3/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": [
"@react-tutorial-overlay/document",
"@react-tutorial-overlay/main"
]
}
46 changes: 46 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Release

on:
push:
branches:
- main
workflow_dispatch:

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
registry-url: https://registry.npmjs.org

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Create release PR or publish to npm
uses: changesets/action@v1
with:
version: pnpm version-packages
publish: pnpm release
title: "[-]: version packages"
commit: "[-]: version packages"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ Mount `<TutorialOverlay />` once near the root of your app, then trigger `tutori
## Documentation

- [Docs](https://react-tutorial-overlay.vercel.app/docs)
- [Release Guide](./docs/releasing.md)

## Releasing

This repo uses Changesets for versioning and changelog generation.

```bash
pnpm changeset
```

Add a changeset in feature PRs when the published package should change. After merge to `main`, the Release workflow opens or updates a version PR. Merging that PR updates `CHANGELOG.md` and publishes the next npm version.

## Contributing

Expand Down
73 changes: 73 additions & 0 deletions docs/releasing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Releasing

This repository now uses [Changesets](https://github.com/changesets/changesets) for versioning, changelog generation, and npm publishing.

## One-time setup

The GitHub release workflow expects an `NPM_TOKEN` repository secret with publish access to the `react-tutorial-overlay` npm package.

## Everyday workflow

1. Make your code change on a feature branch.
2. Add a changeset before opening or updating the PR.
3. Merge the PR into `main`.
4. Let the Release workflow open or update the version PR.
5. Merge the version PR to publish the new npm version and update `CHANGELOG.md`.

## Adding a changeset

Run:

```bash
pnpm changeset
```

When prompted:

- Select `react-tutorial-overlay`
- Pick the appropriate bump type (`patch`, `minor`, or `major`)
- Write a short, user-facing summary

This creates a markdown file in `.changeset/`. Commit that file with the feature change.

## Useful commands

Create a changeset:

```bash
pnpm changeset
```

Preview versioning locally:

```bash
pnpm version-packages
```

Run the full release verification locally:

```bash
pnpm release:verify
```

Publish locally if you really need to:

```bash
pnpm release
```

The normal path should be the GitHub Release workflow instead of local publishing.

## What the release workflow does

On pushes to `main` or manual dispatch, `.github/workflows/release.yml` runs `changesets/action`.

- If unreleased changesets exist, it opens or updates a release PR.
- If the release PR has already been merged and version files are on `main`, it runs `pnpm release`.
- `pnpm release` verifies tests, docs lint/build, size limits, and then runs `changeset publish`.

## Notes for this repo

- Only the root `react-tutorial-overlay` package is versioned and published.
- `packages/document` and `packages/main` are ignored by Changesets.
- `CHANGELOG.md` is updated by `changeset version` through the release PR flow.
13 changes: 10 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
"main": "pnpm -F @react-tutorial-overlay/main",
"document": "pnpm -F @react-tutorial-overlay/document",
"dev": "pnpm -r dev",
"changeset": "changeset",
"version-packages": "changeset version",
"release:verify": "pnpm -C packages/main test && pnpm -C packages/document lint && pnpm -C packages/document build && pnpm size",
"size": "pnpm main build && size-limit",
"build": "pnpm size",
"docs": "pnpm document build"
"docs": "pnpm document build",
"release": "pnpm release:verify && changeset publish"
},
"keywords": [
"react",
Expand All @@ -22,6 +26,9 @@
"files": [
"dist"
],
"publishConfig": {
"access": "public"
},
"size-limit": [
{
"path": "dist/index.js",
Expand All @@ -38,8 +45,8 @@
"react-dom": "^18.2.0"
},
"devDependencies": {
"@changesets/cli": "^2.30.0",
"@size-limit/preset-small-lib": "^7.0.8",
"size-limit": "^7.0.8",
"standard-version": "^9.5.0"
"size-limit": "^7.0.8"
}
}
1 change: 1 addition & 0 deletions packages/main/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "@react-tutorial-overlay/main",
"private": true,
"scripts": {
"dev": "tsup --watch",
"build": "tsup",
Expand Down
Loading
Loading