@mandujs/cli 0.12.2 โ†’ 0.13.0

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 (51) hide show
  1. package/README.ko.md +234 -234
  2. package/README.md +354 -354
  3. package/package.json +2 -2
  4. package/src/commands/contract.ts +173 -173
  5. package/src/commands/dev.ts +8 -68
  6. package/src/commands/doctor.ts +27 -27
  7. package/src/commands/guard-arch.ts +303 -303
  8. package/src/commands/guard-check.ts +3 -3
  9. package/src/commands/monitor.ts +300 -300
  10. package/src/commands/openapi.ts +107 -107
  11. package/src/commands/registry.ts +367 -357
  12. package/src/commands/routes.ts +228 -228
  13. package/src/commands/start.ts +184 -0
  14. package/src/errors/codes.ts +35 -35
  15. package/src/errors/index.ts +2 -2
  16. package/src/errors/messages.ts +143 -143
  17. package/src/hooks/index.ts +17 -17
  18. package/src/hooks/preaction.ts +256 -256
  19. package/src/main.ts +37 -34
  20. package/src/terminal/banner.ts +166 -166
  21. package/src/terminal/help.ts +306 -306
  22. package/src/terminal/index.ts +71 -71
  23. package/src/terminal/output.ts +295 -295
  24. package/src/terminal/palette.ts +30 -30
  25. package/src/terminal/progress.ts +327 -327
  26. package/src/terminal/stream-writer.ts +214 -214
  27. package/src/terminal/table.ts +354 -354
  28. package/src/terminal/theme.ts +142 -142
  29. package/src/util/bun.ts +6 -6
  30. package/src/util/fs.ts +23 -23
  31. package/src/util/handlers.ts +96 -0
  32. package/src/util/manifest.ts +52 -52
  33. package/src/util/output.ts +22 -22
  34. package/src/util/port.ts +71 -71
  35. package/templates/default/AGENTS.md +96 -96
  36. package/templates/default/app/api/health/route.ts +13 -13
  37. package/templates/default/app/globals.css +49 -49
  38. package/templates/default/app/layout.tsx +27 -27
  39. package/templates/default/app/page.tsx +38 -38
  40. package/templates/default/package.json +1 -0
  41. package/templates/default/src/client/shared/lib/utils.ts +16 -16
  42. package/templates/default/src/client/shared/ui/button.tsx +57 -57
  43. package/templates/default/src/client/shared/ui/card.tsx +78 -78
  44. package/templates/default/src/client/shared/ui/index.ts +21 -21
  45. package/templates/default/src/client/shared/ui/input.tsx +24 -24
  46. package/templates/default/tests/example.test.ts +58 -58
  47. package/templates/default/tests/helpers.ts +52 -52
  48. package/templates/default/tests/setup.ts +9 -9
  49. package/templates/default/tsconfig.json +12 -14
  50. package/templates/default/apps/server/main.ts +0 -67
  51. package/templates/default/apps/web/entry.tsx +0 -35
@@ -1,67 +0,0 @@
1
- import {
2
- loadManifest,
3
- startServer,
4
- registerApiHandler,
5
- registerPageLoader,
6
- registerPageHandler,
7
- } from "@mandujs/core";
8
- import path from "path";
9
-
10
- const SPEC_PATH = path.resolve(import.meta.dir, "../../spec/routes.manifest.json");
11
-
12
- async function main() {
13
- console.log("๐ŸฅŸ Mandu Server Starting...\n");
14
-
15
- const result = await loadManifest(SPEC_PATH);
16
-
17
- if (!result.success || !result.data) {
18
- console.error("โŒ Spec ๋กœ๋“œ ์‹คํŒจ:");
19
- result.errors?.forEach((e) => console.error(` - ${e}`));
20
- process.exit(1);
21
- }
22
-
23
- console.log(`โœ… Spec ๋กœ๋“œ ์™„๋ฃŒ: ${result.data.routes.length}๊ฐœ ๋ผ์šฐํŠธ`);
24
-
25
- for (const route of result.data.routes) {
26
- if (route.kind === "api") {
27
- const modulePath = path.resolve(import.meta.dir, "../../", route.module);
28
- try {
29
- const module = await import(modulePath);
30
- registerApiHandler(route.id, module.default || module.handler);
31
- console.log(` ๐Ÿ“ก API: ${route.pattern} -> ${route.id}`);
32
- } catch (error) {
33
- console.error(` โŒ API ํ•ธ๋“ค๋Ÿฌ ๋กœ๋“œ ์‹คํŒจ: ${route.id}`, error);
34
- }
35
- } else if (route.kind === "page") {
36
- const componentPath = path.resolve(import.meta.dir, "../../", route.componentModule!);
37
-
38
- // slotModule์ด ์žˆ์œผ๋ฉด PageHandler ์‚ฌ์šฉ (filling.loader ์ง€์›)
39
- if (route.slotModule) {
40
- registerPageHandler(route.id, async () => {
41
- const module = await import(componentPath);
42
- // module.default = { component, filling }
43
- return module.default;
44
- });
45
- console.log(` ๐Ÿ“„ Page: ${route.pattern} -> ${route.id} (with loader)`);
46
- } else {
47
- // slotModule์ด ์—†์œผ๋ฉด ๊ธฐ์กด PageLoader ์‚ฌ์šฉ
48
- registerPageLoader(route.id, () => import(componentPath));
49
- console.log(` ๐Ÿ“„ Page: ${route.pattern} -> ${route.id}`);
50
- }
51
- }
52
- }
53
-
54
- console.log("");
55
-
56
- const server = startServer(result.data, {
57
- port: Number(process.env.PORT) || 3000,
58
- });
59
-
60
- process.on("SIGINT", () => {
61
- console.log("\n๐Ÿ›‘ ์„œ๋ฒ„ ์ข…๋ฃŒ ์ค‘...");
62
- server.stop();
63
- process.exit(0);
64
- });
65
- }
66
-
67
- main().catch(console.error);
@@ -1,35 +0,0 @@
1
- import React from "react";
2
- import type { ReactElement } from "react";
3
-
4
- export interface AppContext {
5
- routeId: string;
6
- url: string;
7
- params: Record<string, string>;
8
- }
9
-
10
- type RouteComponent = (props: { params: Record<string, string> }) => ReactElement;
11
-
12
- const routeComponents: Record<string, RouteComponent> = {};
13
-
14
- export function registerRoute(routeId: string, component: RouteComponent): void {
15
- routeComponents[routeId] = component;
16
- }
17
-
18
- export function createApp(context: AppContext): ReactElement {
19
- const Component = routeComponents[context.routeId];
20
-
21
- if (!Component) {
22
- return (
23
- <div>
24
- <h1>404 - Route Not Found</h1>
25
- <p>Route ID: {context.routeId}</p>
26
- </div>
27
- );
28
- }
29
-
30
- return <Component params={context.params} />;
31
- }
32
-
33
- export function getRegisteredRoutes(): string[] {
34
- return Object.keys(routeComponents);
35
- }