create-daloy 1.4.0 → 1.5.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 +61 -6
- package/package.json +1 -1
- package/sbom.cdx.json +9 -9
- package/sbom.spdx.json +5 -5
- package/templates/_ci/deno/_github/workflows/container-scan.yml +10 -0
- package/templates/_ci/deno/_github/workflows/deploy.yml +9 -0
- package/templates/_ci/node/_github/workflows/ci.yml +1 -5
- package/templates/_ci/node/_github/workflows/container-scan.yml +10 -0
- package/templates/bun-basic/AGENTS.md +1 -1
- package/templates/bun-basic/README.md +6 -1
- package/templates/bun-basic/_Dockerfile +6 -3
- package/templates/bun-basic/_agents/skills/daloyjs-best-practices/SKILL.md +6 -6
- package/templates/bun-basic/_dockerignore +4 -1
- package/templates/bun-basic/_env.example +12 -0
- package/templates/bun-basic/_gitignore +5 -0
- package/templates/bun-basic/_npmrc +5 -3
- package/templates/bun-basic/package.json +3 -3
- package/templates/bun-basic/pnpm-workspace.yaml +19 -5
- package/templates/bun-basic/src/index.ts +3 -1
- package/templates/bun-basic/tsconfig.json +1 -1
- package/templates/cloudflare-worker/AGENTS.md +1 -1
- package/templates/cloudflare-worker/README.md +6 -1
- package/templates/cloudflare-worker/_Dockerfile +1 -1
- package/templates/cloudflare-worker/_agents/skills/daloyjs-best-practices/SKILL.md +56 -45
- package/templates/cloudflare-worker/_dockerignore +6 -1
- package/templates/cloudflare-worker/_gitignore +5 -0
- package/templates/cloudflare-worker/_npmrc +3 -0
- package/templates/cloudflare-worker/package.json +3 -3
- package/templates/cloudflare-worker/pnpm-workspace.yaml +16 -0
- package/templates/cloudflare-worker/src/index.ts +8 -7
- package/templates/deno-basic/AGENTS.md +1 -1
- package/templates/deno-basic/README.md +1 -1
- package/templates/deno-basic/_Dockerfile +10 -6
- package/templates/deno-basic/_agents/skills/daloyjs-best-practices/SKILL.md +4 -4
- package/templates/deno-basic/_dockerignore +4 -1
- package/templates/deno-basic/_gitignore +5 -0
- package/templates/deno-basic/deno.json +8 -8
- package/templates/deno-basic/deno.lock +4 -4
- package/templates/node-basic/README.md +5 -0
- package/templates/node-basic/_Dockerfile +6 -3
- package/templates/node-basic/_agents/skills/daloyjs-best-practices/SKILL.md +8 -8
- package/templates/node-basic/_dockerignore +4 -1
- package/templates/node-basic/_env.example +11 -0
- package/templates/node-basic/_gitignore +5 -0
- package/templates/node-basic/_npmrc +3 -0
- package/templates/node-basic/package.json +2 -2
- package/templates/node-basic/pnpm-workspace.yaml +16 -0
- package/templates/vercel/AGENTS.md +1 -1
- package/templates/vercel/README.md +19 -2
- package/templates/vercel/_Dockerfile +10 -9
- package/templates/vercel/_agents/skills/daloyjs-best-practices/SKILL.md +2 -2
- package/templates/vercel/_dockerignore +4 -1
- package/templates/vercel/_env.example +9 -1
- package/templates/vercel/_gitignore +5 -0
- package/templates/vercel/_npmrc +3 -0
- package/templates/vercel/_vercelignore +10 -0
- package/templates/vercel/api/index.ts +4 -3
- package/templates/vercel/package.json +3 -3
- package/templates/vercel/pnpm-workspace.yaml +16 -0
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
# Node.js runtime — **this Dockerfile is not a production runtime**. Ship
|
|
6
6
|
# the function to Vercel; use this image for:
|
|
7
7
|
# - Reproducible local dev (devcontainers, GitHub Codespaces).
|
|
8
|
-
# - CI smoke tests that exercise the handler
|
|
9
|
-
# without installing Node/pnpm on the runner.
|
|
8
|
+
# - CI smoke tests that exercise the handler over the plain Node dev
|
|
9
|
+
# server (`src/dev.ts`) without installing Node/pnpm on the runner.
|
|
10
10
|
# - Self-hosted review apps when migrating to the `node-basic`
|
|
11
11
|
# template later.
|
|
12
12
|
#
|
|
@@ -14,11 +14,10 @@
|
|
|
14
14
|
# - Non-root runtime user (uid 1001).
|
|
15
15
|
# - Read-only-root-filesystem friendly: writes are confined to the
|
|
16
16
|
# working dir; mount `/tmp` as tmpfs (`--read-only --tmpfs /tmp`).
|
|
17
|
-
# - `STOPSIGNAL SIGTERM` so
|
|
17
|
+
# - `STOPSIGNAL SIGTERM` so the dev server exits cleanly.
|
|
18
18
|
# - Minimal runner surface: no `curl`, no extra OS packages.
|
|
19
19
|
# BusyBox `wget` powers the HEALTHCHECK.
|
|
20
|
-
# - `tini` as PID 1 for proper signal forwarding and zombie reaping
|
|
21
|
-
# (important because `vercel dev` spawns child processes).
|
|
20
|
+
# - `tini` as PID 1 for proper signal forwarding and zombie reaping.
|
|
22
21
|
# - `pnpm install --frozen-lockfile --ignore-scripts` matches the
|
|
23
22
|
# supply-chain defaults in `.npmrc` (no lifecycle scripts run).
|
|
24
23
|
# - Base image is consumed through the `NODE_IMAGE` ARG so builds
|
|
@@ -32,7 +31,7 @@ ARG NODE_IMAGE=node:24-alpine
|
|
|
32
31
|
FROM ${NODE_IMAGE} AS builder
|
|
33
32
|
WORKDIR /app
|
|
34
33
|
COPY package.json pnpm-lock.yaml* ./
|
|
35
|
-
RUN corepack enable && corepack prepare pnpm@
|
|
34
|
+
RUN corepack enable && corepack prepare pnpm@11.1.3 --activate && \
|
|
36
35
|
pnpm install --frozen-lockfile --ignore-scripts
|
|
37
36
|
COPY . .
|
|
38
37
|
|
|
@@ -50,6 +49,8 @@ STOPSIGNAL SIGTERM
|
|
|
50
49
|
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
|
51
50
|
CMD wget -q -O /dev/null --spider http://127.0.0.1:3000/healthz || exit 1
|
|
52
51
|
ENTRYPOINT ["/sbin/tini", "--"]
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
|
|
52
|
+
# Serve the same app as the Vercel Function over a plain Node listener
|
|
53
|
+
# (src/dev.ts, bound to all interfaces). `vercel dev` is not used here: it
|
|
54
|
+
# needs `vercel login` and a linked project, so it cannot start in a
|
|
55
|
+
# non-interactive container.
|
|
56
|
+
CMD ["node", "src/dev.ts"]
|
|
@@ -90,7 +90,7 @@ pnpm dev # local Node dev server (src/dev.ts) on http://localhost:3000
|
|
|
90
90
|
pnpm typecheck # tsc --noEmit
|
|
91
91
|
pnpm test # run test suite
|
|
92
92
|
pnpm contract # daloy inspect --check api/index.ts
|
|
93
|
-
pnpm deploy
|
|
93
|
+
pnpm run deploy # deploy to Vercel (`pnpm deploy` is pnpm's own command)
|
|
94
94
|
pnpm audit # supply-chain audit
|
|
95
95
|
```
|
|
96
96
|
|
|
@@ -321,7 +321,7 @@ reference. Skip that file for ordinary route work.
|
|
|
321
321
|
|
|
322
322
|
## Logging & observability
|
|
323
323
|
|
|
324
|
-
- Use `ctx.log` — it carries the request id.
|
|
324
|
+
- Use `ctx.state.log` — it carries the request id.
|
|
325
325
|
- `console.log` shows up in Vercel's runtime logs; the framework logger
|
|
326
326
|
emits structured JSON for log aggregators.
|
|
327
327
|
|
|
@@ -1 +1,9 @@
|
|
|
1
|
-
# Add Vercel project env vars here.
|
|
1
|
+
# Add Vercel project env vars here (Project -> Settings -> Environment Variables).
|
|
2
|
+
|
|
3
|
+
# Required once per project so Vercel builds with the pnpm pinned in
|
|
4
|
+
# package.json#packageManager (see README "Deploy").
|
|
5
|
+
# ENABLE_EXPERIMENTAL_COREPACK=1
|
|
6
|
+
|
|
7
|
+
# Vercel's edge is one trusted proxy hop, which is the default. Only change it
|
|
8
|
+
# if you know your chain differs.
|
|
9
|
+
# TRUST_PROXY_HOPS=1
|
|
@@ -12,3 +12,8 @@ coverage/
|
|
|
12
12
|
# consumer's lockfile and can pin transitives to unsigned tarballs.
|
|
13
13
|
# See https://socket.dev/blog/understanding-the-security-concerns-of-npm-shrinkwrap
|
|
14
14
|
npm-shrinkwrap.json
|
|
15
|
+
|
|
16
|
+
# Private keys and certificates (keep them in a secret manager, not git).
|
|
17
|
+
*.pem
|
|
18
|
+
*.key
|
|
19
|
+
*.p12
|
package/templates/vercel/_npmrc
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
# DaloyJS supply-chain hardening defaults — see the "Supply chain" docs.
|
|
2
|
+
#
|
|
3
|
+
# pnpm 11+ reads its settings from pnpm-workspace.yaml, not from this file,
|
|
4
|
+
# so the same values are set there. They stay here for npm and older tooling.
|
|
2
5
|
|
|
3
6
|
auto-install-peers=true
|
|
4
7
|
strict-peer-dependencies=true
|
|
@@ -26,9 +26,10 @@ export const app = new App({
|
|
|
26
26
|
// Reverse-proxy posture. On Vercel, every request reaches the function
|
|
27
27
|
// through Vercel's edge, which sets `x-forwarded-for`. The app must declare
|
|
28
28
|
// that trusted hop, otherwise DaloyJS refuses the spoofable header and
|
|
29
|
-
// returns 500 in production. Vercel
|
|
30
|
-
//
|
|
31
|
-
//
|
|
29
|
+
// returns 500 in production. Vercel overwrites `x-forwarded-for` with the
|
|
30
|
+
// real client IP (it does not append), so the chain is one hop even with a
|
|
31
|
+
// CDN such as Cloudflare in front: keep the default of 1. rateLimit() below
|
|
32
|
+
// follows this setting, so each client gets its own bucket.
|
|
32
33
|
behindProxy: { hops: Number(process.env.TRUST_PROXY_HOPS ?? "1") },
|
|
33
34
|
// daloy-minimal:strip-start docs
|
|
34
35
|
// Auto-mounted docs, outside production only (`docs: "auto"`):
|
|
@@ -10,18 +10,18 @@
|
|
|
10
10
|
"dev": "node --watch src/dev.ts",
|
|
11
11
|
"deploy": "vercel deploy",
|
|
12
12
|
"typecheck": "tsc --noEmit",
|
|
13
|
-
"test": "node --test tests/**/*.test.ts",
|
|
13
|
+
"test": "node --test \"tests/**/*.test.ts\"",
|
|
14
14
|
"contract": "daloy inspect --check api/index.ts",
|
|
15
15
|
"audit": "pnpm audit --prod",
|
|
16
16
|
"hooks:install": "git config core.hooksPath .githooks"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@daloyjs/core": "^1.
|
|
19
|
+
"@daloyjs/core": "^1.5.0",
|
|
20
20
|
"zod": "^4.4.3"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@types/node": "^26.1.0",
|
|
24
|
-
"typescript": "^
|
|
24
|
+
"typescript": "^5.9.3",
|
|
25
25
|
"vercel": "^48.0.0"
|
|
26
26
|
}
|
|
27
27
|
}
|
|
@@ -22,3 +22,19 @@ minimumReleaseAge: 1440
|
|
|
22
22
|
# Transitive deps must resolve from the configured registry, which makes
|
|
23
23
|
# typosquatted-tarball and compromised-fork attacks much harder to land.
|
|
24
24
|
blockExoticSubdeps: true
|
|
25
|
+
|
|
26
|
+
# pnpm 11+ ignores these keys in `.npmrc`, so they live here. `.npmrc` keeps
|
|
27
|
+
# the same values for older tooling.
|
|
28
|
+
#
|
|
29
|
+
# Never run dependency lifecycle scripts (postinstall / preinstall / prepare):
|
|
30
|
+
# the main execution channel of the chalk/debug, node-ipc and Shai-Hulud
|
|
31
|
+
# malware. If you later need a build step, allowlist that one package with
|
|
32
|
+
# `allowBuilds` instead of turning this off.
|
|
33
|
+
ignoreScripts: true
|
|
34
|
+
# Fail on unmet or incompatible peer dependencies instead of warning.
|
|
35
|
+
strictPeerDependencies: true
|
|
36
|
+
# Re-verify package integrity hashes against the lockfile on install.
|
|
37
|
+
verifyStoreIntegrity: true
|
|
38
|
+
# Use the lockfile as-is whenever it satisfies package.json.
|
|
39
|
+
preferFrozenLockfile: true
|
|
40
|
+
autoInstallPeers: true
|