@zntc/init 0.1.0
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/LICENSE +21 -0
- package/README.md +81 -0
- package/bin/zntc-init.mjs +22 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +792 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +603 -0
- package/dist/react-native.d.ts +22 -0
- package/dist/rspack.d.ts +24 -0
- package/dist/shared.d.ts +48 -0
- package/dist/vite.d.ts +17 -0
- package/dist/web.d.ts +24 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 ohah
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# @zntc/init
|
|
2
|
+
|
|
3
|
+
ZNTC project initializer. 기존 프로젝트에 ZNTC 를 얹거나 (overlay), 새 web 프로젝트를 스캐폴딩 (scaffold) 한다.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @zntc/init <mode> [options]
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
## Modes
|
|
10
|
+
|
|
11
|
+
| Mode | 동작 | 대상 |
|
|
12
|
+
| -------------- | -------- | ------------------------------------------------------- |
|
|
13
|
+
| `react-native` | overlay | 기존 React Native CLI 프로젝트 |
|
|
14
|
+
| `vite` | overlay | 기존 Vite 프로젝트 (`@zntc/vite-plugin`) |
|
|
15
|
+
| `rspack` | overlay | 기존 Rspack / Webpack 프로젝트 (`@zntc/rspack-loader`) |
|
|
16
|
+
| `web` | scaffold | 빈 디렉토리에 ZNTC 단독 web 프로젝트 (Vite/Rspack 없이) |
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npx @zntc/init react-native # RN overlay (mode 생략 시에도 동일하게 react-native)
|
|
20
|
+
npx @zntc/init vite # Vite plugin 추가
|
|
21
|
+
npx @zntc/init rspack # rspack-loader 추가 (webpack 도 자동 감지)
|
|
22
|
+
npx @zntc/init web --framework react # 새 react 프로젝트 스캐폴딩
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Help
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
Usage: zntc-init <mode> [options]
|
|
29
|
+
|
|
30
|
+
Modes:
|
|
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)
|
|
35
|
+
|
|
36
|
+
Common options:
|
|
37
|
+
--root <dir> Project root (default: cwd)
|
|
38
|
+
--zntc-version <range> Version range for @zntc packages (default: latest)
|
|
39
|
+
--package-manager <pm> Install command hint: bun, npm, pnpm, or yarn
|
|
40
|
+
--force Overwrite existing files where the mode allows
|
|
41
|
+
--dry-run Print planned changes without writing files
|
|
42
|
+
--help, -h Show this help message
|
|
43
|
+
|
|
44
|
+
react-native options:
|
|
45
|
+
--platform <ios|android> Default platform for the start script (default: ios)
|
|
46
|
+
--no-metro-fallback Do not add Metro fallback scripts
|
|
47
|
+
|
|
48
|
+
rspack options:
|
|
49
|
+
--bundler <rspack|webpack> Force bundler choice (default: auto-detect)
|
|
50
|
+
|
|
51
|
+
web options:
|
|
52
|
+
--name <pkg-name> package.json name field (default: directory name)
|
|
53
|
+
--framework <react|vanilla> Starter template (default: react)
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Overlay vs scaffold
|
|
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 모드
|
|
76
|
+
|
|
77
|
+
기존 Rspack / Webpack 프로젝트에 [`@zntc/rspack-loader`](../rspack-loader) 를 등록한다. `package.json` 에 `@rspack/core` 또는 `webpack` 이 있으면 자동 감지. 명시는 `--bundler rspack|webpack` 으로.
|
|
78
|
+
|
|
79
|
+
## web 모드
|
|
80
|
+
|
|
81
|
+
Vite / Rspack 없이 ZNTC 자체 dev server (`@zntc/web`) + bundler 만으로 동작하는 web 프로젝트를 만든다. React / vanilla 템플릿 제공. `bun run dev` → `zntc dev`, `bun run build` → `zntc build`, `bun run preview` → `zntc preview`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
function isMissingBuiltCli(error) {
|
|
6
|
+
if (!error || error.code !== 'ERR_MODULE_NOT_FOUND') return false;
|
|
7
|
+
const builtCliPath = fileURLToPath(new URL('../dist/cli.js', import.meta.url));
|
|
8
|
+
return String(error.message ?? '').includes(builtCliPath);
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
await import('../dist/cli.js');
|
|
13
|
+
} catch (error) {
|
|
14
|
+
if (!isMissingBuiltCli(error)) throw error;
|
|
15
|
+
console.error('error: @zntc/init JS bundle is missing');
|
|
16
|
+
console.error('');
|
|
17
|
+
console.error('note: zntc-init runs the built JS entry at packages/init/dist/cli.js.');
|
|
18
|
+
console.error('note: source TypeScript is not loaded directly by Node.');
|
|
19
|
+
console.error('');
|
|
20
|
+
console.error('help: run `bun run --cwd packages/init build` from the repository root.');
|
|
21
|
+
process.exit(1);
|
|
22
|
+
}
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|