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
40 changes: 40 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Publish Package

on:
release:
types: [published]

jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write // Useful if using provenance

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install pnpm
uses: pnpm/action-setup@v3
with:
version: 9

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'

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

- name: Build Package
# Run build for the specific package. This ensures the README move script runs.
run: pnpm --filter vite-plugin-react-compiler-report build

- name: Publish to npm
working-directory: packages/vite-plugin-react-compiler-report
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
v18
196 changes: 74 additions & 122 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,135 +1,87 @@
# Turborepo starter
# vite-plugin-react-compiler-report

This Turborepo starter is maintained by the Turborepo core team.
A Vite plugin that generates detailed reports for the React Compiler. It provides terminal logging during development and builds, and optionally generates a visual HTML report.

## Using this example
## Features

Run the following command:
- **Dev Mode Logging**: Real-time feedback in the terminal about compiled components and failures.
- **Build Report**: Summary of optimization success rates at the end of the build.
- **HTML Report**: A premium, dark-mode UI to explore compilation details and errors (optional).
- **Zero Config**: Works out of the box with sensible defaults.

```sh
npx create-turbo@latest
```

## What's inside?

This Turborepo includes the following packages/apps:

### Apps and Packages

- `docs`: a [Next.js](https://nextjs.org/) app
- `web`: another [Next.js](https://nextjs.org/) app
- `@repo/ui`: a stub React component library shared by both `web` and `docs` applications
- `@repo/eslint-config`: `eslint` configurations (includes `eslint-config-next` and `eslint-config-prettier`)
- `@repo/typescript-config`: `tsconfig.json`s used throughout the monorepo

Each package/app is 100% [TypeScript](https://www.typescriptlang.org/).

### Utilities

This Turborepo has some additional tools already setup for you:

- [TypeScript](https://www.typescriptlang.org/) for static type checking
- [ESLint](https://eslint.org/) for code linting
- [Prettier](https://prettier.io) for code formatting

### Build

To build all apps and packages, run the following command:

```
cd my-turborepo

# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo build

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo build
yarn dlx turbo build
pnpm exec turbo build
```

You can build a specific package by using a [filter](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters):

```
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo build --filter=docs

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo build --filter=docs
yarn exec turbo build --filter=docs
pnpm exec turbo build --filter=docs
```
## Installation

### Develop

To develop all apps and packages, run the following command:

```
cd my-turborepo

# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo dev

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo dev
yarn exec turbo dev
pnpm exec turbo dev
```bash
npm install -D vite-plugin-react-compiler-report
# or
pnpm add -D vite-plugin-react-compiler-report
```

You can develop a specific package by using a [filter](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters):

```
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo dev --filter=web

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo dev --filter=web
yarn exec turbo dev --filter=web
pnpm exec turbo dev --filter=web
```

### Remote Caching

> [!TIP]
> Vercel Remote Cache is free for all plans. Get started today at [vercel.com](https://vercel.com/signup?/signup?utm_source=remote-cache-sdk&utm_campaign=free_remote_cache).

Turborepo can use a technique known as [Remote Caching](https://turborepo.com/docs/core-concepts/remote-caching) to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.

By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can [create one](https://vercel.com/signup?utm_source=turborepo-examples), then enter the following commands:

```
cd my-turborepo

# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo login

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo login
yarn exec turbo login
pnpm exec turbo login
```

This will authenticate the Turborepo CLI with your [Vercel account](https://vercel.com/docs/concepts/personal-accounts/overview).

Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your Turborepo:

## Usage

1. Configure the React Compiler in your Vite config (using `babel` options).
2. Add the `reactCompilerLogger` passed to the compiler options.
3. Add `reactCompilerReport` to your plugins list.

```ts
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import {
reactCompilerLogger,
reactCompilerReport
} from "vite-plugin-react-compiler-report";

const ReactCompilerConfig = {
target: "19",
logger: {
logEvent: reactCompilerLogger,
},
};

export default defineConfig({
plugins: [
react({
babel: {
plugins: [["babel-plugin-react-compiler", ReactCompilerConfig]],
},
}),
reactCompilerReport({
// Options
ui: true, // Generate the HTML report
}),
],
});
```
# With [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation) installed (recommended)
turbo link

# Without [global `turbo`](https://turborepo.com/docs/getting-started/installation#global-installation), use your package manager
npx turbo link
yarn exec turbo link
pnpm exec turbo link
## Configuration

You can customize the plugin by passing an options object:

```ts
reactCompilerReport({
// Directory where reports will be generated
// Default: ".react-compiler/report"
outputDir: ".react-compiler/report",

// Enable the HTML visual report
// Default: false
ui: true,

build: {
// Filename for the raw JSON report
// Default: "react-compiler-report.json"
fileName: "react-compiler-report.json"
}
})
```

## Useful Links
## HTML Report

Learn more about the power of Turborepo:
If `ui: true` is enabled, a static HTML report will be generated in `outputDir/ui/index.html`.
The path to this file will be printed in the terminal at the end of the build.

- [Tasks](https://turborepo.com/docs/crafting-your-repository/running-tasks)
- [Caching](https://turborepo.com/docs/crafting-your-repository/caching)
- [Remote Caching](https://turborepo.com/docs/core-concepts/remote-caching)
- [Filtering](https://turborepo.com/docs/crafting-your-repository/running-tasks#using-filters)
- [Configuration Options](https://turborepo.com/docs/reference/configuration)
- [CLI Usage](https://turborepo.com/docs/reference/command-line-reference)
You can open this file in any browser to inspect:
- Total optimized components
- Compilation failures
- Detailed error messages and code locations
36 changes: 0 additions & 36 deletions apps/docs/.gitignore

This file was deleted.

36 changes: 0 additions & 36 deletions apps/docs/README.md

This file was deleted.

Binary file removed apps/docs/app/favicon.ico
Binary file not shown.
Binary file removed apps/docs/app/fonts/GeistMonoVF.woff
Binary file not shown.
Binary file removed apps/docs/app/fonts/GeistVF.woff
Binary file not shown.
50 changes: 0 additions & 50 deletions apps/docs/app/globals.css

This file was deleted.

Loading