create-fuzionx 0.1.5 → 0.1.7

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.
Files changed (2) hide show
  1. package/fx.js +69 -0
  2. package/package.json +4 -2
package/fx.js ADDED
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * fx — FuzionX CLI (글로벌)
4
+ *
5
+ * 글로벌 설치: npm install -g create-fuzionx
6
+ * 사용법:
7
+ * fx new my-app → create-fuzionx 스캐폴딩
8
+ * fx make:controller User → 로컬 @fuzionx/framework CLI 위임
9
+ * fx dev → 로컬 @fuzionx/framework CLI 위임
10
+ */
11
+ import { execSync } from 'node:child_process';
12
+ import { existsSync } from 'node:fs';
13
+ import path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+
16
+ const [command, ...args] = process.argv.slice(2);
17
+
18
+ // ── fx new → 스캐폴딩 (자체 처리) ──
19
+ if (command === 'new') {
20
+ // create-fuzionx index.js 재사용
21
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
22
+ process.argv = ['node', 'create-fuzionx', ...args];
23
+ await import(path.join(__dirname, 'index.js'));
24
+ process.exit(0);
25
+ }
26
+
27
+ // ── 그 외 명령어 → 로컬 @fuzionx/framework CLI 위임 ──
28
+
29
+ // 로컬 node_modules 에서 fx 찾기
30
+ const localBin = path.resolve('node_modules', '.bin', 'fx');
31
+ const localCli = path.resolve('node_modules', '@fuzionx', 'framework', 'bin', 'fx.js');
32
+
33
+ if (existsSync(localBin) || existsSync(localCli)) {
34
+ const bin = existsSync(localBin) ? localBin : `node ${localCli}`;
35
+ try {
36
+ execSync(`${bin} ${process.argv.slice(2).join(' ')}`, {
37
+ stdio: 'inherit',
38
+ cwd: process.cwd(),
39
+ });
40
+ } catch {
41
+ process.exit(1);
42
+ }
43
+ } else if (!command || command === 'help') {
44
+ console.log(`
45
+ fx — FuzionX CLI
46
+
47
+ 프로젝트 생성:
48
+ fx new <name> 새 프로젝트 스캐폴딩
49
+
50
+ 프로젝트 내 명령어 (@fuzionx/framework 필요):
51
+ fx make:controller <Name> 컨트롤러 생성
52
+ fx make:model <Name> 모델 생성
53
+ fx make:service <Name> 서비스 생성
54
+ fx make:middleware <Name> 미들웨어 생성
55
+ fx make:job <Name> Job 생성
56
+ fx make:task <Name> Task 생성
57
+ fx make:ws <Name> WsHandler 생성
58
+ fx make:event <Name> 이벤트 핸들러 생성
59
+ fx dev 개발 서버 (--watch)
60
+ fx test 테스트 실행
61
+ fx routes 라우트 테이블
62
+ fx config 설정 출력
63
+ fx db:sync 모델 ↔ DB 동기화
64
+ `);
65
+ } else {
66
+ console.error(`❌ @fuzionx/framework가 설치되지 않았습니다.`);
67
+ console.error(` 프로젝트 디렉토리에서 실행하거나, npm install @fuzionx/framework를 먼저 실행하세요.`);
68
+ process.exit(1);
69
+ }
package/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "create-fuzionx",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "Create a new FuzionX application — npx create-fuzionx my-app",
5
5
  "type": "module",
6
6
  "bin": {
7
- "create-fuzionx": "./index.js"
7
+ "create-fuzionx": "./index.js",
8
+ "fx": "./fx.js"
8
9
  },
9
10
  "keywords": ["fuzionx", "create", "scaffold", "cli", "framework"],
10
11
  "license": "MIT",
@@ -17,6 +18,7 @@
17
18
  },
18
19
  "files": [
19
20
  "index.js",
21
+ "fx.js",
20
22
  "templates/"
21
23
  ]
22
24
  }