create-fuzionx 0.1.26 → 0.1.28
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
|
-
|
|
42
|
-
'
|
|
43
|
-
'
|
|
44
|
-
'
|
|
45
|
-
'
|
|
46
|
-
'
|
|
47
|
-
'
|
|
48
|
-
'
|
|
49
|
-
'
|
|
50
|
-
|
|
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
|
-
|
|
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
|
-
|
|
92
|
-
await fs.
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
package/templates/app.js.tpl
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
import { Application } from '@fuzionx/framework';
|
|
2
|
-
import webRoutes from './routes/web.js';
|
|
3
|
-
import apiRoutes from './routes/api.js';
|
|
4
2
|
|
|
5
3
|
const app = new Application({ configPath: './fuzionx.yaml' });
|
|
6
4
|
|
|
7
|
-
app.routes(webRoutes);
|
|
8
|
-
app.routes(apiRoutes);
|
|
9
|
-
|
|
10
5
|
await app.boot();
|
|
11
|
-
|
|
12
|
-
app.listen(49080, () => {
|
|
13
|
-
console.log('🚀 FuzionX running on http://localhost:49080');
|
|
14
|
-
});
|
|
6
|
+
await app.listen();
|