@prenta/cli 0.14.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/.turbo/turbo-build.log +4 -0
- package/.turbo/turbo-test.log +353 -0
- package/CHANGELOG.md +404 -0
- package/LICENSE +21 -0
- package/README.md +30 -0
- package/dist/__tests__/db-init.test.d.ts +2 -0
- package/dist/__tests__/db-init.test.d.ts.map +1 -0
- package/dist/__tests__/db-init.test.js +127 -0
- package/dist/__tests__/db-init.test.js.map +1 -0
- package/dist/__tests__/db-sync-resolver.test.d.ts +2 -0
- package/dist/__tests__/db-sync-resolver.test.d.ts.map +1 -0
- package/dist/__tests__/db-sync-resolver.test.js +25 -0
- package/dist/__tests__/db-sync-resolver.test.js.map +1 -0
- package/dist/__tests__/db-sync.test.d.ts +2 -0
- package/dist/__tests__/db-sync.test.d.ts.map +1 -0
- package/dist/__tests__/db-sync.test.js +167 -0
- package/dist/__tests__/db-sync.test.js.map +1 -0
- package/dist/__tests__/deployment-diagnostics.test.d.ts +2 -0
- package/dist/__tests__/deployment-diagnostics.test.d.ts.map +1 -0
- package/dist/__tests__/deployment-diagnostics.test.js +401 -0
- package/dist/__tests__/deployment-diagnostics.test.js.map +1 -0
- package/dist/__tests__/form-seed.test.d.ts +2 -0
- package/dist/__tests__/form-seed.test.d.ts.map +1 -0
- package/dist/__tests__/form-seed.test.js +79 -0
- package/dist/__tests__/form-seed.test.js.map +1 -0
- package/dist/__tests__/init.test.d.ts +2 -0
- package/dist/__tests__/init.test.d.ts.map +1 -0
- package/dist/__tests__/init.test.js +25 -0
- package/dist/__tests__/init.test.js.map +1 -0
- package/dist/__tests__/load-dotenv.test.d.ts +2 -0
- package/dist/__tests__/load-dotenv.test.d.ts.map +1 -0
- package/dist/__tests__/load-dotenv.test.js +40 -0
- package/dist/__tests__/load-dotenv.test.js.map +1 -0
- package/dist/__tests__/mcp-init.test.d.ts +2 -0
- package/dist/__tests__/mcp-init.test.d.ts.map +1 -0
- package/dist/__tests__/mcp-init.test.js +100 -0
- package/dist/__tests__/mcp-init.test.js.map +1 -0
- package/dist/__tests__/prisma-client-path.test.d.ts +2 -0
- package/dist/__tests__/prisma-client-path.test.d.ts.map +1 -0
- package/dist/__tests__/prisma-client-path.test.js +66 -0
- package/dist/__tests__/prisma-client-path.test.js.map +1 -0
- package/dist/__tests__/schema-fragment.test.d.ts +2 -0
- package/dist/__tests__/schema-fragment.test.d.ts.map +1 -0
- package/dist/__tests__/schema-fragment.test.js +40 -0
- package/dist/__tests__/schema-fragment.test.js.map +1 -0
- package/dist/__tests__/seed.test.d.ts +2 -0
- package/dist/__tests__/seed.test.d.ts.map +1 -0
- package/dist/__tests__/seed.test.js +207 -0
- package/dist/__tests__/seed.test.js.map +1 -0
- package/dist/__tests__/upgrade.test.d.ts +2 -0
- package/dist/__tests__/upgrade.test.d.ts.map +1 -0
- package/dist/__tests__/upgrade.test.js +41 -0
- package/dist/__tests__/upgrade.test.js.map +1 -0
- package/dist/__tests__/vercel-env-matrix.test.d.ts +2 -0
- package/dist/__tests__/vercel-env-matrix.test.d.ts.map +1 -0
- package/dist/__tests__/vercel-env-matrix.test.js +56 -0
- package/dist/__tests__/vercel-env-matrix.test.js.map +1 -0
- package/dist/commands/db-init.d.ts +24 -0
- package/dist/commands/db-init.d.ts.map +1 -0
- package/dist/commands/db-init.js +195 -0
- package/dist/commands/db-init.js.map +1 -0
- package/dist/commands/db-status.d.ts +3 -0
- package/dist/commands/db-status.d.ts.map +1 -0
- package/dist/commands/db-status.js +108 -0
- package/dist/commands/db-status.js.map +1 -0
- package/dist/commands/db-sync.d.ts +66 -0
- package/dist/commands/db-sync.d.ts.map +1 -0
- package/dist/commands/db-sync.js +310 -0
- package/dist/commands/db-sync.js.map +1 -0
- package/dist/commands/doctor.d.ts +5 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +282 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/export.d.ts +3 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +99 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/generate.d.ts +3 -0
- package/dist/commands/generate.d.ts.map +1 -0
- package/dist/commands/generate.js +24 -0
- package/dist/commands/generate.js.map +1 -0
- package/dist/commands/import.d.ts +3 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +201 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/init.d.ts +4 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +31 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +3 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +126 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/migrate-media-usage.d.ts +3 -0
- package/dist/commands/migrate-media-usage.d.ts.map +1 -0
- package/dist/commands/migrate-media-usage.js +52 -0
- package/dist/commands/migrate-media-usage.js.map +1 -0
- package/dist/commands/migrate-meta.d.ts +3 -0
- package/dist/commands/migrate-meta.d.ts.map +1 -0
- package/dist/commands/migrate-meta.js +81 -0
- package/dist/commands/migrate-meta.js.map +1 -0
- package/dist/commands/migrate-schema.d.ts +3 -0
- package/dist/commands/migrate-schema.d.ts.map +1 -0
- package/dist/commands/migrate-schema.js +84 -0
- package/dist/commands/migrate-schema.js.map +1 -0
- package/dist/commands/migrate-sections.d.ts +3 -0
- package/dist/commands/migrate-sections.d.ts.map +1 -0
- package/dist/commands/migrate-sections.js +56 -0
- package/dist/commands/migrate-sections.js.map +1 -0
- package/dist/commands/migrate.d.ts +3 -0
- package/dist/commands/migrate.d.ts.map +1 -0
- package/dist/commands/migrate.js +51 -0
- package/dist/commands/migrate.js.map +1 -0
- package/dist/commands/seed.d.ts +60 -0
- package/dist/commands/seed.d.ts.map +1 -0
- package/dist/commands/seed.js +585 -0
- package/dist/commands/seed.js.map +1 -0
- package/dist/commands/update-check.d.ts +3 -0
- package/dist/commands/update-check.d.ts.map +1 -0
- package/dist/commands/update-check.js +132 -0
- package/dist/commands/update-check.js.map +1 -0
- package/dist/commands/upgrade.d.ts +4 -0
- package/dist/commands/upgrade.d.ts.map +1 -0
- package/dist/commands/upgrade.js +175 -0
- package/dist/commands/upgrade.js.map +1 -0
- package/dist/commands/vercel-blob-link.d.ts +3 -0
- package/dist/commands/vercel-blob-link.d.ts.map +1 -0
- package/dist/commands/vercel-blob-link.js +83 -0
- package/dist/commands/vercel-blob-link.js.map +1 -0
- package/dist/deployment/diagnostics.d.ts +136 -0
- package/dist/deployment/diagnostics.d.ts.map +1 -0
- package/dist/deployment/diagnostics.js +575 -0
- package/dist/deployment/diagnostics.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/utils/database.d.ts +21 -0
- package/dist/utils/database.d.ts.map +1 -0
- package/dist/utils/database.js +98 -0
- package/dist/utils/database.js.map +1 -0
- package/dist/utils/form-seed.d.ts +15 -0
- package/dist/utils/form-seed.d.ts.map +1 -0
- package/dist/utils/form-seed.js +97 -0
- package/dist/utils/form-seed.js.map +1 -0
- package/dist/utils/load-dotenv.d.ts +11 -0
- package/dist/utils/load-dotenv.d.ts.map +1 -0
- package/dist/utils/load-dotenv.js +47 -0
- package/dist/utils/load-dotenv.js.map +1 -0
- package/dist/utils/logger.d.ts +8 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +16 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/prisma-client-path.d.ts +20 -0
- package/dist/utils/prisma-client-path.d.ts.map +1 -0
- package/dist/utils/prisma-client-path.js +77 -0
- package/dist/utils/prisma-client-path.js.map +1 -0
- package/dist/vercel/client.d.ts +32 -0
- package/dist/vercel/client.d.ts.map +1 -0
- package/dist/vercel/client.js +74 -0
- package/dist/vercel/client.js.map +1 -0
- package/dist/vercel/env-matrix.d.ts +35 -0
- package/dist/vercel/env-matrix.d.ts.map +1 -0
- package/dist/vercel/env-matrix.js +66 -0
- package/dist/vercel/env-matrix.js.map +1 -0
- package/package.json +41 -0
- package/src/__tests__/db-init.test.ts +155 -0
- package/src/__tests__/db-sync-resolver.test.ts +29 -0
- package/src/__tests__/db-sync.test.ts +221 -0
- package/src/__tests__/deployment-diagnostics.test.ts +474 -0
- package/src/__tests__/form-seed.test.ts +91 -0
- package/src/__tests__/init.test.ts +30 -0
- package/src/__tests__/load-dotenv.test.ts +53 -0
- package/src/__tests__/mcp-init.test.ts +125 -0
- package/src/__tests__/prisma-client-path.test.ts +87 -0
- package/src/__tests__/schema-fragment.test.ts +51 -0
- package/src/__tests__/seed.test.ts +249 -0
- package/src/__tests__/upgrade.test.ts +44 -0
- package/src/__tests__/vercel-env-matrix.test.ts +65 -0
- package/src/commands/db-init.ts +211 -0
- package/src/commands/db-status.ts +122 -0
- package/src/commands/db-sync.ts +367 -0
- package/src/commands/doctor.ts +354 -0
- package/src/commands/export.ts +118 -0
- package/src/commands/generate.ts +26 -0
- package/src/commands/import.ts +228 -0
- package/src/commands/init.ts +36 -0
- package/src/commands/mcp.ts +181 -0
- package/src/commands/migrate-media-usage.ts +68 -0
- package/src/commands/migrate-meta.ts +107 -0
- package/src/commands/migrate-schema.ts +110 -0
- package/src/commands/migrate-sections.ts +73 -0
- package/src/commands/migrate.ts +56 -0
- package/src/commands/seed.ts +693 -0
- package/src/commands/update-check.ts +152 -0
- package/src/commands/upgrade.ts +202 -0
- package/src/commands/vercel-blob-link.ts +116 -0
- package/src/deployment/diagnostics.ts +735 -0
- package/src/index.ts +54 -0
- package/src/utils/database.ts +126 -0
- package/src/utils/form-seed.ts +137 -0
- package/src/utils/load-dotenv.ts +52 -0
- package/src/utils/logger.ts +26 -0
- package/src/utils/prisma-client-path.ts +81 -0
- package/src/vercel/client.ts +112 -0
- package/src/vercel/env-matrix.ts +112 -0
- package/tsconfig.json +9 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
# @actuate-media/cli
|
|
2
|
+
|
|
3
|
+
## 0.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 5eea995: Product rename: ActuateCMS is now **Prenta**. Every package moves from the
|
|
8
|
+
`@actuate-media/*` scope to `@prenta/*` with simplified names (`@prenta/core`,
|
|
9
|
+
`@prenta/admin`, `create-prenta`), and version numbers continue from where the
|
|
10
|
+
old scope left off.
|
|
11
|
+
|
|
12
|
+
This is a clean break — no backwards-compat aliases:
|
|
13
|
+
- **npm packages**: `@actuate-media/cms-core` → `@prenta/core`,
|
|
14
|
+
`@actuate-media/cms-admin` → `@prenta/admin`, all other packages keep their
|
|
15
|
+
suffix under `@prenta/*`. `create-actuate-cms` → `create-prenta`
|
|
16
|
+
(`npm create prenta`), `create-actuate-astro` → `create-prenta-astro`.
|
|
17
|
+
CLI bins: `actuate`/`actuate-cms` → `prenta`/`prenta-cms`; `actuate-mcp` →
|
|
18
|
+
`prenta-mcp`.
|
|
19
|
+
- **Database**: migration `0012_rename_to_prenta` renames all 36 `actuate_*`
|
|
20
|
+
tables to `prenta_*` in place (plus prefixed constraints, indexes, and
|
|
21
|
+
sequences). Run `prisma migrate deploy` when upgrading.
|
|
22
|
+
- **Runtime identifiers**: `getActuateConfig` → `getPrentaConfig`,
|
|
23
|
+
`handleActuateAPI` → `handlePrentaAPI`, `ActuateClient` → `PrentaClient`,
|
|
24
|
+
`ActuateDB` → `PrentaDB`, config file `actuate.config.ts` →
|
|
25
|
+
`prenta.config.ts`, CSS scopes `.actuate-admin`/`.actuate-canvas` →
|
|
26
|
+
`.prenta-admin`/`.prenta-canvas`, preview protocol `actuate-preview:*` →
|
|
27
|
+
`prenta-preview:*`, webhook headers `X-Actuate-*` → `X-Prenta-*`, session
|
|
28
|
+
cookie `actuate_session` → `prenta_session`, env vars `ACTUATE_*` →
|
|
29
|
+
`PRENTA_*`, purge route `/api/actuate/purge` → `/api/prenta/purge`.
|
|
30
|
+
- **Sessions and webhooks**: all sessions reset on upgrade (cookie + JWT issuer
|
|
31
|
+
changed); webhook consumers must re-verify signatures against the new
|
|
32
|
+
`X-Prenta-*` headers.
|
|
33
|
+
|
|
34
|
+
The old `@actuate-media/*` packages are deprecated on npm and will receive no
|
|
35
|
+
further releases.
|
|
36
|
+
|
|
37
|
+
## 0.13.2
|
|
38
|
+
|
|
39
|
+
### Patch Changes
|
|
40
|
+
|
|
41
|
+
- fb89234: `actuate doctor` detects Astro split-deploy projects (`site/astro.config.*`, `createAstroSiteHelpers`) and adjusts SEO / ISR checks so missing Next public catch-all routes are not false warnings.
|
|
42
|
+
|
|
43
|
+
## 0.13.1
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- 7868819: Fix two CLI bugs found during the 0.91.x releases:
|
|
48
|
+
- **`actuate db:sync` failed out of the box** — the schema resolver trusted the
|
|
49
|
+
directory of the `./prisma/schema` export, which now points at an IDE
|
|
50
|
+
validation _fragment_ (`schema-fragments/cms-schema.prisma`) whose folder has
|
|
51
|
+
no `schema.prisma`. It now picks the first candidate directory that actually
|
|
52
|
+
contains `schema.prisma` (the package's `prisma/`), so it no longer errors with
|
|
53
|
+
"cms-core does not ship a Prisma schema at …schema-fragments".
|
|
54
|
+
- **`actuate upgrade` hung indefinitely with no output** (notably on Windows) —
|
|
55
|
+
the version-lookup `fetch` calls had no timeout, so a connection that's
|
|
56
|
+
accepted but never answered (stateful firewall / VPN) hung the command
|
|
57
|
+
forever. All network calls now use an 8s abort timeout and fall through
|
|
58
|
+
gracefully; if no version can be resolved, it fails fast with an actionable
|
|
59
|
+
error instead of hanging or falsely reporting "up to date".
|
|
60
|
+
|
|
61
|
+
## 0.13.0
|
|
62
|
+
|
|
63
|
+
### Minor Changes
|
|
64
|
+
|
|
65
|
+
- b53b4a4: Sync `MediaUsage` join rows on every document create, update, delete, duplicate, and global write. Scans document JSON for media field IDs and image URLs in rich-text HTML so the media library "Used on" drawer stays accurate. Adds `backfillMediaUsage()` export and `actuate migrate:media-usage` for existing content.
|
|
66
|
+
|
|
67
|
+
### Patch Changes
|
|
68
|
+
|
|
69
|
+
- 041a228: Add the MIT `license` field to every published package (previously missing) and correct `repository.url` to `github.com/actuate-media/actuatecms` (13 packages carried the wrong org).
|
|
70
|
+
|
|
71
|
+
## 0.12.4
|
|
72
|
+
|
|
73
|
+
### Patch Changes
|
|
74
|
+
|
|
75
|
+
- 1a3cf91: Agent-ready public forms (WebMCP): declarative tool metadata on public form schemas, zero-JS `renderPublicFormHtml` / `ActuateFormHtml`, urlencoded submit parsing, HTML confirmation responses, scaffold form prefetch, `actuate doctor` check, and docs.
|
|
76
|
+
|
|
77
|
+
## 0.12.3
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- a6360cc: Forms launch kit (Batch 7): Integrations tab with Zapier Catch Hook helper and webhook CRUD in the form schema drawer; marketing seed contact form + /contact page; ActuateForm success focus; actuate doctor forms/CRM checks; forms-and-integrations docs.
|
|
82
|
+
|
|
83
|
+
## 0.12.2
|
|
84
|
+
|
|
85
|
+
### Patch Changes
|
|
86
|
+
|
|
87
|
+
- a59a501: Batch 6 site performance and SEO: path-scoped ISR cache tags in createNextSiteHelpers, scaffold CMS API cache wiring with onInvalidate, JSON-LD in the catch-all, font preload template, and doctor checks for API cache and structured data HTML.
|
|
88
|
+
- e1ad198: Platform site-launch defaults: export `createNextSiteHelpers()` from `@actuate-media/cms-core/next/site` for ISR-friendly cached `/resolve`, scaffold new projects with production plugins and cached catch-all pages, and extend `actuate doctor` with site-launch checks (plugins, SEO routes, cached resolve, SSR sections).
|
|
89
|
+
|
|
90
|
+
## 0.12.1
|
|
91
|
+
|
|
92
|
+
### Patch Changes
|
|
93
|
+
|
|
94
|
+
- 13aae89: Fix CLI database connection for Prisma 7 projects: resolve custom generator output paths from schema.prisma, prefer lib/prisma.ts getPrisma(), and handle Windows paths for migrate:meta and migrate:schema.
|
|
95
|
+
|
|
96
|
+
## 0.12.0
|
|
97
|
+
|
|
98
|
+
### Minor Changes
|
|
99
|
+
|
|
100
|
+
- bc51a1d: Align SEO audit with live page meta output, expand audit checks, wire redirect/link signals, and add `actuate migrate:meta` for bulk meta backfill.
|
|
101
|
+
|
|
102
|
+
## 0.11.3
|
|
103
|
+
|
|
104
|
+
### Patch Changes
|
|
105
|
+
|
|
106
|
+
- 9d4e24c: Hide the redundant site name headline on the login screen and in the admin sidebar when a logo image is displayed.
|
|
107
|
+
|
|
108
|
+
Serve favicons as properly sized 32×32 PNGs (and 180×180 apple-touch icons) from dedicated public routes so SVG and oversized sources render correctly in browser tabs.
|
|
109
|
+
|
|
110
|
+
Align SEO audit schema/canonical detection with public page rendering, add `actuate migrate:schema` to backfill structuredDataType on existing content, and fix route-contract tests for new favicon endpoints.
|
|
111
|
+
|
|
112
|
+
## 0.11.2
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- 7a6a140: Support Vercel Marketplace Blob auth via OIDC (`BLOB_STORE_ID` + `VERCEL_OIDC_TOKEN`) instead of requiring `BLOB_READ_WRITE_TOKEN`. Fix `@vercel/blob` client options to use `oidcToken` + `storeId` (never pass OIDC as `token`). Update env diagnostics, upload errors, and `actuate vercel:blob-link` accordingly.
|
|
117
|
+
|
|
118
|
+
## 0.11.1
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- 4899af9: Fix consumer production builds on Next.js 16 by not injecting a no-op webpack hook in `withActuateCMS`. Add `CRON_SECRET` to scaffold `.env.example`. Remove obsolete `earlyAccess` from scaffolded `prisma.config.ts`. Load project `.env` files in `actuate doctor` and `actuate deploy:check`.
|
|
123
|
+
|
|
124
|
+
## 0.11.0
|
|
125
|
+
|
|
126
|
+
### Minor Changes
|
|
127
|
+
|
|
128
|
+
- eb998e5: New `actuate mcp:init` command — retrofit the Actuate MCP server onto existing projects.
|
|
129
|
+
|
|
130
|
+
Writes `.cursor/mcp.json` (Cursor / Claude Desktop shape) and `.vscode/mcp.json` (VS Code shape) wiring `@actuate-media/mcp-server`, with `--url` / `--key` options. Merges into existing configs without clobbering other MCP servers; an existing `actuate` entry is only replaced with `--force`. Both paths are appended to `.gitignore` so a real `act_sk_...` key is never committed. New scaffolds already get these files from `create-actuate-cms` — this closes the gap for projects created before that.
|
|
131
|
+
|
|
132
|
+
## 0.10.0
|
|
133
|
+
|
|
134
|
+
### Minor Changes
|
|
135
|
+
|
|
136
|
+
- 232e251: New `actuate seed --upsert` (also on `populate`): documents are matched by collection + slug and updated in place instead of inserting duplicates, making seed files safe to re-run as content evolves. Every update records a version snapshot; `publishedAt` is only stamped on the transition into PUBLISHED; documents without a slug always insert. The summary line reports created vs updated counts.
|
|
137
|
+
|
|
138
|
+
## 0.9.0
|
|
139
|
+
|
|
140
|
+
### Minor Changes
|
|
141
|
+
|
|
142
|
+
- be9b5ff: `actuate seed` now validates `forms`-collection entries before writing anything, with actionable per-form errors. The most common mistake — putting the document envelope status (`PUBLISHED`) in `data.status` instead of the form's own lifecycle status (`active` / `draft` / `archived`, which gates the public endpoints) — gets a targeted explanation, as do fields using `name` instead of `key`/`label` and unknown field types. The `--demo` forms were rewritten to the canonical shape (they previously seeded fields without `key`/`label` and no `data.status`, so `/api/cms/public/forms/:slug` 404'd on them).
|
|
143
|
+
|
|
144
|
+
### Patch Changes
|
|
145
|
+
|
|
146
|
+
- 854152d: Developer experience improvements from external-consumer feedback:
|
|
147
|
+
- Every published package now ships its `CHANGELOG.md` in the npm tarball, and packages that were missing a `README.md` (cli, cms-admin, cms-core, import, platform-vercel, all plugins, sections-react) now have one — so release notes and usage docs are visible on npmjs.com and in `node_modules`.
|
|
148
|
+
- New client-safe form validation entry point: `@actuate-media/cms-core/forms/client` exports `validateFormFieldClient()`, `validateFormValuesClient()`, visibility/conditional helpers, and the exact `FORM_EMAIL_RE` / `FORM_PHONE_RE` regexes the server enforces — zero Node dependencies, so public-site forms can mirror server rules without reimplementing them. The server validator now imports the same primitives, so client and server can never drift.
|
|
149
|
+
|
|
150
|
+
## 0.8.0
|
|
151
|
+
|
|
152
|
+
### Minor Changes
|
|
153
|
+
|
|
154
|
+
- 74662c0: Add Vercel-backed deployment diagnostics and database drift detection.
|
|
155
|
+
- New `actuate vercel:blob-link` command validates the linked Vercel project's Blob connection via the Vercel API and fails when a store is connected but `BLOB_READ_WRITE_TOKEN` is missing for Production/Preview (warns for Development).
|
|
156
|
+
- `actuate deploy:check --vercel` prints a per-environment (Production/Preview/Development) matrix of required and optional variables, failing on any required var missing from Production or Preview. `CRON_SECRET` and the Blob vars are now part of the known set.
|
|
157
|
+
- `actuate doctor`/`deploy:check` now fail (rather than warn) on a partial Blob link detected offline.
|
|
158
|
+
- `actuate db:sync` runs a post-sync `prisma migrate diff` drift check and prints the exact reconciling commands when the database differs from the canonical schema (opt out with `--no-check-drift`).
|
|
159
|
+
|
|
160
|
+
## 0.7.0
|
|
161
|
+
|
|
162
|
+
### Minor Changes
|
|
163
|
+
|
|
164
|
+
- aa4bd1a: Unify the page content model at write time (ADR 0002). Visual Page-Builder pages now compile their `_layout` tree to the canonical `data.sections[]` on every save, so every reader (SDK, MCP, search, content graph, `/resolve`) sees one contract instead of the lazy read-time bridge.
|
|
165
|
+
- **cms-core**: `createDocument`/`updateDocument` derive `sections` from a `layout` envelope; the `/page-sections/*` write routes refuse a builder-owned page (one with `_layout`) with HTTP 409 to prevent silently-overwritten edits; the `/resolve` bridge is now a legacy fallback for un-migrated pages. New `migratePageBuilderSections()` export backfills legacy pages (idempotent).
|
|
166
|
+
- **cms-admin**: the flat Page Editor opens a builder-owned page read-only with an "Open in Page Builder" action; `EditorPage` gains a `builderOwned` flag.
|
|
167
|
+
- **cli**: new `actuate migrate:sections` command (with `--dry-run` / `--batch-size`) to backfill canonical sections for legacy page-builder documents.
|
|
168
|
+
|
|
169
|
+
## 0.6.0
|
|
170
|
+
|
|
171
|
+
### Minor Changes
|
|
172
|
+
|
|
173
|
+
- 31224ae: WS-E (E4 follow-up): seed demo navigation menus and render a footer nav so
|
|
174
|
+
navigation works end-to-end on a fresh scaffold.
|
|
175
|
+
- **cli:** `actuate seed --demo` now seeds two `navigations` documents — a
|
|
176
|
+
`main` menu (location `header`, linking Home/About/Contact) and a `footer`
|
|
177
|
+
menu (location `footer`, linking Privacy/Terms) — so the shipped `<SiteNav>`
|
|
178
|
+
renders real links out of the box instead of an empty header. Items point at
|
|
179
|
+
the demo pages by public URL.
|
|
180
|
+
- **create-actuate-cms:** the generated site layout now also fetches the
|
|
181
|
+
`footer` menu and renders it in a semantic `<footer>` (with a copyright line),
|
|
182
|
+
alongside the existing header nav. The body is a flex column so the footer
|
|
183
|
+
sits at the bottom. Both navs still degrade gracefully when no menu exists.
|
|
184
|
+
|
|
185
|
+
## 0.5.0
|
|
186
|
+
|
|
187
|
+
### Minor Changes
|
|
188
|
+
|
|
189
|
+
- 6927e4b: `actuate db:init` now injects the canonical Prisma schema (WS-D D5).
|
|
190
|
+
|
|
191
|
+
The command previously appended a hand-maintained schema fragment that had
|
|
192
|
+
drifted from `cms-core`: it was missing `@@map("actuate_*")` table names (so the
|
|
193
|
+
runtime's raw SQL couldn't find the tables) and many models. `db:init` now reads
|
|
194
|
+
the canonical `prisma/schema.prisma` shipped by the installed
|
|
195
|
+
`@actuate-media/cms-core` package, strips its `datasource`/`generator` blocks,
|
|
196
|
+
and injects the up-to-date `enum`/`model` definitions — keeping the consumer's
|
|
197
|
+
own datasource/generator. If `cms-core` can't be located, the command fails
|
|
198
|
+
cleanly instead of writing a broken schema. The injected block stays idempotent
|
|
199
|
+
(re-run with `--force` after upgrading cms-core to refresh).
|
|
200
|
+
|
|
201
|
+
- e743e03: Add `actuate db:sync` for post-upgrade Prisma schema sync (WS-D D2).
|
|
202
|
+
|
|
203
|
+
`actuate upgrade` previously only bumped `@actuate-media/*` versions in
|
|
204
|
+
`package.json`, leaving the consumer's `prisma/schema.prisma` and migrations
|
|
205
|
+
stale — so a newer `cms-core` would run against an out-of-date database schema.
|
|
206
|
+
|
|
207
|
+
The new `db:sync` command reads the canonical schema + migrations from the
|
|
208
|
+
installed `@actuate-media/cms-core`, rebuilds `prisma/schema.prisma` (consumer
|
|
209
|
+
header + every `@@map`ped model), and **additively** copies any migrations the
|
|
210
|
+
project is missing (never deleting existing, immutable history). It refuses to
|
|
211
|
+
overwrite a hand-customized schema (one without the `AUTO-SYNCED` marker) unless
|
|
212
|
+
`--force` is passed. `actuate upgrade` now points users at `db:sync` +
|
|
213
|
+
`prisma migrate deploy` whenever `cms-core` is bumped.
|
|
214
|
+
|
|
215
|
+
## 0.4.2
|
|
216
|
+
|
|
217
|
+
### Patch Changes
|
|
218
|
+
|
|
219
|
+
- 7d11b8d: Production-ready Settings → Updates tab with real release intelligence.
|
|
220
|
+
- **cms-core**: Fix a critical permission bug where `GET/PUT /updates/config` and
|
|
221
|
+
`POST /updates/apply` rejected real admins (they compared `session.role` to the
|
|
222
|
+
lowercase `'admin'` while roles are stored uppercase). They now use
|
|
223
|
+
`requireAdminScope`, so OWNER/ADMIN sessions (and admin-scoped API keys) can
|
|
224
|
+
manage updates. `GET /updates/check` no longer leaks the GitHub repo to
|
|
225
|
+
non-admins and reports a `canManage` flag. Update checks now run through a new
|
|
226
|
+
hybrid resolver `getUpdateStatus()` that queries the Actuate update server
|
|
227
|
+
first (rich, real changelog/severity/migration/breaking-change data derived
|
|
228
|
+
from the published CHANGELOG) and transparently falls back to a direct npm
|
|
229
|
+
registry check. New exports: `getUpdateStatus`, `checkForUpdatesViaServer`, and
|
|
230
|
+
the `ChangeType` / `ChangelogItem` / `PluginCompatibilityInfo` types; richer
|
|
231
|
+
`VersionInfo`. `fetchChangelog()` now targets the real `/api/changelog`
|
|
232
|
+
endpoint (overridable via `ACTUATE_UPDATE_SERVER_URL`).
|
|
233
|
+
- **cms-admin**: Rebuild the Updates tab as a dedicated `UpdatesTab` + `useUpdates`
|
|
234
|
+
hook (extracted from `Settings.tsx`). The GitHub integration now uses the shared
|
|
235
|
+
`SettingsControlRow` + sticky `SettingsSaveBar` dirty-state pattern, and the tab
|
|
236
|
+
surfaces real release notes (categorized changelog), a security-update badge,
|
|
237
|
+
"migrations required" and breaking-change callouts, and plugin compatibility.
|
|
238
|
+
Write actions are permission-aware (hidden for non-admins).
|
|
239
|
+
- **cli**: `update-check` / `upgrade` now resolve the update-server base URL from
|
|
240
|
+
`ACTUATE_UPDATE_SERVER_URL` (defaulting to the production host), so the
|
|
241
|
+
`/api/versions` endpoint is configurable for self-hosted update servers.
|
|
242
|
+
|
|
243
|
+
## 0.4.1
|
|
244
|
+
|
|
245
|
+
### Patch Changes
|
|
246
|
+
|
|
247
|
+
- 58bf2e6: Warn during deployment diagnostics when designed marketing pages appear to be modeled as flat fields instead of page-builder content.
|
|
248
|
+
|
|
249
|
+
## 0.4.0
|
|
250
|
+
|
|
251
|
+
### Minor Changes
|
|
252
|
+
|
|
253
|
+
- e2fabee: Add AI-friendly deployment diagnostics, align generated schemas with first-run admin features, and harden setup guidance for design-first deployments.
|
|
254
|
+
|
|
255
|
+
## 0.3.1
|
|
256
|
+
|
|
257
|
+
### Patch Changes
|
|
258
|
+
|
|
259
|
+
- b224105: Fix post-release developer experience regressions in public site globals, scaffolded Prisma wiring, and seed/populate database initialization.
|
|
260
|
+
|
|
261
|
+
## 0.3.0
|
|
262
|
+
|
|
263
|
+
### Minor Changes
|
|
264
|
+
|
|
265
|
+
- 266b657: Add first-class public site helpers, CLI init/populate workflows, and generated frontend boilerplate for globals, document resolution, and media normalization.
|
|
266
|
+
|
|
267
|
+
## 0.2.5
|
|
268
|
+
|
|
269
|
+
### Patch Changes
|
|
270
|
+
|
|
271
|
+
- b5de8dd: Fix ESM module resolution and dependency duplication issues reported during consumer integration.
|
|
272
|
+
- Add "default" export condition to all platform and plugin packages so they resolve correctly from require() contexts (fixes ERR_PACKAGE_PATH_NOT_EXPORTED in next.config.ts and serverless functions).
|
|
273
|
+
- Move @actuate-media/cms-core from direct dependencies to peerDependencies across all packages to prevent duplicate installations when consumer version ranges don't exactly match the pinned version.
|
|
274
|
+
- Add "prepack" lifecycle script to create-actuate-cms to guarantee dist/ is built before npm publishes the package (fixes empty dist/ in v0.4.0).
|
|
275
|
+
|
|
276
|
+
## 0.2.4
|
|
277
|
+
|
|
278
|
+
### Patch Changes
|
|
279
|
+
|
|
280
|
+
- Updated dependencies [54c7a3b]
|
|
281
|
+
- @actuate-media/cms-core@0.6.0
|
|
282
|
+
|
|
283
|
+
## 0.2.3
|
|
284
|
+
|
|
285
|
+
### Patch Changes
|
|
286
|
+
|
|
287
|
+
- Updated dependencies [c08cf8b]
|
|
288
|
+
- Updated dependencies [80aa939]
|
|
289
|
+
- @actuate-media/cms-core@0.5.0
|
|
290
|
+
|
|
291
|
+
## 0.2.2
|
|
292
|
+
|
|
293
|
+
### Patch Changes
|
|
294
|
+
|
|
295
|
+
- Updated dependencies [f2cf7d7]
|
|
296
|
+
- @actuate-media/cms-core@0.4.0
|
|
297
|
+
|
|
298
|
+
## 0.2.1
|
|
299
|
+
|
|
300
|
+
### Patch Changes
|
|
301
|
+
|
|
302
|
+
- Updated dependencies [0621037]
|
|
303
|
+
- @actuate-media/cms-core@0.3.1
|
|
304
|
+
|
|
305
|
+
## 0.2.0
|
|
306
|
+
|
|
307
|
+
### Minor Changes
|
|
308
|
+
|
|
309
|
+
- 4e3a5eb: RC2-RC4 and hardening release.
|
|
310
|
+
|
|
311
|
+
**cms-core:**
|
|
312
|
+
- Replace isomorphic-dompurify with sanitize-html (eliminates Vercel ESM crash)
|
|
313
|
+
- Remove cms-core from serverExternalPackages, move to transpilePackages
|
|
314
|
+
- Add GET /api/cms/health endpoint with model probing and diagnostics
|
|
315
|
+
- Harden db() Proxy with try/catch on property access and rawDb()
|
|
316
|
+
- Harden safeCount/safeFindMany against Proxy throws
|
|
317
|
+
- Add startup validation for missing CMS_SECRET (503 instead of 500)
|
|
318
|
+
- Bypass auth on /stats when secret is missing (returns zero-data)
|
|
319
|
+
- Loosen NextConfigLike types (experimental/images/webpack as unknown)
|
|
320
|
+
- Implement login anomaly detection (new IP, brute force, unusual hours)
|
|
321
|
+
- Implement webhook DNS resolution with private range checking
|
|
322
|
+
- Implement TOTP reauth verification
|
|
323
|
+
- Add Zod validation for secret in defineConfig (min 32 chars)
|
|
324
|
+
- Read CMS_CORE_VERSION from package.json at runtime instead of hardcoding '0.1.0'
|
|
325
|
+
|
|
326
|
+
**cms-admin:**
|
|
327
|
+
- Ship pre-compiled CSS (dist/actuate-admin.css) with all 48 responsive classes
|
|
328
|
+
- New export: @actuate-media/cms-admin/styles/precompiled.css
|
|
329
|
+
- Add CSS containment (`contain: layout style`) on .actuate-admin
|
|
330
|
+
- Fix ShortcutHelp modal using React state instead of DOM manipulation
|
|
331
|
+
- Add fixed-position layout isolation wrapper to AdminRoot
|
|
332
|
+
- Add useApiData retry limits (maxRetries=3) with exponential backoff
|
|
333
|
+
- Dashboard shows health-aware "Database Setup Required" banner
|
|
334
|
+
|
|
335
|
+
**cli:**
|
|
336
|
+
- Add `actuate db:init` command (injects CMS models into Prisma schema)
|
|
337
|
+
- Add `actuate db:status` command (checks model presence and DB connectivity)
|
|
338
|
+
|
|
339
|
+
**create-actuate-cms:**
|
|
340
|
+
- Embed full CMS schema (9 models + enum) in generated schema.prisma
|
|
341
|
+
- Add @actuate-media/cli to scaffolded devDependencies
|
|
342
|
+
- Use pre-compiled CSS import in scaffolded admin layout
|
|
343
|
+
|
|
344
|
+
### Patch Changes
|
|
345
|
+
|
|
346
|
+
- Updated dependencies [4e3a5eb]
|
|
347
|
+
- @actuate-media/cms-core@0.3.0
|
|
348
|
+
|
|
349
|
+
## 0.1.4
|
|
350
|
+
|
|
351
|
+
### Patch Changes
|
|
352
|
+
|
|
353
|
+
- Updated dependencies
|
|
354
|
+
- @actuate-media/cms-core@0.2.3
|
|
355
|
+
|
|
356
|
+
## 0.1.3
|
|
357
|
+
|
|
358
|
+
### Patch Changes
|
|
359
|
+
|
|
360
|
+
- Updated dependencies
|
|
361
|
+
- @actuate-media/cms-core@0.2.2
|
|
362
|
+
|
|
363
|
+
## 0.1.2
|
|
364
|
+
|
|
365
|
+
### Patch Changes
|
|
366
|
+
|
|
367
|
+
- Updated dependencies
|
|
368
|
+
- @actuate-media/cms-core@0.2.1
|
|
369
|
+
|
|
370
|
+
## 0.1.1
|
|
371
|
+
|
|
372
|
+
### Patch Changes
|
|
373
|
+
|
|
374
|
+
- 3fd38a2: Fix all 13 integration issues discovered during MaidPro.co deployment
|
|
375
|
+
|
|
376
|
+
**cms-core:**
|
|
377
|
+
- Add .js extensions to all ESM relative imports (58 files)
|
|
378
|
+
- Replace workspace:\* with versioned deps in all packages
|
|
379
|
+
- Add sideEffects:false for proper tree-shaking
|
|
380
|
+
- Subpath exports (/config, /api, /middleware, /next) avoid barrel side effects
|
|
381
|
+
- Stats/search routes use safeCount/safeFindMany for missing Prisma models
|
|
382
|
+
- Ship prisma/cms-schema.prisma with all required CMS models
|
|
383
|
+
- Accept both CMS_SECRET and CMS_SESSION_SECRET with clear error messages
|
|
384
|
+
- Fix hardcoded /admin paths in OAuth flow (now uses getAdminPath())
|
|
385
|
+
- Loosen withActuateCMS and createCMSMiddleware parameter types
|
|
386
|
+
- Auto-inject transpilePackages and serverExternalPackages in withActuateCMS
|
|
387
|
+
- Unify PluginDefinition with ActuatePlugin interface
|
|
388
|
+
|
|
389
|
+
**cms-admin:**
|
|
390
|
+
- Scope all 40+ CSS theme variables to .actuate-admin instead of :root
|
|
391
|
+
- ThemeProvider applies dark class to .actuate-admin, not document.documentElement
|
|
392
|
+
- Scaffold uses (admin)/(site) route groups for full CSS/script isolation
|
|
393
|
+
- Sidebar branding supports custom logo via config.admin.branding
|
|
394
|
+
|
|
395
|
+
**platform-vercel:**
|
|
396
|
+
- Email adapter accepts both `from` and `defaultFrom`
|
|
397
|
+
|
|
398
|
+
**All plugin/platform packages:**
|
|
399
|
+
- Fix ESM .js extensions in compiled output
|
|
400
|
+
- Replace workspace:\* with ^0.1.0 for publishable deps
|
|
401
|
+
|
|
402
|
+
- Updated dependencies [682dac7]
|
|
403
|
+
- Updated dependencies [3fd38a2]
|
|
404
|
+
- @actuate-media/cms-core@0.2.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Actuate Media
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @prenta/cli
|
|
2
|
+
|
|
3
|
+
CLI for [Prenta CMS](https://github.com/actuate-media/prenta) —
|
|
4
|
+
migrations, codegen, seeding, imports/exports, verification, and upgrades.
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
npm install -D @prenta/cli
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Common commands
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
prenta migrate # apply Prisma migrations
|
|
14
|
+
prenta seed # seed content from seed scripts
|
|
15
|
+
prenta codegen # generate typed client from prenta.config.ts
|
|
16
|
+
prenta verify # check config, sections, and environment
|
|
17
|
+
prenta verify:cms-sections # editor ↔ frontend section contract check
|
|
18
|
+
prenta update # check for / apply CMS package updates
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Run `prenta --help` for the full command list.
|
|
22
|
+
|
|
23
|
+
## Release notes
|
|
24
|
+
|
|
25
|
+
See [CHANGELOG.md](./CHANGELOG.md) (shipped with the package) or the
|
|
26
|
+
[GitHub releases](https://github.com/actuate-media/prenta/releases).
|
|
27
|
+
|
|
28
|
+
## License
|
|
29
|
+
|
|
30
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-init.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/db-init.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { mkdtemp, readFile, rm, writeFile } from 'node:fs/promises';
|
|
3
|
+
import { tmpdir } from 'node:os';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
6
|
+
import { extractModelsFragment, registerDbInitCommand, resetCanonicalSchemaReader, resetDbInitCommandRunner, setCanonicalSchemaReader, setDbInitCommandRunner, } from '../commands/db-init.js';
|
|
7
|
+
const FULL_SCHEMA = `generator client {
|
|
8
|
+
provider = "prisma-client"
|
|
9
|
+
output = "../generated"
|
|
10
|
+
previewFeatures = ["relationJoins"]
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
datasource db {
|
|
14
|
+
provider = "postgresql"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
enum DocumentStatus {
|
|
18
|
+
DRAFT
|
|
19
|
+
PUBLISHED
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
model Document {
|
|
23
|
+
id String @id @default(cuid())
|
|
24
|
+
collection String
|
|
25
|
+
status DocumentStatus @default(DRAFT)
|
|
26
|
+
|
|
27
|
+
@@index([collection])
|
|
28
|
+
@@map("prenta_documents")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
model User {
|
|
32
|
+
id String @id @default(cuid())
|
|
33
|
+
email String @unique
|
|
34
|
+
|
|
35
|
+
@@map("prenta_users")
|
|
36
|
+
}
|
|
37
|
+
`;
|
|
38
|
+
function consumerSchema() {
|
|
39
|
+
return `generator client {
|
|
40
|
+
provider = "prisma-client-js"
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
datasource db {
|
|
44
|
+
provider = "postgresql"
|
|
45
|
+
url = env("DATABASE_URL")
|
|
46
|
+
}
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
describe('db:init (WS-D D5 — canonical schema, no stale fragment)', () => {
|
|
50
|
+
afterEach(() => {
|
|
51
|
+
resetDbInitCommandRunner();
|
|
52
|
+
resetCanonicalSchemaReader();
|
|
53
|
+
vi.restoreAllMocks();
|
|
54
|
+
});
|
|
55
|
+
describe('extractModelsFragment', () => {
|
|
56
|
+
it('strips generator and datasource blocks but keeps enums + models', () => {
|
|
57
|
+
const fragment = extractModelsFragment(FULL_SCHEMA);
|
|
58
|
+
expect(fragment).not.toMatch(/generator\s+\w+\s*\{/);
|
|
59
|
+
expect(fragment).not.toMatch(/datasource\s+\w+\s*\{/);
|
|
60
|
+
expect(fragment).toContain('enum DocumentStatus');
|
|
61
|
+
expect(fragment).toContain('model Document');
|
|
62
|
+
expect(fragment).toContain('model User');
|
|
63
|
+
// The whole point of D5: real @@map names survive.
|
|
64
|
+
expect(fragment).toContain('@@map("prenta_documents")');
|
|
65
|
+
expect(fragment).toContain('@@map("prenta_users")');
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
describe('command', () => {
|
|
69
|
+
it('injects canonical models with @@map and no duplicate datasource/generator', async () => {
|
|
70
|
+
const tempRoot = await mkdtemp(path.join(tmpdir(), 'prenta-db-init-d5-'));
|
|
71
|
+
const schemaPath = path.join(tempRoot, 'schema.prisma');
|
|
72
|
+
await writeFile(schemaPath, consumerSchema());
|
|
73
|
+
vi.spyOn(process, 'cwd').mockReturnValue(tempRoot);
|
|
74
|
+
setDbInitCommandRunner(() => undefined);
|
|
75
|
+
setCanonicalSchemaReader(async () => FULL_SCHEMA);
|
|
76
|
+
const command = new Command();
|
|
77
|
+
registerDbInitCommand(command);
|
|
78
|
+
await command.parseAsync(['node', 'prenta', 'db:init', '--schema', 'schema.prisma']);
|
|
79
|
+
const result = await readFile(schemaPath, 'utf-8');
|
|
80
|
+
const injected = result.slice(result.indexOf('// ── Prenta CMS models'));
|
|
81
|
+
// The consumer keeps exactly one datasource/generator (their own).
|
|
82
|
+
expect(result.match(/datasource\s+\w+\s*\{/g)).toHaveLength(1);
|
|
83
|
+
expect(result.match(/generator\s+\w+\s*\{/g)).toHaveLength(1);
|
|
84
|
+
// Injected portion carries the canonical mapped models.
|
|
85
|
+
expect(injected).toContain('@@map("prenta_documents")');
|
|
86
|
+
expect(injected).toContain('model Document');
|
|
87
|
+
expect(injected).not.toMatch(/datasource\s+\w+\s*\{/);
|
|
88
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
89
|
+
});
|
|
90
|
+
it('fails clearly when cms-core cannot be located', async () => {
|
|
91
|
+
const tempRoot = await mkdtemp(path.join(tmpdir(), 'prenta-db-init-missing-'));
|
|
92
|
+
const schemaPath = path.join(tempRoot, 'schema.prisma');
|
|
93
|
+
await writeFile(schemaPath, consumerSchema());
|
|
94
|
+
vi.spyOn(process, 'cwd').mockReturnValue(tempRoot);
|
|
95
|
+
setDbInitCommandRunner(() => undefined);
|
|
96
|
+
setCanonicalSchemaReader(async () => null);
|
|
97
|
+
const command = new Command();
|
|
98
|
+
registerDbInitCommand(command);
|
|
99
|
+
await command.parseAsync(['node', 'prenta', 'db:init', '--schema', 'schema.prisma']);
|
|
100
|
+
// Schema must be left untouched (no stale fragment written).
|
|
101
|
+
const result = await readFile(schemaPath, 'utf-8');
|
|
102
|
+
expect(result).toBe(consumerSchema());
|
|
103
|
+
expect(process.exitCode).toBe(1);
|
|
104
|
+
process.exitCode = 0;
|
|
105
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
106
|
+
});
|
|
107
|
+
it('is idempotent without --force', async () => {
|
|
108
|
+
const tempRoot = await mkdtemp(path.join(tmpdir(), 'prenta-db-init-idem-'));
|
|
109
|
+
const schemaPath = path.join(tempRoot, 'schema.prisma');
|
|
110
|
+
await writeFile(schemaPath, consumerSchema());
|
|
111
|
+
vi.spyOn(process, 'cwd').mockReturnValue(tempRoot);
|
|
112
|
+
setDbInitCommandRunner(() => undefined);
|
|
113
|
+
setCanonicalSchemaReader(async () => FULL_SCHEMA);
|
|
114
|
+
const command1 = new Command();
|
|
115
|
+
registerDbInitCommand(command1);
|
|
116
|
+
await command1.parseAsync(['node', 'prenta', 'db:init', '--schema', 'schema.prisma']);
|
|
117
|
+
const first = await readFile(schemaPath, 'utf-8');
|
|
118
|
+
const command2 = new Command();
|
|
119
|
+
registerDbInitCommand(command2);
|
|
120
|
+
await command2.parseAsync(['node', 'prenta', 'db:init', '--schema', 'schema.prisma']);
|
|
121
|
+
const second = await readFile(schemaPath, 'utf-8');
|
|
122
|
+
expect(second).toBe(first);
|
|
123
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=db-init.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-init.test.js","sourceRoot":"","sources":["../../src/__tests__/db-init.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,OA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9B,qBAAqB,CAAC,QAAQ,CAAC,CAAA;YAC/B,MAAM,QAAQ,CAAC,UAAU,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,eAAe,CAAC,CAAC,CAAA;YACrF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;YAElD,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YAE1B,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAA;QACtD,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-sync-resolver.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/db-sync-resolver.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
|
+
import { pickPrismaDir } from '../commands/db-sync.js';
|
|
3
|
+
// Regression for the db:sync schema-resolution bug: the `./prisma/schema` export
|
|
4
|
+
// points at `schema-fragments/cms-schema.prisma` (an IDE-validation fragment),
|
|
5
|
+
// whose directory has NO `schema.prisma`. resolveCmsCorePrismaDir must skip that
|
|
6
|
+
// resolvable-but-wrong directory and return the one that actually contains
|
|
7
|
+
// `schema.prisma` (the package's `prisma/`).
|
|
8
|
+
describe('pickPrismaDir', () => {
|
|
9
|
+
it('returns the first candidate that actually contains schema.prisma', () => {
|
|
10
|
+
const dir = pickPrismaDir(['/pkg/schema-fragments', '/pkg/prisma'], (d) => d === '/pkg/prisma');
|
|
11
|
+
expect(dir).toBe('/pkg/prisma');
|
|
12
|
+
});
|
|
13
|
+
it('skips a resolvable dir that lacks schema.prisma (the fragment-dir bug)', () => {
|
|
14
|
+
// schema-fragments/ resolves first (the export target) but has no schema.prisma.
|
|
15
|
+
const has = (d) => d.endsWith('/prisma');
|
|
16
|
+
expect(pickPrismaDir(['/pkg/schema-fragments', '/pkg/prisma'], has)).toBe('/pkg/prisma');
|
|
17
|
+
});
|
|
18
|
+
it('returns null when no candidate contains schema.prisma', () => {
|
|
19
|
+
expect(pickPrismaDir(['/a', '/b'], () => false)).toBeNull();
|
|
20
|
+
});
|
|
21
|
+
it('ignores empty/falsy candidates', () => {
|
|
22
|
+
expect(pickPrismaDir(['', '/pkg/prisma'], (d) => d === '/pkg/prisma')).toBe('/pkg/prisma');
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=db-sync-resolver.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"db-sync-resolver.test.js","sourceRoot":"","sources":["../../src/__tests__/db-sync-resolver.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAA;AAE7C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAA;AAEtD,iFAAiF;AACjF,+EAA+E;AAC/E,iFAAiF;AACjF,2EAA2E;AAC3E,6CAA6C;AAC7C,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;IAC7B,EAAE,CAAC,kEAAkE,EAAE,GAAG,EAAE;QAC1E,MAAM,GAAG,GAAG,aAAa,CAAC,CAAC,uBAAuB,EAAE,aAAa,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,aAAa,CAAC,CAAA;QAC/F,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAA;IACjC,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,wEAAwE,EAAE,GAAG,EAAE;QAChF,iFAAiF;QACjF,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;QAChD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