@mandujs/cli 0.9.44 → 0.9.46
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/package.json +1 -1
- package/src/commands/build.ts +27 -19
- package/src/commands/init.ts +60 -0
package/package.json
CHANGED
package/src/commands/build.ts
CHANGED
|
@@ -44,7 +44,27 @@ export async function build(options: BuildOptions = {}): Promise<boolean> {
|
|
|
44
44
|
return false;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// 2.
|
|
47
|
+
// 2. Tailwind CSS 빌드 (Island 여부와 무관하게 먼저 실행)
|
|
48
|
+
const hasTailwind = await isTailwindProject(cwd);
|
|
49
|
+
const resolvedMinify = options.minify ?? buildConfig.minify ?? true;
|
|
50
|
+
|
|
51
|
+
if (hasTailwind) {
|
|
52
|
+
console.log(`\n🎨 Tailwind CSS v4 빌드 중...`);
|
|
53
|
+
const cssResult = await buildCSS({
|
|
54
|
+
rootDir: cwd,
|
|
55
|
+
minify: resolvedMinify,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (!cssResult.success) {
|
|
59
|
+
console.error(`\n❌ CSS 빌드 실패: ${cssResult.error}`);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
console.log(` ✅ CSS 빌드 완료 (${cssResult.buildTime?.toFixed(0)}ms)`);
|
|
64
|
+
console.log(` 출력: ${cssResult.outputPath}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// 3. Hydration이 필요한 라우트 확인
|
|
48
68
|
const hydratedRoutes = manifest.routes.filter(
|
|
49
69
|
(route) =>
|
|
50
70
|
route.kind === "page" &&
|
|
@@ -55,6 +75,12 @@ export async function build(options: BuildOptions = {}): Promise<boolean> {
|
|
|
55
75
|
if (hydratedRoutes.length === 0) {
|
|
56
76
|
console.log("\n📭 Hydration이 필요한 라우트가 없습니다.");
|
|
57
77
|
console.log(" (clientModule이 없거나 hydration.strategy: none)");
|
|
78
|
+
|
|
79
|
+
// CSS만 빌드된 경우도 성공으로 처리
|
|
80
|
+
if (hasTailwind) {
|
|
81
|
+
console.log(`\n✅ CSS 빌드 완료`);
|
|
82
|
+
console.log(` CSS: .mandu/client/globals.css`);
|
|
83
|
+
}
|
|
58
84
|
return true;
|
|
59
85
|
}
|
|
60
86
|
|
|
@@ -64,24 +90,6 @@ export async function build(options: BuildOptions = {}): Promise<boolean> {
|
|
|
64
90
|
console.log(` - ${route.id} (${hydration.strategy}, ${hydration.priority || "visible"})`);
|
|
65
91
|
}
|
|
66
92
|
|
|
67
|
-
// 3. Tailwind CSS 빌드 (감지 시에만)
|
|
68
|
-
const hasTailwind = await isTailwindProject(cwd);
|
|
69
|
-
if (hasTailwind) {
|
|
70
|
-
console.log(`\n🎨 Tailwind CSS v4 빌드 중...`);
|
|
71
|
-
const cssResult = await buildCSS({
|
|
72
|
-
rootDir: cwd,
|
|
73
|
-
minify: options.minify ?? true,
|
|
74
|
-
});
|
|
75
|
-
|
|
76
|
-
if (!cssResult.success) {
|
|
77
|
-
console.error(`\n❌ CSS 빌드 실패: ${cssResult.error}`);
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
console.log(` ✅ CSS 빌드 완료 (${cssResult.buildTime?.toFixed(0)}ms)`);
|
|
82
|
-
console.log(` 출력: ${cssResult.outputPath}`);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
93
|
// 4. 번들 빌드
|
|
86
94
|
const startTime = performance.now();
|
|
87
95
|
const resolvedBuildOptions: BuildOptions = {
|
package/src/commands/init.ts
CHANGED
|
@@ -215,6 +215,9 @@ export async function init(options: InitOptions = {}): Promise<boolean> {
|
|
|
215
215
|
await updatePackageJson(targetDir, css, ui);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
+
// Setup .mcp.json for AI agent integration
|
|
219
|
+
const mcpResult = await setupMcpConfig(targetDir);
|
|
220
|
+
|
|
218
221
|
console.log(`\n✅ 프로젝트 생성 완료!\n`);
|
|
219
222
|
console.log(`📍 위치: ${targetDir}`);
|
|
220
223
|
console.log(`\n🚀 시작하기:`);
|
|
@@ -241,6 +244,15 @@ export async function init(options: InitOptions = {}): Promise<boolean> {
|
|
|
241
244
|
console.log(` src/client/shared/lib/utils.ts → 유틸리티 (cn 함수)`);
|
|
242
245
|
}
|
|
243
246
|
|
|
247
|
+
// MCP 설정 안내
|
|
248
|
+
console.log(`\n🤖 AI 에이전트 통합:`);
|
|
249
|
+
if (mcpResult.created) {
|
|
250
|
+
console.log(` .mcp.json 생성됨 (Claude Code 자동 연결)`);
|
|
251
|
+
} else if (mcpResult.updated) {
|
|
252
|
+
console.log(` .mcp.json에 mandu 서버 추가됨`);
|
|
253
|
+
}
|
|
254
|
+
console.log(` AGENTS.md → 에이전트 가이드 (Bun 사용 명시)`);
|
|
255
|
+
|
|
244
256
|
return true;
|
|
245
257
|
}
|
|
246
258
|
|
|
@@ -343,3 +355,51 @@ async function updatePackageJson(
|
|
|
343
355
|
|
|
344
356
|
await fs.writeFile(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
345
357
|
}
|
|
358
|
+
|
|
359
|
+
interface McpConfigResult {
|
|
360
|
+
created: boolean;
|
|
361
|
+
updated: boolean;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* .mcp.json 설정 (AI 에이전트 통합)
|
|
366
|
+
* - 파일 없으면 새로 생성
|
|
367
|
+
* - 파일 있으면 mandu 서버만 추가/업데이트 (다른 설정 유지)
|
|
368
|
+
*/
|
|
369
|
+
async function setupMcpConfig(targetDir: string): Promise<McpConfigResult> {
|
|
370
|
+
const mcpPath = path.join(targetDir, ".mcp.json");
|
|
371
|
+
|
|
372
|
+
const manduServer = {
|
|
373
|
+
command: "bunx",
|
|
374
|
+
args: ["@mandujs/mcp"],
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
try {
|
|
378
|
+
// 기존 파일 확인
|
|
379
|
+
const existingContent = await fs.readFile(mcpPath, "utf-8");
|
|
380
|
+
const existing = JSON.parse(existingContent);
|
|
381
|
+
|
|
382
|
+
// 기존 설정에 mandu 서버 추가/업데이트
|
|
383
|
+
if (!existing.mcpServers) {
|
|
384
|
+
existing.mcpServers = {};
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
const hadMandu = !!existing.mcpServers.mandu;
|
|
388
|
+
existing.mcpServers.mandu = manduServer;
|
|
389
|
+
|
|
390
|
+
await fs.writeFile(mcpPath, JSON.stringify(existing, null, 2) + "\n");
|
|
391
|
+
|
|
392
|
+
return { created: false, updated: true };
|
|
393
|
+
} catch {
|
|
394
|
+
// 파일 없음 - 새로 생성
|
|
395
|
+
const newConfig = {
|
|
396
|
+
mcpServers: {
|
|
397
|
+
mandu: manduServer,
|
|
398
|
+
},
|
|
399
|
+
};
|
|
400
|
+
|
|
401
|
+
await fs.writeFile(mcpPath, JSON.stringify(newConfig, null, 2) + "\n");
|
|
402
|
+
|
|
403
|
+
return { created: true, updated: false };
|
|
404
|
+
}
|
|
405
|
+
}
|