create-fuzionx 0.1.26 → 0.1.27

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/index.js CHANGED
@@ -24,30 +24,38 @@ async function loadTemplate(relPath, vars) {
24
24
  return render(raw, vars);
25
25
  }
26
26
 
27
- // ── 스캐폴딩 파일 목록 ──
27
+ // ── 스캐폴딩 파일 목록 (multi-app 구조) ──
28
28
 
29
29
  const APP_FILES = [
30
30
  { tpl: 'package.json.tpl', dest: 'package.json' },
31
31
  { tpl: 'fuzionx.yaml.tpl', dest: 'fuzionx.yaml' },
32
32
  { tpl: 'app.js.tpl', dest: 'app.js' },
33
- { tpl: 'routes/web.js.tpl', dest: 'routes/web.js' },
34
- { tpl: 'routes/api.js.tpl', dest: 'routes/api.js' },
33
+ { tpl: 'routes/web.js.tpl', dest: 'app/backend/routes/web.js' },
34
+ { tpl: 'routes/api.js.tpl', dest: 'app/backend/routes/api.js' },
35
35
  { tpl: '.env.example.tpl', dest: '.env.example' },
36
36
  { tpl: '.env.example.tpl', dest: '.env' },
37
37
  { tpl: '.gitignore.tpl', dest: '.gitignore' },
38
38
  ];
39
39
 
40
+ /** 스캐폴딩 디렉토리 (multi-app 구조) */
40
41
  const APP_DIRS = [
41
- 'controllers',
42
- 'models',
43
- 'services',
44
- 'middleware',
45
- 'ws',
46
- 'jobs',
47
- 'events',
48
- 'workers',
49
- 'migrations',
50
- 'seeds',
42
+ // 앱별
43
+ 'app/backend/controllers',
44
+ 'app/backend/routes',
45
+ 'app/backend/services',
46
+ 'app/backend/middleware',
47
+ 'app/backend/views/default/pages',
48
+ 'app/backend/views/default/layouts',
49
+ 'app/backend/views/default/errors',
50
+ 'app/backend/ws',
51
+ // 공유
52
+ 'database/models',
53
+ 'database/migrations',
54
+ 'database/seeds',
55
+ 'shared/events',
56
+ 'shared/jobs',
57
+ 'shared/workers',
58
+ // 인프라
51
59
  'storage/logs',
52
60
  'storage/uploads',
53
61
  'public/css',
@@ -68,7 +76,11 @@ async function createApp(name, targetDir) {
68
76
  // 디렉토리 생성
69
77
  for (const d of APP_DIRS) {
70
78
  await fs.mkdir(path.join(dir, d), { recursive: true });
71
- await fs.writeFile(path.join(dir, d, '.gitkeep'), '');
79
+ // .gitkeep 리프 디렉토리에만
80
+ const files = await fs.readdir(path.join(dir, d)).catch(() => []);
81
+ if (files.length === 0) {
82
+ await fs.writeFile(path.join(dir, d, '.gitkeep'), '');
83
+ }
72
84
  }
73
85
 
74
86
  // 템플릿 파일 생성
@@ -81,25 +93,34 @@ async function createApp(name, targetDir) {
81
93
 
82
94
  // HomeController 복사
83
95
  const hcSrc = path.join(TPL_DIR, 'controllers/HomeController.js');
84
- const hcDst = path.join(dir, 'controllers/HomeController.js');
96
+ const hcDst = path.join(dir, 'app/backend/controllers/HomeController.js');
85
97
  await fs.copyFile(hcSrc, hcDst);
86
98
 
87
- // Views — views/{theme}/ 구조
99
+ // Views — app/backend/views/{theme}/ 구조
88
100
  const viewsSrc = path.join(TPL_DIR, 'views/default');
89
- const viewsDst = path.join(dir, 'views/default');
90
-
91
- const layoutDir = path.join(viewsDst, 'layouts');
92
- await fs.mkdir(layoutDir, { recursive: true });
93
- await fs.copyFile(path.join(viewsSrc, 'layouts/main.html'), path.join(layoutDir, 'main.html'));
94
-
95
- const pagesDir = path.join(viewsDst, 'pages');
96
- await fs.mkdir(pagesDir, { recursive: true });
97
- await fs.copyFile(path.join(viewsSrc, 'pages/home.html'), path.join(pagesDir, 'home.html'));
98
-
99
- const errDir = path.join(viewsDst, 'errors');
100
- await fs.mkdir(errDir, { recursive: true });
101
- await fs.copyFile(path.join(viewsSrc, 'errors/404.html'), path.join(errDir, '404.html'));
102
- await fs.copyFile(path.join(viewsSrc, 'errors/500.html'), path.join(errDir, '500.html'));
101
+ const viewsDst = path.join(dir, 'app/backend/views/default');
102
+
103
+ // layouts/main.html
104
+ await fs.copyFile(
105
+ path.join(viewsSrc, 'layouts/main.html'),
106
+ path.join(viewsDst, 'layouts/main.html'),
107
+ );
108
+
109
+ // pages/home.html
110
+ await fs.copyFile(
111
+ path.join(viewsSrc, 'pages/home.html'),
112
+ path.join(viewsDst, 'pages/home.html'),
113
+ );
114
+
115
+ // errors/404.html, 500.html
116
+ await fs.copyFile(
117
+ path.join(viewsSrc, 'errors/404.html'),
118
+ path.join(viewsDst, 'errors/404.html'),
119
+ );
120
+ await fs.copyFile(
121
+ path.join(viewsSrc, 'errors/500.html'),
122
+ path.join(viewsDst, 'errors/500.html'),
123
+ );
103
124
 
104
125
  return dir;
105
126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-fuzionx",
3
- "version": "0.1.26",
3
+ "version": "0.1.27",
4
4
  "description": "Create a new FuzionX application — npx create-fuzionx my-app",
5
5
  "type": "module",
6
6
  "bin": {
@@ -7,7 +7,7 @@
7
7
  "test": "vitest run"
8
8
  },
9
9
  "dependencies": {
10
- "@fuzionx/framework": "^0.1.26"
10
+ "@fuzionx/framework": "^0.1.27"
11
11
  },
12
12
  "devDependencies": {
13
13
  "vitest": "^3.0.0"