diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e623306..5a8d2ef 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,6 +6,7 @@ on: permissions: contents: read packages: write + id-token: write jobs: publish: @@ -38,3 +39,12 @@ jobs: run: npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Prepare Node.js environment for npm registry + uses: actions/setup-node@v6 + with: + node-version-file: .node-version + registry-url: https://registry.npmjs.org/ + + - name: Publish package to npm registry + run: npm publish --access public --provenance diff --git a/CHANGELOG.md b/CHANGELOG.md index b4e9c77..c153bc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,7 +22,3 @@ This file documents all notable changes, following the [Keep a Changelog](https: ### Features * Port React Compiler tracker from todoist-web ([#6](https://github.com/Doist/react-compiler-tracker/issues/6)) ([8e8ec3b](https://github.com/Doist/react-compiler-tracker/commit/8e8ec3be05a9738aca7215d98f9d2e83ef59378c)) - -## [Unreleased] - -- diff --git a/README.md b/README.md index a10cc22..1b4eb72 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,12 @@ # React Compiler Tracker -While it's safe to opt out of using memoization hooks such as `useCallback` and `useMemo` in code optimized by the [React Compiler](https://react.dev/learn/react-compiler), it is easy to introduce violations that cause the compiler to bail out, leading to performance issues when values are not memoized. +[![npm version](https://img.shields.io/npm/v/@doist/react-compiler-tracker)](https://www.npmjs.com/package/@doist/react-compiler-tracker) +[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) +[![Node.js](https://img.shields.io/node/v/@doist/react-compiler-tracker)](https://nodejs.org/) -Designed to run as a part of Git hooks and CI, this tool helps prevent this and progressively adopt the React Compiler by tracking and warning against newly introduced compilation errors. It maintains a `.react-compiler-tracker.json` record file to track known compiler errors per file. +The [React Compiler](https://react.dev/learn/react-compiler) automatically memoizes your components, eliminating the need for `useCallback` and `useMemo`. However, certain code patterns cause the compiler to bail out. When this happens, your components lose automatic optimization, potentially causing performance regressions. + +Inspired by [esplint](https://github.com/hjylewis/esplint) and [react-compiler-marker](https://github.com/blazejkustra/react-compiler-marker), this tool tracks compiler errors in a `.react-compiler-tracker.json` file and integrates with Git hooks and CI to prevent new violations from being introduced. ## Prerequisites diff --git a/package.json b/package.json index 874699d..b5c0ce6 100644 --- a/package.json +++ b/package.json @@ -35,12 +35,13 @@ }, "homepage": "https://github.com/Doist/react-compiler-tracker#readme", "engines": { - "node": ">=22" + "node": "^22.22.0 || >=24.13.0" }, "files": [ "dist", "README.md", - "LICENSE" + "LICENSE", + "CHANGELOG.md" ], "lint-staged": { "*.{js,ts,mjs,mts,json,md}": "biome check --write --no-errors-on-unmatched"