Skip to content

Commit

Permalink
add doc for package scripts (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
rphlmr authored Nov 28, 2024
1 parent 5b7ef53 commit bba9ec9
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
36 changes: 34 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ Use the `serverEntryPoint` option of the Vite plugin `reactRouterHonoServer` to
### Update your package.json scripts
### Node
It is not an error, you can keep the React Router defaults for `build` and `dev`!
```json
"scripts": {
Expand All @@ -218,6 +219,37 @@ It is not an error, you can keep the React Router defaults for `build` and `dev`
"start": "node ./build/server/index.js",
},
```
### Bun
It is not an error, you can keep the React Router defaults for `build`!
```json
"scripts": {
"build": "react-router build",
"dev": "bunx --bun vite",
"start": "bun ./build/server/index.js",
},
```
### Cloudflare
It is not an error, you can keep the React Router defaults for `build` and `dev`!
```json
"scripts": {
"build": "react-router build",
"dev": "react-router dev",
"start": "wrangler dev",
},
```
#### Wrangler
Add a file named `wrangler.toml` at the root of your project (close to `package.json`).
Adapt the `main` and `assets` fields based on your build output, if you changed them from the defaults.
```toml
workers_dev = true
name = "my-worker"
compatibility_date = "2024-11-18"
main = "./build/server/index.js"
assets = { directory = "./build/client/" }
```
## How it works
Expand All @@ -231,7 +263,7 @@ You can customize the production server port using the `port` option of `createH
When building for production, the Hono server is compiled as `build/server/index.js` and imports your React Router app from `assets/server-build-[hash].js`.
To run the server in production, use `NODE_ENV=production node ./build/server/index.js`.
To run the server in production, use `node ./build/server/index.js`.
That's all!
Expand Down Expand Up @@ -568,7 +600,7 @@ If you used a custom `buildDirectory` option, check this [example](./examples/re
"scripts": {
"build": "react-router build",
"dev": "react-router dev",
"start": "NODE_ENV=production node ./build/server/index.js",
"start": "node ./build/server/index.js",
},
```
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router-bun/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "react-router build",
"dev": "bunx --bun vite",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "NODE_ENV=production bun ./build/server/index.js",
"start": "bun ./build/server/index.js",
"typecheck": "react-router typegen && tsc"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router-custom-build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "react-router build",
"dev": "react-router dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "NODE_ENV=production node ./dist/server/index.js",
"start": "node ./dist/server/index.js",
"typecheck": "react-router typegen && tsc"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router-custom-https/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "react-router build",
"dev": "react-router dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "NODE_ENV=production node ./build/server/index.js",
"start": "node ./build/server/index.js",
"typecheck": "react-router typegen && tsc"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router-sentry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "react-router build",
"dev": "react-router dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "NODE_ENV=production node ./build/server/index.js",
"start": "node ./build/server/index.js",
"typecheck": "react-router typegen && tsc"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion examples/react-router-virtual/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"build": "react-router build",
"dev": "react-router dev",
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
"start": "NODE_ENV=production node ./build/server/index.js",
"start": "node ./build/server/index.js",
"typecheck": "react-router typegen && tsc"
},
"dependencies": {
Expand Down

0 comments on commit bba9ec9

Please sign in to comment.