@zntc/init 0.1.2 → 0.1.4
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 +46 -44
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,45 +1,64 @@
|
|
|
1
1
|
# @zntc/init
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
English · **[한국어](./README_KO.md)**
|
|
4
|
+
|
|
5
|
+
> Scaffold a new ZNTC project, or overlay ZNTC onto an existing React Native CLI / Vite / Rspack app.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@zntc/init)
|
|
8
|
+
[](https://github.com/ohah/zntc/blob/main/LICENSE)
|
|
9
|
+
|
|
10
|
+
`@zntc/init` is the project initializer for [ZNTC](https://github.com/ohah/zntc), a transpiler and bundler for JavaScript / TypeScript / Flow written in Zig. Run it with `npx` — no install step required. It can either **overlay** ZNTC onto an existing project (rewriting `package.json` and build-tool config to delegate transforms to ZNTC) or **scaffold** a standalone ZNTC web project into an empty directory.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
4
13
|
|
|
5
14
|
```bash
|
|
6
15
|
npx @zntc/init <mode> [options]
|
|
7
16
|
```
|
|
8
17
|
|
|
9
|
-
|
|
18
|
+
### Modes
|
|
10
19
|
|
|
11
|
-
| Mode |
|
|
12
|
-
| -------------- | -------- |
|
|
13
|
-
| `react-native` | overlay |
|
|
14
|
-
| `vite` | overlay |
|
|
15
|
-
| `rspack` | overlay |
|
|
16
|
-
| `web` | scaffold |
|
|
20
|
+
| Mode | Action | Target |
|
|
21
|
+
| -------------- | -------- | -------------------------------------------------------------------- |
|
|
22
|
+
| `react-native` | overlay | Existing React Native CLI project |
|
|
23
|
+
| `vite` | overlay | Existing Vite project (`@zntc/vite-plugin`) |
|
|
24
|
+
| `rspack` | overlay | Existing Rspack / Webpack project (`@zntc/rspack-loader`) |
|
|
25
|
+
| `web` | scaffold | Standalone ZNTC web project in an empty directory (no Vite / Rspack) |
|
|
17
26
|
|
|
18
27
|
```bash
|
|
19
|
-
npx @zntc/init react-native
|
|
20
|
-
npx @zntc/init vite
|
|
21
|
-
npx @zntc/init rspack
|
|
22
|
-
npx @zntc/init web --framework react #
|
|
28
|
+
npx @zntc/init react-native # RN overlay (also the default when the mode is omitted)
|
|
29
|
+
npx @zntc/init vite # Add the Vite plugin
|
|
30
|
+
npx @zntc/init rspack # Add rspack-loader (webpack is auto-detected too)
|
|
31
|
+
npx @zntc/init web --framework react # Scaffold a new React project
|
|
23
32
|
```
|
|
24
33
|
|
|
25
|
-
|
|
34
|
+
### Overlay vs scaffold
|
|
26
35
|
|
|
27
|
-
|
|
28
|
-
|
|
36
|
+
- **Overlay** (`react-native` / `vite` / `rspack`) — touches your existing `package.json` and build-tool config to delegate transforms to ZNTC.
|
|
37
|
+
- Adds `@zntc/core` plus the mode-specific package to `devDependencies`.
|
|
38
|
+
- If no build-tool config exists, a ZNTC default template is generated.
|
|
39
|
+
- If a build-tool config already exists, it is **not** overwritten — a manual snippet is printed for you to merge yourself. Use `--force` to overwrite.
|
|
40
|
+
- **Scaffold** (`web`) — creates a fresh project (`package.json`, `tsconfig.json`, `zntc.config.ts`, `index.html`, `src/*`) in an empty directory.
|
|
41
|
+
- Refuses to run if a `package.json` already exists. Use `--force` to overwrite.
|
|
42
|
+
|
|
43
|
+
Every mode supports `--dry-run`, which prints the planned changes without writing any files.
|
|
44
|
+
|
|
45
|
+
### Mode details
|
|
46
|
+
|
|
47
|
+
- **`react-native`** — overlays the ZNTC dev server / bundler onto an existing React Native CLI project. Metro fallback scripts (`start:metro`, `bundle:metro:*`) are added by default. Expo is intentionally unsupported.
|
|
48
|
+
- **`vite`** — registers [`@zntc/vite-plugin`](https://github.com/ohah/zntc/tree/main/packages/vite-plugin) (with `esbuild: false`). Vite's dev server / HMR / plugin ecosystem stays as-is.
|
|
49
|
+
- **`rspack`** — registers [`@zntc/rspack-loader`](https://github.com/ohah/zntc/tree/main/packages/rspack-loader). The bundler is auto-detected from `@rspack/core` or `webpack` in `package.json`; override it with `--bundler rspack|webpack`.
|
|
50
|
+
- **`web`** — builds a web project that runs on the ZNTC dev server (`@zntc/web`) + bundler alone, without Vite or Rspack. React / vanilla templates are provided, and `dev` / `build` / `preview` scripts map to `zntc dev` / `zntc build` / `zntc preview`.
|
|
29
51
|
|
|
30
|
-
|
|
31
|
-
react-native Overlay ZNTC onto an existing React Native CLI project
|
|
32
|
-
vite Overlay ZNTC onto an existing Vite project (@zntc/vite-plugin)
|
|
33
|
-
rspack Overlay ZNTC onto an existing Rspack/Webpack project (@zntc/rspack-loader)
|
|
34
|
-
web Scaffold a standalone ZNTC web project (no Vite/Rspack)
|
|
52
|
+
### Options
|
|
35
53
|
|
|
54
|
+
```text
|
|
36
55
|
Common options:
|
|
37
56
|
--root <dir> Project root (default: cwd)
|
|
38
57
|
--zntc-version <range> Version range for @zntc packages (default: latest)
|
|
39
58
|
--package-manager <pm> Install command hint: bun, npm, pnpm, or yarn
|
|
40
59
|
--force Overwrite existing files where the mode allows
|
|
41
60
|
--dry-run Print planned changes without writing files
|
|
42
|
-
--help, -h Show
|
|
61
|
+
--help, -h Show the help message
|
|
43
62
|
|
|
44
63
|
react-native options:
|
|
45
64
|
--platform <ios|android> Default platform for the start script (default: ios)
|
|
@@ -53,29 +72,12 @@ web options:
|
|
|
53
72
|
--framework <react|vanilla> Starter template (default: react)
|
|
54
73
|
```
|
|
55
74
|
|
|
56
|
-
##
|
|
57
|
-
|
|
58
|
-
- **Overlay** (`react-native` / `vite` / `rspack`): 기존 `package.json` 과 빌드 도구 config 를 손대서 ZNTC 로 transform 을 위임한다.
|
|
59
|
-
- `package.json` 에 `@zntc/core` + 모드별 패키지를 `devDependencies` 로 추가
|
|
60
|
-
- 빌드 도구 config 가 **존재하지 않으면** ZNTC 기본 템플릿 생성
|
|
61
|
-
- 빌드 도구 config 가 **이미 존재하면** 덮어쓰지 않고 `manual` 안내 스니펫을 출력 (사용자가 직접 합치도록). `--force` 로 덮어쓰기.
|
|
62
|
-
- **Scaffold** (`web`): 빈 디렉토리에 `package.json` / `tsconfig.json` / `zntc.config.ts` / `index.html` / `src/*` 까지 새로 만든다.
|
|
63
|
-
- `package.json` 이 이미 있으면 거부. `--force` 로 덮어쓰기.
|
|
64
|
-
|
|
65
|
-
모든 모드 공통으로 `--dry-run` 은 파일 변경 없이 plan 만 출력한다.
|
|
66
|
-
|
|
67
|
-
## react-native 모드
|
|
68
|
-
|
|
69
|
-
기존 React Native CLI 프로젝트에 ZNTC dev server / bundler 를 얹는다. Metro fallback scripts (`start:metro`, `bundle:metro:*`) 기본 추가. Expo 는 의도적으로 미지원.
|
|
70
|
-
|
|
71
|
-
## vite 모드
|
|
72
|
-
|
|
73
|
-
기존 Vite 프로젝트에 [`@zntc/vite-plugin`](../vite-plugin) 을 등록한다 (`esbuild: false`). Vite 의 dev server / HMR / plugin 생태계는 그대로 유지.
|
|
74
|
-
|
|
75
|
-
## rspack 모드
|
|
75
|
+
## Documentation
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
- Monorepo: <https://github.com/ohah/zntc>
|
|
78
|
+
- Official docs: <https://ohah.github.io/zntc>
|
|
79
|
+
- React Native guide: <https://ohah.github.io/zntc/guides/react-native/>
|
|
78
80
|
|
|
79
|
-
##
|
|
81
|
+
## License
|
|
80
82
|
|
|
81
|
-
|
|
83
|
+
MIT
|