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
73 changes: 73 additions & 0 deletions .github/workflows/create-react-server.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: create-react-server 🧪

env:
NODE_OPTIONS: --max-old-space-size=6144

permissions: {}

on:
pull_request:
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.number || github.sha }}
cancel-in-progress: true

jobs:
changed:
name: Get changed files 📂
runs-on: ubuntu-latest
outputs:
all_changed_files: ${{ steps.changed-files.outputs.all_changed_files }}

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

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v45
with:
files: |
packages/create-react-server/**
packages/react-server/**
.github/workflows/create-react-server.yml

test-create:
needs: changed
if: contains(needs.changed.outputs.all_changed_files, 'packages/create-react-server') || contains(needs.changed.outputs.all_changed_files, 'packages/react-server') || contains(needs.changed.outputs.all_changed_files, '.github/workflows/create-react-server.yml')
timeout-minutes: 60
runs-on: ubuntu-latest
strategy:
matrix:
include:
- runtime: node
pkg_mgr: npm
- runtime: node
pkg_mgr: pnpm
- runtime: bun
pkg_mgr: npm
- runtime: bun
pkg_mgr: pnpm
- runtime: bun
pkg_mgr: bun
- runtime: deno
pkg_mgr: npm
- runtime: deno
pkg_mgr: pnpm
fail-fast: false

name: "Test create ${{ matrix.runtime }}/${{ matrix.pkg_mgr }} 🧪"
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: ./.github/workflows/actions/common-setup
with:
node_version: 20

- name: Test create-react-server (${{ matrix.runtime }}/${{ matrix.pkg_mgr }})
working-directory: ./packages/create-react-server/test
run: PKG_MGR=${{ matrix.pkg_mgr }} pnpm test:${{ matrix.runtime }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ deno.lock
*.sqlite
*.log
.eslintcache
.npm-cache
2 changes: 2 additions & 0 deletions docs/src/pages/en/(pages)/deploy/adapters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ You can use adapters to configure your app for different deployment environments

Add `adapter` entry to your `react-server.config.mjs` file. You can specify the name of a built-in adapter (`vercel`, `netlify`, `cloudflare`, `bun`, or `deno`) as a string, or use an external adapter package.

> **Note:** When running a production build with **Bun** or **Deno**, the corresponding adapter is automatically detected and used without any configuration. You can override this with an explicit `adapter` setting in your config or via `--adapter <name>` on the CLI. Use `--no-adapter` to disable auto-detection.

```mjs
export default {
adapter: 'vercel',
Expand Down
12 changes: 9 additions & 3 deletions docs/src/pages/en/(pages)/deploy/bun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ curl -fsSL https://bun.sh/install | bash

No additional packages are needed - the adapter is built into `@lazarv/react-server`.

Then add the adapter to your `react-server.config.mjs` file:
When you run a production build with Bun, the `bun` adapter is **automatically detected and used** — no configuration is needed. If you want to be explicit or need to pass options, you can add the adapter to your `react-server.config.mjs` file:

```mjs
export default {
Expand Down Expand Up @@ -102,10 +102,16 @@ This produces a `.bun/` directory with the following structure:
## Deploy
</Link>

Start the production server directly:
Start the production server using the CLI:

```sh
bun .bun/start.mjs
bun --bun react-server start
```

Or run it directly without the framework installed:

```sh
bun --bun .bun/start.mjs
```

Or use the `--deploy` flag to build and immediately start:
Expand Down
12 changes: 9 additions & 3 deletions docs/src/pages/en/(pages)/deploy/deno.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ curl -fsSL https://deno.land/install.sh | sh

No additional packages are needed - the adapter is built into `@lazarv/react-server`.

Then add the adapter to your `react-server.config.mjs` file:
When you run a production build with Deno, the `deno` adapter is **automatically detected and used** — no configuration is needed. If you want to be explicit or need to pass options, you can add the adapter to your `react-server.config.mjs` file:

```mjs
export default {
Expand Down Expand Up @@ -102,10 +102,16 @@ This produces a `.deno/` directory with the following structure:
## Deploy
</Link>

Start the production server directly:
Start the production server using the CLI:

```sh
deno run --allow-net --allow-read --allow-env --allow-sys .deno/start.mjs
deno run -A npm:@lazarv/react-server start
```

Or run it directly without the framework installed:

```sh
deno run --config .deno/deno.json --allow-net --allow-read --allow-env --allow-sys .deno/start.mjs
```

Or use the `--deploy` flag to build and immediately start:
Expand Down
34 changes: 18 additions & 16 deletions docs/src/pages/en/(pages)/guide/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ or when using Bun as your JavaScript runtime, you don't need anything else, just

- [Bun](https://bun.sh) v1.2.9 or higher

> **Note:** Deno is not supported yet. Please check back later for updates.
or when using Deno as your JavaScript runtime:

- [Deno](https://deno.com) v2.0 or higher

<Link name="install">
## Install
Expand Down Expand Up @@ -62,9 +64,9 @@ bun add @lazarv/react-server
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/react-server
```
</Tab>

</Tabs>
Expand Down Expand Up @@ -114,9 +116,9 @@ bun --bun react-server ./App.jsx
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/react-server ./App.jsx
```
</Tab>

</Tabs>
Expand All @@ -127,7 +129,7 @@ bun --bun react-server ./App.jsx
## Build
</Link>

After you have developed your application, you can build it for production. This will create a `.react-server` folder with all files needed to run your application in production mode.
After you have developed your application, you can build it for production. This will create a `.react-server` folder with all files needed to run your application in production mode. When using Bun or Deno, the corresponding adapter is automatically detected and used, producing a self-contained bundle in `.bun/` or `.deno/`. You can override the auto-detected adapter with `--adapter <name>` or disable it with `--no-adapter`.

<Tabs name="build">

Expand Down Expand Up @@ -156,9 +158,9 @@ bun --bun react-server build ./App.jsx
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/react-server build ./App.jsx
```
</Tab>

</Tabs>
Expand All @@ -167,7 +169,7 @@ bun --bun react-server build ./App.jsx
## Production mode
</Link>

To start your application in production, just use the `start` command. This will start your application in production mode.
To start your application in production, just use the `start` command. This will start your application in production mode. When using Bun or Deno, the start command runs the adapter's generated entry point directly.

<Tabs name="production-mode">

Expand Down Expand Up @@ -196,14 +198,14 @@ bun --bun react-server start
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/react-server start
```
</Tab>

</Tabs>

> **Note:** if you don't want to install the `@lazarv/react-server` package and you just want to try out something quickly, you can use `npx` to run the `react-server` CLI. This way, it's not required to install anything else if you use JavaScript. It's enough to have a `.jsx` file with a React Server Component exported as default to run your application. Just run `npx @lazarv/react-server ./App.jsx` to start your application in development mode. When using Bun, you can use `bunx --bun @lazarv/react-server` to run the `react-server` CLI.
> **Note:** if you don't want to install the `@lazarv/react-server` package and you just want to try out something quickly, you can use `npx` to run the `react-server` CLI. This way, it's not required to install anything else if you use JavaScript. It's enough to have a `.jsx` file with a React Server Component exported as default to run your application. Just run `npx @lazarv/react-server ./App.jsx` to start your application in development mode. When using Bun, you can use `bunx --bun @lazarv/react-server` to run the `react-server` CLI. When using Deno, you can use `deno run -A npm:@lazarv/react-server ./App.jsx` to start a development server.

<Link name="next-steps">
## Next steps
Expand Down
12 changes: 6 additions & 6 deletions docs/src/pages/en/(pages)/guide/quick-start.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ bunx --bun @lazarv/react-server ./App.jsx
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/react-server ./App.jsx
```
</Tab>

</Tabs>
Expand Down Expand Up @@ -83,9 +83,9 @@ bunx --bun @lazarv/create-react-server
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Deno is not supported yet. Please check back later for updates.

```sh
deno run -A npm:@lazarv/create-react-server
```
</Tab>

</Tabs>
Expand Down
2 changes: 2 additions & 0 deletions docs/src/pages/ja/(pages)/deploy/adapters.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ import Link from "../../../../components/Link.jsx";

`react-server.config.mjs`ファイルに `adapter` エントリを追加します。ビルトインアダプタの名前(`vercel`、`netlify`、`cloudflare`、`bun`、または `deno`)を文字列で指定するか、外部アダプタパッケージを使用できます。

> **Note:** **Bun** または **Deno** でプロダクションビルドを実行すると、対応するアダプタが自動的に検出・使用されます。設定は不要です。明示的な `adapter` 設定またはCLIの `--adapter <name>` で上書きできます。自動検出を無効にするには `--no-adapter` を使用してください。

```mjs
export default {
adapter: 'vercel',
Expand Down
12 changes: 9 additions & 3 deletions docs/src/pages/ja/(pages)/deploy/bun.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ curl -fsSL https://bun.sh/install | bash

追加のパッケージは不要です — アダプタは `@lazarv/react-server` に組み込まれています。

次に、`react-server.config.mjs` ファイルにアダプタを追加します:
Bun でプロダクションビルドを実行すると、`bun` アダプタが**自動的に検出・使用されます** — 設定は不要です。明示的に指定したい場合やオプションを渡したい場合は、`react-server.config.mjs` ファイルにアダプタを追加します:

```mjs
export default {
Expand Down Expand Up @@ -102,10 +102,16 @@ pnpm react-server build [root]
## デプロイ
</Link>

本番サーバを直接起動します
CLIを使用して本番サーバを起動します

```sh
bun .bun/start.mjs
bun --bun react-server start
```

フレームワークなしで直接起動することもできます:

```sh
bun --bun .bun/start.mjs
```

または `--deploy` フラグを使用してビルドと即時起動を行います:
Expand Down
2 changes: 1 addition & 1 deletion docs/src/pages/ja/(pages)/deploy/deno.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ curl -fsSL https://deno.land/install.sh | sh

追加のパッケージは不要です — アダプタは `@lazarv/react-server` に組み込まれています。

次に、`react-server.config.mjs` ファイルにアダプタを追加します:
Deno でプロダクションビルドを実行すると、`deno` アダプタが**自動的に検出・使用されます** — 設定は不要です。明示的に指定したい場合やオプションを渡したい場合は、`react-server.config.mjs` ファイルにアダプタを追加します:

```mjs
export default {
Expand Down
34 changes: 18 additions & 16 deletions docs/src/pages/ja/(pages)/guide/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ JavaScriptランタイムとしてBunを使用する場合は、他に何も必

- [Bun](https://bun.sh) v1.2.9 以降

> **Note:** Denoはまだサポートされていません。後日アップデートを確認してください。
JavaScriptランタイムとしてDenoを使用する場合:

- [Deno](https://deno.com) v2.0 以降

<Link name="install">
## インストール
Expand Down Expand Up @@ -62,9 +64,9 @@ bun add @lazarv/react-server
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Denoはまだサポートされていません。後日アップデートを確認してください。

```sh
deno run -A npm:@lazarv/react-server
```
</Tab>

</Tabs>
Expand Down Expand Up @@ -114,9 +116,9 @@ bun --bun react-server ./App.jsx
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Denoはまだサポートされていません。後日アップデートを確認してください。

```sh
deno run -A npm:@lazarv/react-server ./App.jsx
```
</Tab>

</Tabs>
Expand All @@ -127,7 +129,7 @@ bun --bun react-server ./App.jsx
## プロダクションビルド
</Link>

アプリケーションの開発が終われば、プロダクションモードでビルドすることも出来ます。プロダクションビルドをすると `.react-server` ディレクトリの中にプロダクションモードでの実行に必要なファイルを作成します。
アプリケーションの開発が終われば、プロダクションモードでビルドすることも出来ます。プロダクションビルドをすると `.react-server` ディレクトリの中にプロダクションモードでの実行に必要なファイルを作成します。BunまたはDenoを使用する場合、対応するアダプタが自動的に検出・使用され、`.bun/` または `.deno/` に自己完結型のエッジバンドルを生成します。`--adapter <name>` で自動検出を上書きするか、`--no-adapter` で無効にできます。

<Tabs name="build">

Expand Down Expand Up @@ -156,9 +158,9 @@ bun --bun react-server build ./App.jsx
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Denoはまだサポートされていません。後日アップデートを確認してください。

```sh
deno run -A npm:@lazarv/react-server build ./App.jsx
```
</Tab>

</Tabs>
Expand All @@ -167,7 +169,7 @@ bun --bun react-server build ./App.jsx
## プロダクションモード
</Link>

プロダクションモードでアプリケーションを実行するには`start`コマンドを実行してください。
プロダクションモードでアプリケーションを実行するには`start`コマンドを実行してください。BunまたはDenoを使用する場合、startコマンドはアダプタが生成したエントリーポイントを直接実行します。

<Tabs name="production-mode">

Expand Down Expand Up @@ -196,14 +198,14 @@ bun --bun react-server start
</Tab>

<Tab title={<><Deno className="w-4 max-h-4" />Deno</>}>

> **Note:** Denoはまだサポートされていません。後日アップデートを確認してください。

```sh
deno run -A npm:@lazarv/react-server start
```
</Tab>

</Tabs>

> **Note:** `@lazarv/react-server`をインストールせず高速にアプリを実行したい場合、`npx`を使って`react-server` CLIを実行することができます。JavaScriptを使用する場合、このようにすれば他のものをインストールする必要はありません。アプリの実行にはReact Server Componentをエクスポートした`.jsx`ファイルがあれば十分です。`npx @lazarv/react-server ./App.jsx` を実行すればディベロップメントモードでアプリケーションを立ち上げることが出来ます。Bunを使っている場合、`bunx --bun @lazarv/react-server`を実行すれば`react-server`CLIを実行することが出来ます。
> **Note:** `@lazarv/react-server`をインストールせず高速にアプリを実行したい場合、`npx`を使って`react-server` CLIを実行することができます。JavaScriptを使用する場合、このようにすれば他のものをインストールする必要はありません。アプリの実行にはReact Server Componentをエクスポートした`.jsx`ファイルがあれば十分です。`npx @lazarv/react-server ./App.jsx` を実行すればディベロップメントモードでアプリケーションを立ち上げることが出来ます。Bunを使っている場合、`bunx --bun @lazarv/react-server`を実行すれば`react-server`CLIを実行することが出来ます。Denoを使っている場合、`deno run -A npm:@lazarv/react-server ./App.jsx`を実行すればディベロップメントサーバーを起動できます。

<Link name="next-steps">
## 次のステップ
Expand Down
Loading