@donotdev/cli 0.2.2 → 0.3.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/dependencies-matrix.json +44 -42
- package/dist/bin/commands/agent-setup.js +135 -67
- package/dist/bin/commands/build.js +352 -234
- package/dist/bin/commands/bump.js +385 -257
- package/dist/bin/commands/cacheout.js +59 -49
- package/dist/bin/commands/coach.js +80 -50
- package/dist/bin/commands/create-app.js +501 -228
- package/dist/bin/commands/create-project.js +377 -241
- package/dist/bin/commands/db-check.js +192804 -0
- package/dist/bin/commands/db.js +1889 -1805
- package/dist/bin/commands/deploy.js +476 -287
- package/dist/bin/commands/dev.js +139 -108
- package/dist/bin/commands/doctor.js +91 -57
- package/dist/bin/commands/emu.js +196 -154
- package/dist/bin/commands/format.js +83 -50
- package/dist/bin/commands/get-demo.js +422 -197
- package/dist/bin/commands/make-admin.js +835 -713
- package/dist/bin/commands/preview.js +139 -108
- package/dist/bin/commands/seed.js +2186 -2044
- package/dist/bin/commands/setup-cicd.js +258 -204
- package/dist/bin/commands/setup.js +890 -339
- package/dist/bin/commands/staging.js +476 -287
- package/dist/bin/commands/sync-secrets.js +472 -141
- package/dist/bin/commands/type-check.js +163 -119
- package/dist/bin/commands/wai.js +53 -46
- package/dist/bin/dndev.js +32 -7
- package/dist/bin/donotdev.js +18 -8
- package/dist/index.js +654 -375
- package/package.json +2 -2
- package/templates/app-demo/index.html.example +1 -1
- package/templates/app-dndev/index.html.example +1 -1
- package/templates/app-dndev/src/globals.css.example +1 -1
- package/templates/app-dndev/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-dndev/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-next/src/app/AppDocument.tsx.example +58 -0
- package/templates/app-next/src/app/ClientLayout.tsx.example +6 -2
- package/templates/app-next/src/globals.css.example +1 -1
- package/templates/app-next/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-next/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/app-vite/csp.example.json +1 -1
- package/templates/app-vite/index.html.example +1 -1
- package/templates/app-vite/src/globals.css.example +1 -1
- package/templates/app-vite/src/pages/FormPageExample.tsx.example +21 -16
- package/templates/app-vite/src/pages/legal/LegalNoticePage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/PrivacyPage.tsx.example +1 -1
- package/templates/app-vite/src/pages/legal/TermsPage.tsx.example +1 -1
- package/templates/deploy-config/vercel.json.example +2 -2
- package/templates/functions-supabase/supabase/migrations/20250101000006_crud_bulk_status_guard.sql +258 -0
- package/templates/functions-supabase/supabase/migrations/20250101000007_rate_limit_check.sql +76 -0
- package/templates/overlay-supabase/src/config/providers.nextjs.ts.example +37 -0
- package/templates/root-consumer/.claude/hooks/guard-bash.sh.example +3 -3
- package/templates/root-consumer/.claude/hooks/guard-write.sh.example +5 -1
- package/templates/root-consumer/.claude/hooks/typecheck-stop.sh.example +2 -2
- package/templates/root-consumer/.claude/rules/definition-of-done.md.example +2 -2
- package/templates/root-consumer/.claude/rules/framework.md.example +1 -1
- package/templates/root-consumer/.claude/skills/build/SKILL.md.example +1 -1
- package/templates/root-consumer/.claude/skills/polish/SKILL.md.example +1 -1
- package/templates/root-consumer/.gitignore.example +7 -1
- package/templates/root-consumer/AGENTS.md.example +25 -2
- package/templates/root-consumer/README.md.example +1 -1
- package/templates/app-next/src/app/layout.tsx.example +0 -80
- package/templates/app-next/src/app/not-found.tsx.example +0 -40
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
-- Migration: atomic rate-limit check RPC for Supabase Edge Functions
|
|
2
|
+
-- Purpose: createSupabaseHandler checks every call's rate limit through public.rate_limit_check
|
|
3
|
+
-- (packages/functions/src/supabase/utils/rateLimiter.ts, RATE_LIMIT_CHECK_SQL). Without this
|
|
4
|
+
-- function the limiter fails closed and every Edge Function call answers 429.
|
|
5
|
+
-- EXECUTE for service_role only; SECURITY DEFINER because rate_limits has RLS on and no policy.
|
|
6
|
+
|
|
7
|
+
CREATE OR REPLACE FUNCTION public.rate_limit_check(
|
|
8
|
+
p_key TEXT,
|
|
9
|
+
p_max_attempts INT,
|
|
10
|
+
p_window_ms BIGINT,
|
|
11
|
+
p_block_duration_ms BIGINT
|
|
12
|
+
)
|
|
13
|
+
RETURNS jsonb
|
|
14
|
+
LANGUAGE plpgsql
|
|
15
|
+
SECURITY DEFINER
|
|
16
|
+
SET search_path = ''
|
|
17
|
+
AS $$
|
|
18
|
+
DECLARE
|
|
19
|
+
v_now TIMESTAMPTZ := clock_timestamp();
|
|
20
|
+
v_window_interval INTERVAL := (p_window_ms || ' milliseconds')::INTERVAL;
|
|
21
|
+
v_block_interval INTERVAL := (p_block_duration_ms || ' milliseconds')::INTERVAL;
|
|
22
|
+
v_row public.rate_limits%ROWTYPE;
|
|
23
|
+
BEGIN
|
|
24
|
+
-- Single atomic upsert: INSERT on first call, conditional UPDATE thereafter (no SELECT → UPDATE race).
|
|
25
|
+
INSERT INTO public.rate_limits (key, attempts, window_start, block_until, last_updated)
|
|
26
|
+
VALUES (p_key, 1, v_now, NULL, v_now)
|
|
27
|
+
ON CONFLICT (key) DO UPDATE SET
|
|
28
|
+
window_start = CASE
|
|
29
|
+
WHEN rate_limits.window_start + v_window_interval <= v_now THEN v_now
|
|
30
|
+
ELSE rate_limits.window_start
|
|
31
|
+
END,
|
|
32
|
+
attempts = CASE
|
|
33
|
+
-- Currently blocked: do not increment (the request is rejected below)
|
|
34
|
+
WHEN rate_limits.block_until IS NOT NULL AND v_now < rate_limits.block_until
|
|
35
|
+
THEN rate_limits.attempts
|
|
36
|
+
-- Window expired: reset the counter
|
|
37
|
+
WHEN rate_limits.window_start + v_window_interval <= v_now
|
|
38
|
+
THEN 1
|
|
39
|
+
-- Within the window: increment
|
|
40
|
+
ELSE rate_limits.attempts + 1
|
|
41
|
+
END,
|
|
42
|
+
block_until = CASE
|
|
43
|
+
-- Keep an existing block
|
|
44
|
+
WHEN rate_limits.block_until IS NOT NULL AND v_now < rate_limits.block_until
|
|
45
|
+
THEN rate_limits.block_until
|
|
46
|
+
-- Window just reset: no block
|
|
47
|
+
WHEN rate_limits.window_start + v_window_interval <= v_now
|
|
48
|
+
THEN NULL
|
|
49
|
+
-- Threshold just exceeded: block
|
|
50
|
+
WHEN rate_limits.attempts + 1 >= p_max_attempts
|
|
51
|
+
THEN v_now + v_block_interval
|
|
52
|
+
ELSE NULL
|
|
53
|
+
END,
|
|
54
|
+
last_updated = v_now
|
|
55
|
+
RETURNING * INTO v_row;
|
|
56
|
+
|
|
57
|
+
IF v_row.block_until IS NOT NULL AND v_now < v_row.block_until THEN
|
|
58
|
+
RETURN jsonb_build_object(
|
|
59
|
+
'allowed', false,
|
|
60
|
+
'remaining', 0,
|
|
61
|
+
'reset_at_epoch_ms', EXTRACT(EPOCH FROM v_row.block_until)::BIGINT * 1000,
|
|
62
|
+
'block_remaining_seconds', CEIL(EXTRACT(EPOCH FROM (v_row.block_until - v_now)))::INT
|
|
63
|
+
);
|
|
64
|
+
END IF;
|
|
65
|
+
|
|
66
|
+
RETURN jsonb_build_object(
|
|
67
|
+
'allowed', true,
|
|
68
|
+
'remaining', GREATEST(0, p_max_attempts - v_row.attempts),
|
|
69
|
+
'reset_at_epoch_ms', EXTRACT(EPOCH FROM (v_row.window_start + v_window_interval))::BIGINT * 1000,
|
|
70
|
+
'block_remaining_seconds', NULL
|
|
71
|
+
);
|
|
72
|
+
END;
|
|
73
|
+
$$;
|
|
74
|
+
|
|
75
|
+
REVOKE ALL ON FUNCTION public.rate_limit_check(TEXT, INT, BIGINT, BIGINT) FROM PUBLIC, anon, authenticated;
|
|
76
|
+
GRANT EXECUTE ON FUNCTION public.rate_limit_check(TEXT, INT, BIGINT, BIGINT) TO service_role;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
// src/config/providers.ts — Supabase provider bootstrap (client)
|
|
2
|
+
// Auto-generated by DoNotDev scaffolding. Edit freely.
|
|
3
|
+
// Imported by the app layout (ClientLayout). Server routes generated by the framework
|
|
4
|
+
// (sitemap, llms.txt) set up their own read-only reader: never import this file there.
|
|
5
|
+
|
|
6
|
+
import { configureProviders } from '@donotdev/core';
|
|
7
|
+
import {
|
|
8
|
+
createBrowserClient,
|
|
9
|
+
SupabaseAuth,
|
|
10
|
+
SupabaseCallableProvider,
|
|
11
|
+
SupabaseCrudAdapter,
|
|
12
|
+
SupabaseStorageAdapter,
|
|
13
|
+
} from '@donotdev/supabase';
|
|
14
|
+
|
|
15
|
+
// Next.js inlines NEXT_PUBLIC_* only when referenced literally.
|
|
16
|
+
const url = process.env.NEXT_PUBLIC_SUPABASE_URL;
|
|
17
|
+
const publicKey = process.env.NEXT_PUBLIC_SUPABASE_PUBLIC_KEY; // sb_publishable_...
|
|
18
|
+
|
|
19
|
+
if (!url || !publicKey) {
|
|
20
|
+
console.warn(
|
|
21
|
+
'[dndev] Supabase not configured. Set NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_PUBLIC_KEY in .env'
|
|
22
|
+
);
|
|
23
|
+
} else {
|
|
24
|
+
// Session in cookies: the server renders the signed-in state on the first render.
|
|
25
|
+
const supabase = createBrowserClient(url, publicKey);
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Register Supabase as the backend provider.
|
|
29
|
+
* Must run before any CRUD/auth/storage operations.
|
|
30
|
+
*/
|
|
31
|
+
configureProviders({
|
|
32
|
+
crud: new SupabaseCrudAdapter(supabase),
|
|
33
|
+
auth: new SupabaseAuth(supabase),
|
|
34
|
+
storage: new SupabaseStorageAdapter(supabase, 'uploads'),
|
|
35
|
+
callable: new SupabaseCallableProvider(supabase),
|
|
36
|
+
});
|
|
37
|
+
}
|
|
@@ -12,13 +12,13 @@ COMMAND=$(echo "$INPUT" | bun -e "process.stdout.write(JSON.parse(await Bun.stdi
|
|
|
12
12
|
|
|
13
13
|
# --- HARD BLOCKS (exit 2) ---
|
|
14
14
|
|
|
15
|
-
# Block raw TypeScript compiler (must use
|
|
15
|
+
# Block raw TypeScript compiler (must use dn tc)
|
|
16
16
|
if echo "$COMMAND" | grep -qE '(^|\s|;|&&|\|)(bunx|npx|pnpx)\s+tsc(\s|$)'; then
|
|
17
|
-
echo "BLOCKED: Use '
|
|
17
|
+
echo "BLOCKED: Use 'dn tc' for type-checking, never bunx/npx tsc." >&2
|
|
18
18
|
exit 2
|
|
19
19
|
fi
|
|
20
20
|
if echo "$COMMAND" | grep -qE '(^|\s|;|&&|\|)tsc(\s|$)'; then
|
|
21
|
-
echo "BLOCKED: Use '
|
|
21
|
+
echo "BLOCKED: Use 'dn tc' for type-checking, never raw tsc." >&2
|
|
22
22
|
exit 2
|
|
23
23
|
fi
|
|
24
24
|
|
|
@@ -46,8 +46,12 @@ RESULT=$(echo "$INPUT" | bun -e "
|
|
|
46
46
|
// --- LOOKUP GATE (fail closed) ---
|
|
47
47
|
// Every symbol imported from @donotdev/* must have been passed to
|
|
48
48
|
// lookup_symbol first (ledger written by record-lookup.sh).
|
|
49
|
+
// Project files only: a file outside this project (e.g. the framework source
|
|
50
|
+
// itself) defines @donotdev symbols rather than consuming them.
|
|
51
|
+
const projectDir = (process.env.CLAUDE_PROJECT_DIR ?? '').replace(/\/+$/, '');
|
|
52
|
+
const inProject = projectDir !== '' && fp.startsWith(projectDir + '/');
|
|
49
53
|
try {
|
|
50
|
-
if (/\.(ts|tsx)$/.test(fp) && !/\.d\.ts$/.test(fp) && !/\/node_modules\//.test(fp)) {
|
|
54
|
+
if (inProject && /\.(ts|tsx)$/.test(fp) && !/\.d\.ts$/.test(fp) && !/\/node_modules\//.test(fp)) {
|
|
51
55
|
let result = content;
|
|
52
56
|
if (tn === 'Edit') {
|
|
53
57
|
const f = Bun.file(fp);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
# .claude/hooks/typecheck-stop.sh
|
|
3
|
-
# Stop hook: run
|
|
3
|
+
# Stop hook: run dn tc before declaring done.
|
|
4
4
|
# Ensures type safety before any work is considered complete.
|
|
5
5
|
|
|
6
6
|
set -euo pipefail
|
|
@@ -10,7 +10,7 @@ DIRTY=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
|
10
10
|
[ "$DIRTY" -eq 0 ] && exit 0
|
|
11
11
|
|
|
12
12
|
echo "Running typecheck before completion..." >&2
|
|
13
|
-
if !
|
|
13
|
+
if ! dn tc 2>&1; then
|
|
14
14
|
echo '{"decision":"block","reason":"Typecheck failed. Fix type errors before completing."}'
|
|
15
15
|
exit 0
|
|
16
16
|
fi
|
|
@@ -10,7 +10,7 @@ Every change is incomplete until ALL applicable items are done.
|
|
|
10
10
|
## Mandatory (every change)
|
|
11
11
|
|
|
12
12
|
1. **Code** - simple, follows existing patterns, robust, secure
|
|
13
|
-
2. **Typecheck** - `
|
|
13
|
+
2. **Typecheck** - `dn tc` passes
|
|
14
14
|
3. **i18n** - all user-facing strings via `t('key')`. Locale files updated.
|
|
15
15
|
|
|
16
16
|
## Mandatory for new features
|
|
@@ -30,7 +30,7 @@ Every skill output MUST end with:
|
|
|
30
30
|
```
|
|
31
31
|
## Definition of Done
|
|
32
32
|
- [x] Code: <files changed>
|
|
33
|
-
- [x] Typecheck:
|
|
33
|
+
- [x] Typecheck: dn tc - PASS
|
|
34
34
|
- [x] i18n: <locale files updated, or N/A>
|
|
35
35
|
- [x] Tests: <test file, or N/A>
|
|
36
36
|
- [x] Spec compliance: <verified, or N/A>
|
|
@@ -42,4 +42,4 @@ No `.css`, `.scss`, `.less`, `.module.css` files. No Tailwind utility classes. S
|
|
|
42
42
|
- **i18n-first.** All user-facing strings via `t('key')`. No hardcoded text.
|
|
43
43
|
- **Import order.** React, vendors, @donotdev, relative.
|
|
44
44
|
- **No fallbacks.** Fail loud. Never `|| default`.
|
|
45
|
-
- **Typecheck.** `
|
|
45
|
+
- **Typecheck.** `dn tc` only. Never `bunx tsc`, `npx tsc`, or raw `tsc`.
|
|
@@ -90,4 +90,10 @@ temp/
|
|
|
90
90
|
|
|
91
91
|
# Testing
|
|
92
92
|
/cypress/videos/
|
|
93
|
-
/cypress/screenshots/
|
|
93
|
+
/cypress/screenshots/
|
|
94
|
+
|
|
95
|
+
# Deploy / CLI local state (build output, linked project, local branch pointer)
|
|
96
|
+
.vercel/
|
|
97
|
+
**/supabase/functions/.build/
|
|
98
|
+
**/supabase/.branches/
|
|
99
|
+
**/supabase/.temp/
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
> **You are building a DoNotDev app.** This file is the single source of truth for how to work here.
|
|
4
4
|
|
|
5
|
+
**Also load your global agent instructions** (e.g. `~/.claude/CLAUDE.md`, `~/.claude/AGENTS.md`, or your tool's global instructions file). This file adds the framework's rules on top of them.
|
|
6
|
+
|
|
5
7
|
## Golden path (do this first)
|
|
6
8
|
|
|
7
9
|
1. **Enable MCP** — project includes `.mcp.json` / `.cursor/mcp.json`. If tools fail, run **`get_guideline("AGENT_START_HERE")`** for IDE-specific steps.
|
|
@@ -13,7 +15,7 @@ Architecture and API contracts: **`get_guideline(...)`** and **`lookup_symbol(..
|
|
|
13
15
|
|
|
14
16
|
## The 5 phases
|
|
15
17
|
|
|
16
|
-
Work inside an active phase: **`start_phase(N)`** before work, **`complete_phase({ files })`** before moving on, **`
|
|
18
|
+
Work inside an active phase: **`start_phase(N)`** before work, **`complete_phase({ files })`** before moving on, **`dn tc`** before completing a phase when you changed code.
|
|
17
19
|
|
|
18
20
|
| Phase | Name | Skill (slash) | Focus |
|
|
19
21
|
|-------|------|---------------|--------|
|
|
@@ -36,6 +38,13 @@ Work inside an active phase: **`start_phase(N)`** before work, **`complete_phase
|
|
|
36
38
|
|
|
37
39
|
Last resort: after **`lookup_symbol`** + **`search_framework`**. If you must add one, put it under `src/components/` and document the gap (e.g. JSDoc `@custom-component`). Do not block the user on tooling — deliver working UI.
|
|
38
40
|
|
|
41
|
+
## Database credentials
|
|
42
|
+
|
|
43
|
+
- The project-root `.dndev.secrets` contains the privileged ("god mode") CLI token. Check it before reporting that live database access is blocked or asking the user for credentials.
|
|
44
|
+
- If database MCP authentication fails, use the CLI with the credentials in `.dndev.secrets`; do not assume the public keys in app `.env` files are the only available credentials.
|
|
45
|
+
- Never print token values or copy secrets into documentation, logs, chat, or committed files.
|
|
46
|
+
- Credentials do not authorize extra changes: preserve the user's scope and any required preview/approval before live writes.
|
|
47
|
+
|
|
39
48
|
## CLI essentials
|
|
40
49
|
|
|
41
50
|
`dndev` is the project CLI (global or `bunx dndev`). Common commands:
|
|
@@ -43,12 +52,20 @@ Last resort: after **`lookup_symbol`** + **`search_framework`**. If you must add
|
|
|
43
52
|
| Command | Purpose |
|
|
44
53
|
|---------|---------|
|
|
45
54
|
| `dndev dev` / `dndev dev:app` | Dev server |
|
|
46
|
-
| `
|
|
55
|
+
| `dn tc` / `dn tc --package <name>` | Type-check (use after code changes) |
|
|
47
56
|
| `dndev build` | Production build |
|
|
48
57
|
| `dndev coach` / `dndev setup` / `dndev doctor` | Env and health |
|
|
49
58
|
|
|
50
59
|
Run **`dndev --help`** for the full list. **`dndev create-app`** is interactive (no `--preset`).
|
|
51
60
|
|
|
61
|
+
## Dev & test flow
|
|
62
|
+
|
|
63
|
+
- **No local database.** The app runs locally against the live Supabase database. Never `--local`, never `supabase start` / `supabase db reset`.
|
|
64
|
+
- **Live data:** reads OK. Live writes and migrations only on the owner's order.
|
|
65
|
+
- **Framework changes** arrive via `dn pack --install` run from the framework repo (unpublished build). A `bun install` reverts them: re-run `dn pack`.
|
|
66
|
+
- **Test** by running the app locally on the live database. Typecheck with `dn tc`.
|
|
67
|
+
- **Deploy** only on the owner's order.
|
|
68
|
+
|
|
52
69
|
## Docs and markdown
|
|
53
70
|
|
|
54
71
|
- Do not create random `.md` files. Allowed workflow outputs when the phase requires them: e.g. **`docs/HLD.md`**, **`docs/LLD.md`**.
|
|
@@ -61,3 +78,9 @@ Run **`dndev --help`** for the full list. **`dndev create-app`** is interactive
|
|
|
61
78
|
## MCP tools (quick reference)
|
|
62
79
|
|
|
63
80
|
`start_phase` · `complete_phase` · `approve_phase` · `get_phase_status` · `lookup_symbol` · `get_guideline` · `search_framework` · `setup_coach` · `list_features` · `run_typecheck` · `record_lesson`
|
|
81
|
+
|
|
82
|
+
## Project-specific rules
|
|
83
|
+
|
|
84
|
+
`dndev bump` regenerates everything above the marker below from the framework template; do not edit it. Rules that apply to this project only go below the marker: `dndev bump` keeps them as they are.
|
|
85
|
+
|
|
86
|
+
<!-- dndev:project-specific -->
|
|
@@ -49,7 +49,7 @@ dndev staging # Deploy to staging environment
|
|
|
49
49
|
dndev sync-secrets # Push functions/.env secrets to Firebase Secret Manager
|
|
50
50
|
|
|
51
51
|
# Quality
|
|
52
|
-
|
|
52
|
+
dn tc # Type-check (preferred)
|
|
53
53
|
bun test # Run tests
|
|
54
54
|
dndev build # Production build (or bun run build per app)
|
|
55
55
|
```
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import type { Metadata } from 'next';
|
|
2
|
-
import { headers } from 'next/headers';
|
|
3
|
-
|
|
4
|
-
import { getMetadataForPath } from '@donotdev/core/next';
|
|
5
|
-
import { FontPreloadLinks } from '@donotdev/ui/next';
|
|
6
|
-
|
|
7
|
-
import '../globals.css';
|
|
8
|
-
import { ClientLayout } from './ClientLayout';
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Framework fonts are loaded via CSS @font-face rules in dndev.css (bundled).
|
|
12
|
-
* Font preload links are injected at build time; FontPreloadLinks reads the manifest for SSR.
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Dynamic metadata generation from PageMeta exports.
|
|
17
|
-
* Same PageMeta convention works in Vite (AutoMetaTags) and Next.js (this function).
|
|
18
|
-
* Priority: i18n meta.fullTitle > seo.fullTitle > i18n title | siteName > siteName
|
|
19
|
-
*
|
|
20
|
-
* For dynamic pages with runtime data, use <Seo> component instead.
|
|
21
|
-
*/
|
|
22
|
-
export async function generateMetadata(): Promise<Metadata> {
|
|
23
|
-
// Root layout handles the home page metadata
|
|
24
|
-
// Other pages override via their own generateMetadata or <Seo> component
|
|
25
|
-
return getMetadataForPath('/');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// SSR (appConfig.ssr): render dynamically at request time. The provider tree is
|
|
29
|
-
// store-driven (theme/layout/i18n/overlay read live during render), so it is
|
|
30
|
-
// inherently dynamic under React 19. Setting it on the root layout covers every
|
|
31
|
-
// route in one place — generated pages, hand-written pages, and /_not-found.
|
|
32
|
-
// Content is still fully server-rendered and crawlable. Remove only if this app
|
|
33
|
-
// opts back out of SSR and returns to static export.
|
|
34
|
-
export const dynamic = 'force-dynamic';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Root layout for Next.js App Router
|
|
38
|
-
*
|
|
39
|
-
* Theme detection happens client-side via ClientLayout to avoid
|
|
40
|
-
* Next.js 16 + Turbopack race condition with async layouts.
|
|
41
|
-
* Brief FOUC possible on first load, but prevents build-manifest.json errors.
|
|
42
|
-
*/
|
|
43
|
-
/**
|
|
44
|
-
* Passes the request's Cookie and Accept-Language headers to the providers: the server
|
|
45
|
-
* render and the hydration pass then show the visitor's language and signed-in state
|
|
46
|
-
* on the first paint. Async child, so the root layout itself stays synchronous.
|
|
47
|
-
*/
|
|
48
|
-
async function RequestLayout({ children }: { children: React.ReactNode }) {
|
|
49
|
-
const requestHeaders = await headers();
|
|
50
|
-
return (
|
|
51
|
-
<ClientLayout
|
|
52
|
-
serverCookies={requestHeaders.get('cookie') ?? ''}
|
|
53
|
-
acceptLanguage={requestHeaders.get('accept-language')}
|
|
54
|
-
>
|
|
55
|
-
{children}
|
|
56
|
-
</ClientLayout>
|
|
57
|
-
);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
export default function RootLayout({
|
|
61
|
-
children,
|
|
62
|
-
}: {
|
|
63
|
-
children: React.ReactNode;
|
|
64
|
-
}) {
|
|
65
|
-
return (
|
|
66
|
-
<html
|
|
67
|
-
lang="en"
|
|
68
|
-
className="dndev-design-tokens light"
|
|
69
|
-
suppressHydrationWarning
|
|
70
|
-
>
|
|
71
|
-
<head>
|
|
72
|
-
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
73
|
-
<FontPreloadLinks />
|
|
74
|
-
</head>
|
|
75
|
-
<body className="light">
|
|
76
|
-
<RequestLayout>{children}</RequestLayout>
|
|
77
|
-
</body>
|
|
78
|
-
</html>
|
|
79
|
-
);
|
|
80
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @fileoverview Not found page for Next.js App Router
|
|
3
|
-
* @description 404 error page using framework's NotFoundPage component
|
|
4
|
-
* Next.js automatically uses this file for unmatched routes
|
|
5
|
-
* @version 0.0.1
|
|
6
|
-
* @since 0.0.1
|
|
7
|
-
* @author AMBROISE PARK Consulting
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
import { Suspense } from 'react';
|
|
11
|
-
|
|
12
|
-
import { NotFoundPage } from '@donotdev/ui';
|
|
13
|
-
|
|
14
|
-
// Under appConfig.ssr, /_not-found renders dynamically (real SSR at request time).
|
|
15
|
-
// It's a special route (not a generated page.tsx wrapper), so it carries its own
|
|
16
|
-
// flag; generated content routes get this automatically from the framework.
|
|
17
|
-
// Harmless when SSR is off. Remove if you switch this app back to static export.
|
|
18
|
-
export const dynamic = 'force-dynamic';
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Next.js App Router automatically uses not-found.tsx for 404 errors
|
|
22
|
-
* This file exports the framework's NotFoundPage component which provides:
|
|
23
|
-
* - Professional full-viewport centered design
|
|
24
|
-
* - i18n translation support
|
|
25
|
-
* - Dynamic route suggestions
|
|
26
|
-
* - Accessible navigation buttons
|
|
27
|
-
*
|
|
28
|
-
* NotFoundPage uses the routing hooks (useLocation/useNavigate), whose Next
|
|
29
|
-
* adapter calls useSearchParams(). In the App Router that forces a client-side
|
|
30
|
-
* bailout that throws during static prerender of /_not-found unless wrapped in
|
|
31
|
-
* a Suspense boundary.
|
|
32
|
-
*/
|
|
33
|
-
export default function NotFound() {
|
|
34
|
-
return (
|
|
35
|
-
<Suspense fallback={null}>
|
|
36
|
-
<NotFoundPage />
|
|
37
|
-
</Suspense>
|
|
38
|
-
);
|
|
39
|
-
}
|
|
40
|
-
|