create-daloy 0.2.0 → 0.4.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.
- package/bin/create-daloy.mjs +15 -11
- package/package.json +2 -2
- package/templates/bun-basic/package.json +1 -1
- package/templates/bun-basic/src/index.ts +12 -6
- package/templates/cloudflare-worker/package.json +1 -1
- package/templates/deno-basic/deno.json +2 -2
- package/templates/deno-basic/src/main.ts +10 -6
- package/templates/node-basic/AGENTS.md +1 -1
- package/templates/node-basic/package.json +2 -2
- package/templates/node-basic/src/index.ts +12 -6
- package/templates/vercel-edge/package.json +1 -1
package/bin/create-daloy.mjs
CHANGED
|
@@ -248,13 +248,15 @@ function renderBox(lines, options = {}) {
|
|
|
248
248
|
return out.join("\n");
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
-
// Block-letter "
|
|
252
|
-
//
|
|
253
|
-
//
|
|
254
|
-
// from half-block characters so it stays
|
|
251
|
+
// Block-letter "DALOYJS" banner rendered with a left-to-right golden
|
|
252
|
+
// gradient (dark goldenrod → bright gold) on truecolor terminals. Falls back
|
|
253
|
+
// to a single bold-yellow line on 256-color TTYs and to plain text in dumb
|
|
254
|
+
// terminals. The shape is built from half-block characters so it stays
|
|
255
|
+
// compact (2 lines tall) and each glyph is 3 columns wide with a single
|
|
256
|
+
// space between letters, keeping the top and bottom rows perfectly aligned.
|
|
255
257
|
const LOGO_LINES = [
|
|
256
|
-
" \u2588\u2580\u2584
|
|
257
|
-
" \u2588\u2584\u2580
|
|
258
|
+
" \u2588\u2580\u2584 \u2584\u2580\u2588 \u2588 \u2588\u2580\u2588 \u2588 \u2588 \u2588 \u2584\u2580\u2580 ",
|
|
259
|
+
" \u2588\u2584\u2580 \u2588\u2580\u2588 \u2588\u2584\u2584 \u2588\u2584\u2588 \u2588 \u2584\u2584\u2588 \u2584\u2584\u2580 ",
|
|
258
260
|
];
|
|
259
261
|
|
|
260
262
|
function gradientLine(line, startRgb, endRgb) {
|
|
@@ -274,23 +276,25 @@ function gradientLine(line, startRgb, endRgb) {
|
|
|
274
276
|
|
|
275
277
|
function printBanner(version) {
|
|
276
278
|
if (!SUPPORTS_UNICODE) {
|
|
277
|
-
console.log(`\n${color(COLORS.bold, "create-daloy")} ${color(COLORS.dim, `v${version}`)}`);
|
|
279
|
+
console.log(`\n${color(COLORS.bold + COLORS.yellow, "create-daloy")} ${color(COLORS.dim, `v${version}`)}`);
|
|
278
280
|
console.log(color(COLORS.dim, "Contract-first REST APIs for Node, Bun, Deno, Vercel Edge, and Workers"));
|
|
279
281
|
console.log(color(COLORS.dim, "https://daloyjs.dev\n"));
|
|
280
282
|
return;
|
|
281
283
|
}
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
// Golden gradient: DarkGoldenrod → Gold. Evokes the DaloyJS "flow of gold"
|
|
285
|
+
// brand and stays legible on both light and dark terminal backgrounds.
|
|
286
|
+
const start = [184, 134, 11]; // DarkGoldenrod
|
|
287
|
+
const end = [255, 215, 0]; // Gold
|
|
284
288
|
console.log("");
|
|
285
289
|
for (const line of LOGO_LINES) {
|
|
286
290
|
console.log(` ${gradientLine(line, start, end)}`);
|
|
287
291
|
}
|
|
288
292
|
// Build the welcome content lines (each contains its own ANSI color codes).
|
|
289
|
-
const headline = `${color(COLORS.bold, "Welcome to DaloyJS")} ${color(COLORS.gray, `\u2014 v${version}`)}`;
|
|
293
|
+
const headline = `${color(COLORS.bold + COLORS.yellow, "Welcome to DaloyJS")} ${color(COLORS.gray, `\u2014 v${version}`)}`;
|
|
290
294
|
const subline = color(COLORS.dim, "Contract-first REST APIs for Node, Bun, Deno, Vercel Edge, and Workers.");
|
|
291
295
|
const docs = `${color(COLORS.gray, "docs:")} ${color(COLORS.cyan, "https://daloyjs.dev/docs")}`;
|
|
292
296
|
console.log("");
|
|
293
|
-
console.log(renderBox([headline, subline, "", docs]));
|
|
297
|
+
console.log(renderBox([headline, subline, "", docs], { accent: COLORS.yellow }));
|
|
294
298
|
console.log("");
|
|
295
299
|
}
|
|
296
300
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-daloy",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Scaffold a new DaloyJS project. Run with `pnpm create daloy`, `npm create daloy@latest`, `yarn create daloy`, or `bun create daloy`.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"openapi"
|
|
28
28
|
],
|
|
29
29
|
"engines": {
|
|
30
|
-
"node": ">=
|
|
30
|
+
"node": ">=24.15.0"
|
|
31
31
|
},
|
|
32
32
|
"bin": {
|
|
33
33
|
"create-daloy": "bin/create-daloy.mjs"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { serve } from "@daloyjs/core/bun";
|
|
2
|
+
import { printStartupBanner, type StartupBannerLink } from "@daloyjs/core/banner";
|
|
2
3
|
import { buildApp } from "./build-app.ts";
|
|
3
4
|
|
|
4
5
|
const app = buildApp();
|
|
@@ -9,11 +10,16 @@ const handle = serve(app, {
|
|
|
9
10
|
// Bun closes idle keep-alive connections after this many seconds.
|
|
10
11
|
idleTimeout: 30,
|
|
11
12
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
|
|
14
|
+
const url = handle.url ? String(handle.url) : `http://localhost:${port}`;
|
|
15
|
+
const links: StartupBannerLink[] = [
|
|
16
|
+
// daloy-minimal:strip-start docs
|
|
17
|
+
{ label: "Swagger UI", url: `${url}/docs` },
|
|
18
|
+
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
19
|
+
// daloy-minimal:strip-end docs
|
|
20
|
+
{ label: "Health", url: `${url}/healthz` },
|
|
21
|
+
];
|
|
22
|
+
|
|
23
|
+
printStartupBanner({ name: "DaloyJS API", url, runtime: "Bun", links });
|
|
18
24
|
|
|
19
25
|
export default app;
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
"gen:openapi": "deno run --allow-net --allow-env --allow-read --allow-write scripts/dump-openapi.ts"
|
|
9
9
|
},
|
|
10
10
|
"imports": {
|
|
11
|
-
"@daloyjs/core": "npm:@daloyjs/core@^0.
|
|
12
|
-
"@daloyjs/core/": "npm:@daloyjs/core@^0.
|
|
11
|
+
"@daloyjs/core": "npm:@daloyjs/core@^0.9.0",
|
|
12
|
+
"@daloyjs/core/": "npm:@daloyjs/core@^0.9.0/",
|
|
13
13
|
"zod": "npm:zod@^4.4.3"
|
|
14
14
|
},
|
|
15
15
|
"compilerOptions": {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { serve } from "@daloyjs/core/deno";
|
|
2
|
+
import { printStartupBanner, type StartupBannerLink } from "@daloyjs/core/banner";
|
|
2
3
|
import { buildApp } from "./build-app.ts";
|
|
3
4
|
|
|
4
5
|
const app = buildApp();
|
|
@@ -7,11 +8,14 @@ const port = Number(Deno.env.get("PORT") ?? 3000);
|
|
|
7
8
|
serve(app, {
|
|
8
9
|
port,
|
|
9
10
|
onListen: ({ hostname, port: actualPort }) => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
const url = `http://${hostname}:${actualPort}`;
|
|
12
|
+
const links: StartupBannerLink[] = [
|
|
13
|
+
// daloy-minimal:strip-start docs
|
|
14
|
+
{ label: "Swagger UI", url: `${url}/docs` },
|
|
15
|
+
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
16
|
+
// daloy-minimal:strip-end docs
|
|
17
|
+
{ label: "Health", url: `${url}/healthz` },
|
|
18
|
+
];
|
|
19
|
+
printStartupBanner({ name: "DaloyJS API", url, runtime: "Deno", links });
|
|
16
20
|
},
|
|
17
21
|
});
|
|
@@ -4,7 +4,7 @@ A [DaloyJS](https://daloyjs.dev) Node.js REST API. **Contract-first**:
|
|
|
4
4
|
routes are defined with Zod schemas and OpenAPI 3.1 is generated from them.
|
|
5
5
|
|
|
6
6
|
- Package manager: pnpm (use `pnpm` unless the project's `package.json` was rewritten for npm/yarn/bun).
|
|
7
|
-
- Runtime: Node.js >=
|
|
7
|
+
- Runtime: Node.js >= 24.15 (active LTS).
|
|
8
8
|
|
|
9
9
|
## Commands
|
|
10
10
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
7
|
-
"node": ">=
|
|
7
|
+
"node": ">=24.15.0"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
10
|
"dev": "node --import tsx/esm --watch src/index.ts",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"audit": "pnpm audit --prod"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@daloyjs/core": "^0.
|
|
21
|
+
"@daloyjs/core": "^0.9.0",
|
|
22
22
|
"zod": "^4.4.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { serve } from "@daloyjs/core/node";
|
|
2
|
+
import { printStartupBanner, type StartupBannerLink } from "@daloyjs/core/banner";
|
|
2
3
|
import { buildApp } from "./build-app.js";
|
|
3
4
|
|
|
4
5
|
const app = buildApp();
|
|
5
6
|
const port = Number(process.env.PORT ?? 3000);
|
|
6
7
|
|
|
7
8
|
serve(app, { port });
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
|
|
10
|
+
const url = `http://localhost:${port}`;
|
|
11
|
+
const links: StartupBannerLink[] = [
|
|
12
|
+
// daloy-minimal:strip-start docs
|
|
13
|
+
{ label: "Swagger UI", url: `${url}/docs` },
|
|
14
|
+
{ label: "OpenAPI JSON", url: `${url}/openapi.json` },
|
|
15
|
+
// daloy-minimal:strip-end docs
|
|
16
|
+
{ label: "Health", url: `${url}/healthz` },
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
printStartupBanner({ name: "DaloyJS API", url, runtime: "Node.js", links });
|
|
14
20
|
|
|
15
21
|
export default app;
|