@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/dist/shared.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export declare const PACKAGE_MANAGERS: readonly ["bun", "npm", "pnpm", "yarn"];
|
|
2
|
+
export type PackageManager = (typeof PACKAGE_MANAGERS)[number];
|
|
3
|
+
export declare const PACKAGE_JSON = "package.json";
|
|
4
|
+
export declare const ZNTC_CONFIG = "zntc.config.ts";
|
|
5
|
+
export declare const DEFAULT_ZNTC_VERSION = "latest";
|
|
6
|
+
export interface PlannedFile {
|
|
7
|
+
path: string;
|
|
8
|
+
before: string | null;
|
|
9
|
+
after: string;
|
|
10
|
+
changed: boolean;
|
|
11
|
+
/** vite/rspack 처럼 이미 존재하는 사용자 config 파일을 함부로 덮지 않을 때 사용자에게 보여줄 패치 가이드. */
|
|
12
|
+
manualInstructions?: string;
|
|
13
|
+
}
|
|
14
|
+
export type FileAction = 'create' | 'update' | 'unchanged' | 'manual';
|
|
15
|
+
export interface FileChange {
|
|
16
|
+
path: string;
|
|
17
|
+
action: FileAction;
|
|
18
|
+
manualInstructions?: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function readText(path: string): string | null;
|
|
21
|
+
export declare function formatJson(value: unknown): string;
|
|
22
|
+
export declare function parsePackageJson(raw: string): Record<string, any>;
|
|
23
|
+
export declare function ensureObject(value: unknown): Record<string, any>;
|
|
24
|
+
export declare function hasAnyDependency(pkg: Record<string, any>, names: readonly string[]): boolean;
|
|
25
|
+
export declare function addDevDependency(pkg: Record<string, any>, name: string, version: string): Record<string, any>;
|
|
26
|
+
export declare function toChange(file: PlannedFile): FileChange;
|
|
27
|
+
export declare function detectPackageManager(root: string): PackageManager;
|
|
28
|
+
export declare function installCommand(pm: PackageManager): string;
|
|
29
|
+
export interface ApplyPlanResult {
|
|
30
|
+
root: string;
|
|
31
|
+
changes: FileChange[];
|
|
32
|
+
dryRun: boolean;
|
|
33
|
+
installCommand: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function applyPlan(opts: {
|
|
36
|
+
root: string;
|
|
37
|
+
planned: readonly PlannedFile[];
|
|
38
|
+
dryRun: boolean;
|
|
39
|
+
packageManager?: PackageManager;
|
|
40
|
+
}): ApplyPlanResult;
|
|
41
|
+
export declare function planOverlayConfig(opts: {
|
|
42
|
+
root: string;
|
|
43
|
+
candidates: readonly string[];
|
|
44
|
+
defaultName: string;
|
|
45
|
+
generate: () => string;
|
|
46
|
+
manualInstructions: string;
|
|
47
|
+
force: boolean;
|
|
48
|
+
}): PlannedFile;
|
package/dist/vite.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FileChange, type PackageManager, type PlannedFile } from './shared.ts';
|
|
2
|
+
export interface InitViteOptions {
|
|
3
|
+
root?: string;
|
|
4
|
+
dryRun?: boolean;
|
|
5
|
+
force?: boolean;
|
|
6
|
+
packageManager?: PackageManager;
|
|
7
|
+
zntcVersion?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface InitViteResult {
|
|
10
|
+
root: string;
|
|
11
|
+
changes: FileChange[];
|
|
12
|
+
dryRun: boolean;
|
|
13
|
+
installCommand: string;
|
|
14
|
+
}
|
|
15
|
+
export declare function createViteConfig(): string;
|
|
16
|
+
export declare function planViteInit(options?: InitViteOptions): PlannedFile[];
|
|
17
|
+
export declare function initViteProject(options?: InitViteOptions): InitViteResult;
|
package/dist/web.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type FileChange, type PackageManager, type PlannedFile } from './shared.ts';
|
|
2
|
+
export type WebFramework = 'react' | 'vanilla';
|
|
3
|
+
export declare const WEB_FRAMEWORKS: readonly WebFramework[];
|
|
4
|
+
export interface InitWebOptions {
|
|
5
|
+
root?: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
framework?: WebFramework;
|
|
8
|
+
dryRun?: boolean;
|
|
9
|
+
force?: boolean;
|
|
10
|
+
packageManager?: PackageManager;
|
|
11
|
+
zntcVersion?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface InitWebResult {
|
|
14
|
+
root: string;
|
|
15
|
+
changes: FileChange[];
|
|
16
|
+
dryRun: boolean;
|
|
17
|
+
installCommand: string;
|
|
18
|
+
framework: WebFramework;
|
|
19
|
+
}
|
|
20
|
+
export declare function planWebInit(options?: InitWebOptions): {
|
|
21
|
+
files: PlannedFile[];
|
|
22
|
+
framework: WebFramework;
|
|
23
|
+
};
|
|
24
|
+
export declare function initWebProject(options?: InitWebOptions): InitWebResult;
|
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zntc/init",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ZNTC project initializer and React Native CLI overlay",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"create",
|
|
7
|
+
"init",
|
|
8
|
+
"react-native",
|
|
9
|
+
"scaffold",
|
|
10
|
+
"transpiler",
|
|
11
|
+
"zntc"
|
|
12
|
+
],
|
|
13
|
+
"homepage": "https://ohah.github.io/zntc",
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/ohah/zntc/issues"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "ohah",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/ohah/zntc.git",
|
|
22
|
+
"directory": "packages/init"
|
|
23
|
+
},
|
|
24
|
+
"bin": {
|
|
25
|
+
"zntc-init": "./bin/zntc-init.mjs"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"bin/",
|
|
29
|
+
"dist/",
|
|
30
|
+
"README.md"
|
|
31
|
+
],
|
|
32
|
+
"type": "module",
|
|
33
|
+
"main": "./dist/index.js",
|
|
34
|
+
"types": "./dist/index.d.ts",
|
|
35
|
+
"exports": {
|
|
36
|
+
".": {
|
|
37
|
+
"types": "./dist/index.d.ts",
|
|
38
|
+
"import": "./dist/index.js"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"build:js": "bun build src/index.ts src/cli.ts --outdir dist --format esm --target node",
|
|
43
|
+
"build:dts": "bun x tsc -b",
|
|
44
|
+
"build": "bun run build:js && bun run build:dts",
|
|
45
|
+
"test": "bun test --timeout 10000",
|
|
46
|
+
"prepublishOnly": "bun run build && bunx publint --strict --level error ."
|
|
47
|
+
},
|
|
48
|
+
"devDependencies": {
|
|
49
|
+
"@types/node": "^25.5.2"
|
|
50
|
+
},
|
|
51
|
+
"engines": {
|
|
52
|
+
"node": ">=24.0.0"
|
|
53
|
+
}
|
|
54
|
+
}
|