react-fs-router 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -92,6 +92,47 @@ only the ones you actually use.
|
|
|
92
92
|
|
|
93
93
|
Let's build a tiny app together. This is the whole setup:
|
|
94
94
|
|
|
95
|
+
### ⚡ Vite plugin
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// vite.config.ts
|
|
99
|
+
import { reactFsRouter } from "react-fs-router/vite";
|
|
100
|
+
|
|
101
|
+
export default {
|
|
102
|
+
plugins: [reactFsRouter({ userConfig: { pages: "src/pages" } })],
|
|
103
|
+
};
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### 📦 Webpack plugin
|
|
107
|
+
|
|
108
|
+
```js
|
|
109
|
+
// webpack.config.js
|
|
110
|
+
const { ReactFsRouterWebpackPlugin } = require("react-fs-router/webpack");
|
|
111
|
+
|
|
112
|
+
module.exports = {
|
|
113
|
+
plugins: [new ReactFsRouterWebpackPlugin({ userConfig: { pages: "src/pages" } })],
|
|
114
|
+
};
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### CLI (any toolchain)
|
|
118
|
+
|
|
119
|
+
```bash
|
|
120
|
+
npx rfr --input src/pages --output src --adapter react-router
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Options:
|
|
124
|
+
|
|
125
|
+
| Flag | Description |
|
|
126
|
+
| --- | --- |
|
|
127
|
+
| `-i, --input <dir>` | Pages directory (overrides config) |
|
|
128
|
+
| `-c, --config <file>` | Config file path (default `rfr.config.ts`) |
|
|
129
|
+
| `-o, --output <dir>` | Output directory (overrides config) |
|
|
130
|
+
| `-a, --adapter <name>` | Routing adapter to use |
|
|
131
|
+
| `-w, --watch` | Watch and regenerate on changes |
|
|
132
|
+
| `-b, --build` | Generate once and exit (default) |
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
95
136
|
### 1. Create a config file
|
|
96
137
|
|
|
97
138
|
```ts
|
|
@@ -674,50 +715,6 @@ import { defineAdapter } from "react-fs-router";
|
|
|
674
715
|
defineAdapter("my-router", ({ routes }) => <MyRoutes routes={routes} />);
|
|
675
716
|
```
|
|
676
717
|
|
|
677
|
-
---
|
|
678
|
-
|
|
679
|
-
## 🛠️ CLI & plugins
|
|
680
|
-
|
|
681
|
-
### CLI (any toolchain)
|
|
682
|
-
|
|
683
|
-
```bash
|
|
684
|
-
npx rfr --input src/pages --output src --adapter react-router
|
|
685
|
-
```
|
|
686
|
-
|
|
687
|
-
Options:
|
|
688
|
-
|
|
689
|
-
| Flag | Description |
|
|
690
|
-
| --- | --- |
|
|
691
|
-
| `-i, --input <dir>` | Pages directory (overrides config) |
|
|
692
|
-
| `-c, --config <file>` | Config file path (default `rfr.config.ts`) |
|
|
693
|
-
| `-o, --output <dir>` | Output directory (overrides config) |
|
|
694
|
-
| `-a, --adapter <name>` | Routing adapter to use |
|
|
695
|
-
| `-w, --watch` | Watch and regenerate on changes |
|
|
696
|
-
| `-b, --build` | Generate once and exit (default) |
|
|
697
|
-
|
|
698
|
-
### ⚡ Vite plugin
|
|
699
|
-
|
|
700
|
-
```ts
|
|
701
|
-
// vite.config.ts
|
|
702
|
-
import { reactFsRouter } from "react-fs-router/vite";
|
|
703
|
-
|
|
704
|
-
export default {
|
|
705
|
-
plugins: [reactFsRouter({ userConfig: { pages: "src/pages" } })],
|
|
706
|
-
};
|
|
707
|
-
```
|
|
708
|
-
|
|
709
|
-
### 📦 Webpack plugin
|
|
710
|
-
|
|
711
|
-
```js
|
|
712
|
-
// webpack.config.js
|
|
713
|
-
const { ReactFsRouterWebpackPlugin } = require("react-fs-router/webpack");
|
|
714
|
-
|
|
715
|
-
module.exports = {
|
|
716
|
-
plugins: [new ReactFsRouterWebpackPlugin({ userConfig: { pages: "src/pages" } })],
|
|
717
|
-
};
|
|
718
|
-
```
|
|
719
|
-
|
|
720
|
-
---
|
|
721
718
|
|
|
722
719
|
## 📜 License
|
|
723
720
|
|