react-client 1.0.5 → 1.0.6
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 +15 -0
- package/dist/cli/commands/init.js +21 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,6 +6,7 @@ react-client is a lightweight CLI and runtime for building React apps with fast
|
|
|
6
6
|
|
|
7
7
|
## Table of Contents
|
|
8
8
|
- [Installation](#installation)
|
|
9
|
+
- [With Config](#with-config)
|
|
9
10
|
- [Wiki](#wiki)
|
|
10
11
|
- [Available templates](#available-templates)
|
|
11
12
|
- [Features supported by the CLI](#features-supported-by-the-cli)
|
|
@@ -34,6 +35,20 @@ cd myapp
|
|
|
34
35
|
npm run dev
|
|
35
36
|
```
|
|
36
37
|
|
|
38
|
+
## With Config
|
|
39
|
+
|
|
40
|
+
The `init` command supports a small set of helpers for scaffolding projects from the bundled templates. Notably:
|
|
41
|
+
|
|
42
|
+
- `--template <name>`: choose a template (defaults to `react-ts`).
|
|
43
|
+
- `--with-config`: also create a `react-client.config.ts` file in the generated project with a minimal `defineConfig({})` stub.
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
react-client init myapp --template react-ts --with-config
|
|
49
|
+
# creates `myapp/` and writes `myapp/react-client.config.ts`
|
|
50
|
+
```
|
|
51
|
+
|
|
37
52
|
## Wiki
|
|
38
53
|
|
|
39
54
|
[](https://deepwiki.com/venkateshsundaram/react-client)
|
|
@@ -10,7 +10,27 @@ async function init(name, opts = {}) {
|
|
|
10
10
|
const root = path_1.default.resolve(process.cwd(), name);
|
|
11
11
|
const template = opts.template || 'react-ts';
|
|
12
12
|
await fs_extra_1.default.ensureDir(root);
|
|
13
|
-
|
|
13
|
+
// Resolve templates directory by walking up from __dirname until we find a
|
|
14
|
+
// `templates` folder. This handles different install layouts (local dev,
|
|
15
|
+
// global install, packaged dist) transparently.
|
|
16
|
+
let cur = __dirname;
|
|
17
|
+
let tplDir = null;
|
|
18
|
+
while (true) {
|
|
19
|
+
const candidate = path_1.default.join(cur, 'templates');
|
|
20
|
+
if (fs_extra_1.default.existsSync(candidate)) {
|
|
21
|
+
tplDir = candidate;
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
const parent = path_1.default.dirname(cur);
|
|
25
|
+
if (parent === cur)
|
|
26
|
+
break; // reached filesystem root
|
|
27
|
+
cur = parent;
|
|
28
|
+
}
|
|
29
|
+
if (!tplDir) {
|
|
30
|
+
console.error('Templates directory not found in package layout');
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
const tpl = path_1.default.join(tplDir, template);
|
|
14
34
|
if (!fs_extra_1.default.existsSync(tpl)) {
|
|
15
35
|
console.error('Template not found:', template);
|
|
16
36
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "react-client is a lightweight CLI and runtime for building React apps with fast iteration. It is designed to be esbuild-based, Node-native, and modular like Vite/Next.js with SSR, HMR, Tailwind, CSS Modules, and generators.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -80,12 +80,10 @@
|
|
|
80
80
|
"@types/node": "^18.0.0",
|
|
81
81
|
"@typescript-eslint/eslint-plugin": "^8.46.3",
|
|
82
82
|
"@typescript-eslint/parser": "^8.46.3",
|
|
83
|
-
"esbuild": "^0.25.12",
|
|
84
83
|
"eslint": "^8.0.0",
|
|
85
84
|
"eslint-config-prettier": "^8.0.0",
|
|
86
85
|
"eslint-plugin-prettier": "^4.0.0",
|
|
87
86
|
"eslint-plugin-react": "^7.32.2",
|
|
88
|
-
"fs-extra": "^11.1.1",
|
|
89
87
|
"husky": "^9.1.7",
|
|
90
88
|
"jest": "^29.0.0",
|
|
91
89
|
"lint-staged": "^15.4.3",
|
|
@@ -95,6 +93,8 @@
|
|
|
95
93
|
"typescript": "^5.3.0"
|
|
96
94
|
},
|
|
97
95
|
"dependencies": {
|
|
98
|
-
"commander": "^14.0.2"
|
|
96
|
+
"commander": "^14.0.2",
|
|
97
|
+
"fs-extra": "^11.1.1",
|
|
98
|
+
"esbuild": "^0.25.12"
|
|
99
99
|
}
|
|
100
100
|
}
|