create-fuzionx 0.1.38 → 0.1.39

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/fx.js CHANGED
@@ -8,7 +8,7 @@
8
8
  * fx make:controller User → 로컬 @fuzionx/framework CLI 위임
9
9
  * fx dev → 로컬 @fuzionx/framework CLI 위임
10
10
  */
11
- import { execSync } from 'node:child_process';
11
+ import { spawnSync } from 'node:child_process';
12
12
  import { existsSync } from 'node:fs';
13
13
  import path from 'node:path';
14
14
  import { fileURLToPath } from 'node:url';
@@ -31,14 +31,18 @@ const localBin = path.resolve('node_modules', '.bin', 'fx');
31
31
  const localCli = path.resolve('node_modules', '@fuzionx', 'framework', 'bin', 'fx.js');
32
32
 
33
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);
34
+ // spawnSync 배열 방식 인젝션 방지
35
+ const useLocalBin = existsSync(localBin);
36
+ const bin = useLocalBin ? localBin : process.execPath;
37
+ const spawnArgs = useLocalBin
38
+ ? process.argv.slice(2)
39
+ : [localCli, ...process.argv.slice(2)];
40
+ const result = spawnSync(bin, spawnArgs, {
41
+ stdio: 'inherit',
42
+ cwd: process.cwd(),
43
+ });
44
+ if (result.status !== 0) {
45
+ process.exit(result.status ?? 1);
42
46
  }
43
47
  } else if (!command || command === 'help') {
44
48
  console.log(`
package/index.js CHANGED
@@ -157,15 +157,18 @@ async function createApp(name, targetDir, type = 'spa') {
157
157
  return dir;
158
158
  }
159
159
 
160
- // ── CLI 엔트리 ──
160
+ // ── CLI 엔트리 (direct 실행 시만 동작) ──
161
161
 
162
- const allArgs = process.argv.slice(2);
163
- const name = allArgs.find(a => !a.startsWith('--'));
164
- const typeFlag = allArgs.find(a => a.startsWith('--type='));
165
- const type = typeFlag?.split('=')[1] || 'spa';
162
+ const isDirectEntry = process.argv[1]?.includes('create-fuzionx') || process.argv[1]?.endsWith('index.js');
166
163
 
167
- if (!name) {
168
- console.error(`
164
+ if (isDirectEntry) {
165
+ const allArgs = process.argv.slice(2);
166
+ const name = allArgs.find(a => !a.startsWith('--'));
167
+ const typeFlag = allArgs.find(a => a.startsWith('--type='));
168
+ const type = typeFlag?.split('=')[1] || 'spa';
169
+
170
+ if (!name) {
171
+ console.error(`
169
172
  Usage: npx create-fuzionx <app-name> [--type=ssr|spa]
170
173
 
171
174
  Examples:
@@ -173,19 +176,19 @@ if (!name) {
173
176
  npx create-fuzionx my-app --type=ssr # MPA (SSR)
174
177
  npx create-fuzionx my-app --type=spa # SPA (Vue.js 3 + SSR)
175
178
  `);
176
- process.exit(1);
177
- }
179
+ process.exit(1);
180
+ }
178
181
 
179
- const validTypes = ['ssr', 'spa'];
180
- if (!validTypes.includes(type)) {
181
- console.error(`❌ Unknown type: ${type}. Available: ${validTypes.join(', ')}`);
182
- process.exit(1);
183
- }
182
+ const validTypes = ['ssr', 'spa'];
183
+ if (!validTypes.includes(type)) {
184
+ console.error(`❌ Unknown type: ${type}. Available: ${validTypes.join(', ')}`);
185
+ process.exit(1);
186
+ }
184
187
 
185
- try {
186
- const dir = await createApp(name, null, type);
187
- const nextCmd = type === 'spa' ? 'npx fx dev:spa' : 'npx fx dev';
188
- console.log(`
188
+ try {
189
+ const dir = await createApp(name, null, type);
190
+ const nextCmd = type === 'spa' ? 'npx fx dev:spa' : 'npx fx dev';
191
+ console.log(`
189
192
  ✅ Created ${name} at ${dir} (type: ${type})
190
193
 
191
194
  Next steps:
@@ -196,7 +199,8 @@ try {
196
199
  ` : ''}npx fx db:sync --apply
197
200
  ${nextCmd}
198
201
  `);
199
- } catch (err) {
200
- console.error(`❌ Failed to create app: ${err.message}`);
201
- process.exit(1);
202
+ } catch (err) {
203
+ console.error(`❌ Failed to create app: ${err.message}`);
204
+ process.exit(1);
205
+ }
202
206
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fuzionx",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Create a new FuzionX application — npx create-fuzionx my-app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -9,8 +9,8 @@
9
9
  "test": "vitest run"
10
10
  },
11
11
  "dependencies": {
12
- "@fuzionx/framework": "^0.1.38",
13
- "@fuzionx/client": "^0.1.38",
12
+ "@fuzionx/framework": "^0.1.39",
13
+ "@fuzionx/client": "^0.1.39",
14
14
  "joi": "^18.1.1"
15
15
  },
16
16
  "devDependencies": {
@@ -4,7 +4,7 @@
4
4
  "description": "Vue.js 3 SPA + Tera SSR 하이브리드. WASM 암호화 통신.",
5
5
  "features": ["auth", "board", "i18n", "asp", "wasm"],
6
6
  "dependencies": {
7
- "@fuzionx/client": "^0.1.38"
7
+ "@fuzionx/client": "^0.1.39"
8
8
  },
9
9
  "devDependencies": {},
10
10
  "spaDevDependencies": {