|
| 1 | +# Releasing react-plotly.js |
| 2 | + |
| 3 | +This document covers how to cut a new release of `react-plotly.js` to npm. |
| 4 | +It's evergreen — substitute `X.Y.Z` with the target version (e.g. `3.0.0`) |
| 5 | +and `vX.Y.Z` with the git tag (e.g. `v3.0.0`). |
| 6 | + |
| 7 | +## Prerequisites |
| 8 | + |
| 9 | +- npm publish access to the [`react-plotly.js`](https://www.npmjs.com/package/react-plotly.js) package. Granted by an existing maintainer via the npm `plotly` org. |
| 10 | +- npm two-factor authentication configured (`npm profile get`). Publishes require an OTP. |
| 11 | +- Push access to `plotly/react-plotly.js` on GitHub, including tag-creation permission. |
| 12 | +- A clean local clone of the repo, ideally with `node_modules` reinstalled fresh against `master`. |
| 13 | + |
| 14 | +## Release sequence |
| 15 | + |
| 16 | +### 1. Pre-flight checks |
| 17 | + |
| 18 | +From the branch that will become the release and in a clean state (typically `master`, or an integration branch like `vN` that's about to merge into `master`): |
| 19 | + |
| 20 | +```bash |
| 21 | +npm install # fresh install against the current lockfile |
| 22 | +npm test # lint + typecheck + jest |
| 23 | +npm run build # verifies the tsup build pipeline (ESM + CJS + UMD bundles) |
| 24 | +npm run clean # removes build artifacts (also runs as part of prepublishOnly) |
| 25 | +``` |
| 26 | + |
| 27 | +`npm test` and `npm run build` must succeed. CI on the source branch should also be green. |
| 28 | + |
| 29 | +### 2. Update the changelog |
| 30 | + |
| 31 | +`CHANGELOG.md` follows [Keep a Changelog 1.1.0](https://keepachangelog.com/en/1.1.0/). For each release: |
| 32 | + |
| 33 | +1. Rename the `## [Unreleased]` heading to `## [X.Y.Z] - YYYY-MM-DD` using the actual release date. |
| 34 | +2. Add a fresh empty `## [Unreleased]` heading above it. |
| 35 | + |
| 36 | +Section order within a release: `Added`, `Changed`, `Deprecated`, `Removed`, `Fixed`, `Security` (omit any that have no entries). Use past-tense verbs. Link each entry to the PR that introduced it, and credit external contributors with `, with thanks to @user for the contribution!` at the end of the line. |
| 37 | + |
| 38 | +### 3. Bump the version |
| 39 | + |
| 40 | +```bash |
| 41 | +npm version X.Y.Z --no-git-tag-version |
| 42 | +``` |
| 43 | + |
| 44 | +`--no-git-tag-version` prevents npm from tagging immediately; the tag is created later, after the release PR has merged. |
| 45 | + |
| 46 | +### 4. Open the release PR |
| 47 | + |
| 48 | +Branch the release off the appropriate parent — the integration branch (e.g. `vN`) for a major cumulative release, or `master` for a minor/patch. Branch name convention: `release-X.Y.Z`. |
| 49 | + |
| 50 | +```bash |
| 51 | +git checkout vN # or master, depending on the release type |
| 52 | +git pull |
| 53 | +git checkout -b release-X.Y.Z |
| 54 | +git add * |
| 55 | +git commit -m "chore: release X.Y.Z" |
| 56 | +git push -u origin release-X.Y.Z |
| 57 | +gh pr create --base master --title "chore: release X.Y.Z" \ |
| 58 | + --body "See CHANGELOG.md entry for [$X.Y.Z]." |
| 59 | +``` |
| 60 | + |
| 61 | +When branching from an integration branch, the PR carries all of that branch's commits plus the release-prep commits — reviewers see the full changeset alongside the version bump. |
| 62 | + |
| 63 | +### 5. Merge and tag |
| 64 | + |
| 65 | +Once the PR is reviewed, CI is green, and merged into `master`: |
| 66 | + |
| 67 | +```bash |
| 68 | +git checkout master |
| 69 | +git pull |
| 70 | +git tag vX.Y.Z |
| 71 | +git push origin vX.Y.Z |
| 72 | +``` |
| 73 | + |
| 74 | +The tag must point at the merge commit on `master`. |
| 75 | + |
| 76 | +### 6. Publish to npm |
| 77 | + |
| 78 | +```bash |
| 79 | +npm publish |
| 80 | +``` |
| 81 | + |
| 82 | +This triggers `prepublishOnly`, which runs `npm run build` (tsup, which cleans `dist/` and emits the ESM + CJS + UMD bundles + declaration files) against the current working tree before publishing. npm will prompt for the OTP from your authenticator. |
| 83 | + |
| 84 | +After publish, confirm: |
| 85 | + |
| 86 | +```bash |
| 87 | +npm view react-plotly.js version # should report X.Y.Z |
| 88 | +npm view react-plotly.js dist-tags # `latest` should be X.Y.Z |
| 89 | +``` |
| 90 | + |
| 91 | +### 7. Create the GitHub release |
| 92 | + |
| 93 | +Via the GitHub UI: *Releases → Draft a new release*, target tag `vX.Y.Z`, paste the relevant `CHANGELOG.md` section into the body. |
| 94 | + |
| 95 | +## Pre-release versions |
| 96 | + |
| 97 | +For release candidates or beta builds, append a pre-release identifier and publish under a non-`latest` dist-tag so existing consumers aren't auto-upgraded: |
| 98 | + |
| 99 | +```bash |
| 100 | +npm version X.Y.Z-rc.0 --no-git-tag-version |
| 101 | +# ...PR + merge + tag as above, with tag vX.Y.Z-rc.0... |
| 102 | +npm publish --tag next |
| 103 | +``` |
| 104 | + |
| 105 | +Consumers can opt in with `npm install react-plotly.js@next`. |
0 commit comments