@marvalt/digivalt-core 0.2.29 → 0.2.32
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/CHANGELOG.md +39 -0
- package/GLOBAL-SHORTCODES.md +99 -0
- package/README.md +11 -9
- package/bin/env-example-fragments.cjs +6 -0
- package/bin/init.cjs +44 -5
- package/dist/generators/index.d.ts +3 -0
- package/dist/generators/prerender-seo.d.ts +6 -0
- package/dist/generators/seo-manifest.d.ts +3 -0
- package/dist/generators/seo-urls.d.ts +29 -0
- package/dist/generators/sitemap-paths.d.ts +5 -9
- package/dist/generators.cjs +1005 -155
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.d.ts +86 -6
- package/dist/generators.esm.js +992 -156
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.cjs +1019 -156
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +103 -9
- package/dist/index.esm.js +1006 -157
- package/dist/index.esm.js.map +1 -1
- package/dist/registry/index.d.ts +20 -0
- package/dist/registry.cjs +1528 -0
- package/dist/registry.cjs.map +1 -0
- package/dist/registry.d.ts +26 -0
- package/dist/registry.esm.js +1523 -0
- package/dist/registry.esm.js.map +1 -0
- package/dist/seo/DigiValtRouteSeo.d.ts +12 -0
- package/dist/seo/DigiValtSeoHead.d.ts +2 -0
- package/dist/seo/buildPageJsonLd.d.ts +11 -0
- package/dist/seo/html.d.ts +8 -0
- package/dist/seo/index.d.ts +7 -0
- package/dist/seo/resolvePageSeo.d.ts +17 -0
- package/dist/seo/seoTypes.d.ts +57 -0
- package/dist/seo.cjs +307 -86
- package/dist/seo.cjs.map +1 -1
- package/dist/seo.d.ts +105 -2
- package/dist/seo.esm.js +300 -87
- package/dist/seo.esm.js.map +1 -1
- package/dist/static/wpStatic.d.ts +16 -0
- package/dist/static.cjs +10 -0
- package/dist/static.cjs.map +1 -1
- package/dist/static.d.ts +38 -2
- package/dist/static.esm.js +10 -1
- package/dist/static.esm.js.map +1 -1
- package/dist/utils/notifications.d.ts +3 -0
- package/dist/utils/wpRegistry.d.ts +1 -1
- package/docs/AI-LOCAL-WORDPRESS-BOOTSTRAP.md +7 -3
- package/docs/AI-MASTER-PROMPT.md +37 -0
- package/docs/ENVIRONMENT.md +3 -3
- package/docs/README.md +8 -5
- package/docs/SEO-PERFORMANCE.md +42 -11
- package/docs/SHORTCODES.md +39 -0
- package/package.json +20 -8
- package/template/DIGIVALT_SETUP.md +14 -8
- package/template/functions/robots.txt.ts +27 -0
- package/template/functions/sitemap.xml.ts +143 -65
- package/template/scripts/generate.ts +3 -10
- package/template/scripts/prerender-seo.ts +10 -0
- package/docs/LOVABLE-MASTER-PROMPT.md +0 -140
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,45 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [0.2.32] - 2026-09-18
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- WordPress **DigiValt SEO** field consumption: `resolvePageSeo`, `buildPageJsonLd`, `DigiValtRouteSeo`.
|
|
12
|
+
- Sitemap v2 (`urls` + `lastmod` + optional image), PHPList paths, `VITE_SEO_ROUTE_PREFIXES`, frontend page paths (front page → `/`).
|
|
13
|
+
- `generateSeoManifest` + `prerenderSeoHtml` for crawlable HTML snapshots.
|
|
14
|
+
- Template **`functions/robots.txt.ts`** and **`scripts/prerender-seo.ts`**; `digivalt-init` wires prerender into `build` / `build:dev`.
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
- `generateAllData` always refreshes sitemap and SEO manifest, including fixture mode.
|
|
18
|
+
- Sitemap no longer uses CMS permalink pathnames.
|
|
19
|
+
|
|
20
|
+
**Publish/deploy:** publish **`@marvalt/digivalt-core@0.2.32`**. Install WordPress **digivalt-seo** (and **wp-pagesync 1.1.2**). Redeploy apps after generate + prerender.
|
|
21
|
+
|
|
22
|
+
## [0.2.31] - 2026-09-16
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
- **`@marvalt/digivalt-core/registry`** with `createContentRegistry()`, page-body-only `DigiValtWpPage`, and `DigiValtProviders`.
|
|
26
|
+
- **`getAppChrome()`** from `/static` for app-owned Header/Footer menus and site identity.
|
|
27
|
+
- `digivalt-init` warns without overwriting when a local `wpRegistry.tsx` / `createAppRegistry` is found.
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
- Bumped adapter deps to current monorepo releases: **`@marvalt/wparser@^0.1.82`**, **`@marvalt/dstyler@^0.1.53`**, **`@marvalt/shcoder@^0.1.37`**, **`@marvalt/sadapter@^0.1.6`**, **`@marvalt/tadapter@^1.0.14`**.
|
|
31
|
+
- Added optional `@tanstack/react-query` peer support for injected registry providers.
|
|
32
|
+
- Reframed docs around user-owned Vite + Cloudflare Pages apps, app-owned chrome, and Cursor / Pencil / Claude Design. `VITE_IS_LOVABLE` remains a backwards-compatible fixture-mode alias.
|
|
33
|
+
|
|
34
|
+
**Publish/deploy:** publish **`@marvalt/digivalt-core@0.2.31`** only. No WordPress plugin publish and no required app redeploy.
|
|
35
|
+
|
|
36
|
+
## [0.2.30] - 2026-08-26
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
- `createAppRegistry` merges **`getMauticShortcodeHandlers()`** (`[mautic_form]`) and **`getPhplistShortcodeHandlers()`** (`[phplist_subscribe]`). Gravity Forms and popup shortcodes stay in core.
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
- Depends on **`@marvalt/madapter@^2.3.11`** and **`@marvalt/plister@^0.3.0`**.
|
|
43
|
+
- **`docs/SHORTCODES.md`** — how shortcodes are parsed and merged; points at adapter `docs/SHORTCODES.md` after install.
|
|
44
|
+
- `GLOBAL-SHORTCODES.md` catalog (do not register as WordPress PHP shortcodes). Included in the npm tarball.
|
|
45
|
+
- Apps with a local `wpRegistry.tsx` (from `digivalt-init`) need to merge the new handlers after upgrading.
|
|
46
|
+
|
|
8
47
|
## [0.2.29] - 2026-08-12
|
|
9
48
|
|
|
10
49
|
### Changed
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# Global Shortcodes (DigiValt Core)
|
|
2
|
+
|
|
3
|
+
How shortcodes are wired (and adapter-specific guides after npm install):
|
|
4
|
+
|
|
5
|
+
- `node_modules/@marvalt/digivalt-core/docs/SHORTCODES.md`
|
|
6
|
+
- `node_modules/@marvalt/madapter/docs/SHORTCODES.md` — `[mautic_form]`
|
|
7
|
+
- `node_modules/@marvalt/plister/docs/SHORTCODES.md` — `[phplist_subscribe]`
|
|
8
|
+
- `node_modules/@marvalt/wparser/docs/SHORTCODES.md` — parser / registry merge
|
|
9
|
+
|
|
10
|
+
This document lists the shortcodes supported by `createContentRegistry()` from `@marvalt/digivalt-core/registry`.
|
|
11
|
+
|
|
12
|
+
**Do not register these as WordPress PHP shortcodes.** They must remain literal text in REST/HTML so `@marvalt/wparser` can replace them with React components. Content editors type them into WordPress; the headless app renders them.
|
|
13
|
+
|
|
14
|
+
Merge order in `createContentRegistry`: adapter handlers (`@marvalt/madapter`, `@marvalt/plister`) plus core Gravity Forms and popup shortcodes. Apps can merge project-specific CPT handlers separately.
|
|
15
|
+
|
|
16
|
+
## Gravity Forms (core)
|
|
17
|
+
|
|
18
|
+
- `[gf_embed id="1"]` — Render Gravity Form inline.
|
|
19
|
+
- `[gform form_id="1"]` — Alias of `gf_embed`.
|
|
20
|
+
- `[popupbtn_gf id="1" text="Submit"]` — Button that opens Gravity Form in a popup.
|
|
21
|
+
- `[popupgform form_id="1"]` — Alias of `popupbtn_gf`.
|
|
22
|
+
|
|
23
|
+
## Mautic (`@marvalt/madapter`)
|
|
24
|
+
|
|
25
|
+
Handlers: `getMauticShortcodeHandlers()`. DigiValt core passes `renderForm` so the app `MauticForm` (static JSON + integration config) is used.
|
|
26
|
+
|
|
27
|
+
- `[mautic_form id="1"]` — Render Mautic form inline. Optional `title`, `description`. `formId` is accepted as an alias of `id`.
|
|
28
|
+
- `[popupbtn_mautic id="1" text="Contact Us"]` — Button that opens Mautic form in a package-local popup. Optional `title` for the popup heading.
|
|
29
|
+
|
|
30
|
+
Standalone apps (no DigiValt core) can merge the same handlers:
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { getMauticShortcodeHandlers } from '@marvalt/madapter';
|
|
34
|
+
Object.assign(registry.shortcodes, getMauticShortcodeHandlers());
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Requires generated `mautic-data.json` (or a custom `resolveForm`) and `QueryClientProvider`.
|
|
38
|
+
|
|
39
|
+
## PHPList (`@marvalt/plister`)
|
|
40
|
+
|
|
41
|
+
Handlers: `getPhplistShortcodeHandlers()`. Renders `PhpListSubscribeEmbed` (loads `phplist-data.json`, posts through the PHPList proxy). Requires `QueryClientProvider`.
|
|
42
|
+
|
|
43
|
+
- `[phplist_subscribe list="1" attrs="firstname,lastname"]` — Inline subscribe form (email plus nominated visible attributes).
|
|
44
|
+
|
|
45
|
+
| Attribute | Required | Meaning |
|
|
46
|
+
|-----------|----------|---------|
|
|
47
|
+
| `list` | Usually | List id, or slug/name from static data. If omitted, uses static `list.id` then `VITE_PHPLIST_LIST_ID`. |
|
|
48
|
+
| `attrs` | No | Comma-separated **visible** attribute names to collect (plus email). Omit for email only. Unknown names are skipped. Hidden/preset attributes are not supported yet. |
|
|
49
|
+
| `page` | No | PHPList subscribe page id (public API + confirmation emails). If omitted: first static page that includes the list, else first subscribe page, else `VITE_PHPLIST_SUBSCRIBE_PAGE_IDS`. |
|
|
50
|
+
| `title` | No | Override subscribe-page title. |
|
|
51
|
+
| `intro` | No | Override subscribe-page intro. |
|
|
52
|
+
|
|
53
|
+
PHPList has no public “subscribe to list X” API; signups go through a subscribe page. Editors can omit `page` when the site has one default page.
|
|
54
|
+
|
|
55
|
+
Dedicated subscribe routes (e.g. `/subscribe`) are unchanged; the shortcode is for embedding in WordPress content.
|
|
56
|
+
|
|
57
|
+
Standalone:
|
|
58
|
+
|
|
59
|
+
```ts
|
|
60
|
+
import { getPhplistShortcodeHandlers } from '@marvalt/plister';
|
|
61
|
+
Object.assign(registry.shortcodes, getPhplistShortcodeHandlers());
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Optional app-specific CPT shortcodes (`@marvalt/shcoder`)
|
|
65
|
+
|
|
66
|
+
These are available to apps that merge their own `@marvalt/shcoder` handlers; they are not part of the published content registry.
|
|
67
|
+
|
|
68
|
+
- `[member_card id="123"]` — Single member profile.
|
|
69
|
+
- `[member_cards tax="leadership" cols="3" image="true"]` — Member grid.
|
|
70
|
+
- `[member_slideshow category="leadership" interval="5000" show_bio="true"]` — Member slideshow.
|
|
71
|
+
|
|
72
|
+
## Testimonial Shortcodes (`@marvalt/shcoder`)
|
|
73
|
+
|
|
74
|
+
- `[testimonial_card id="123"]` — Single testimonial.
|
|
75
|
+
- `[testimonial_cards category="external" cols="2"]` — Testimonial grid.
|
|
76
|
+
- `[testimonial_slideshow category="external" interval="5000"]` — Testimonial slideshow.
|
|
77
|
+
|
|
78
|
+
## Event Shortcodes (`@marvalt/shcoder`)
|
|
79
|
+
|
|
80
|
+
Preferred platform-agnostic names:
|
|
81
|
+
|
|
82
|
+
- `[event_card id="123"]` — Single event card.
|
|
83
|
+
- `[events_cards category="..." cols="3"]` — Event cards grid.
|
|
84
|
+
- `[events_slideshow category="..." interval="5000"]` — Event slideshow.
|
|
85
|
+
|
|
86
|
+
Legacy aliases still supported:
|
|
87
|
+
|
|
88
|
+
- `[eventbrite_event_card ...]` → alias of `event_card`
|
|
89
|
+
- `[eventbrite-events_cards ...]` → alias of `events_cards`
|
|
90
|
+
- `[eventbriteevents_cards ...]` → alias of `events_cards`
|
|
91
|
+
- `[eventbrite-events_slideshow ...]` → alias of `events_slideshow`
|
|
92
|
+
- `[eventbriteevents_slideshow ...]` → alias of `events_slideshow`
|
|
93
|
+
|
|
94
|
+
## Notes
|
|
95
|
+
|
|
96
|
+
- Popup button shortcodes (`popupbtn_mautic`, `popupbtn_gf`) are app/core-level mappings, not adapter-package shortcodes.
|
|
97
|
+
- CPT dashboard widgets in `wp-custom-api-endpoints` list member/testimonial/event shortcodes only. Form shortcodes are documented here and in adapter package docs.
|
|
98
|
+
- Attribute support can evolve with registry/component updates; treat the published `/registry` docs and types as source of truth.
|
|
99
|
+
- Existing apps with a local registry can keep it and merge or adopt `createContentRegistry()` on their schedule.
|
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Core DigiVAlt package for static data generation, runtime service wiring, and Cl
|
|
|
8
8
|
npm install @marvalt/digivalt-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Full handover docs: **[docs/README.md](./docs/README.md)** and **[docs/ENVIRONMENT.md](./docs/ENVIRONMENT.md)**. After install: `node_modules/@marvalt/digivalt-core/docs/README.md`.
|
|
11
|
+
Full handover docs: **[docs/README.md](./docs/README.md)** and **[docs/ENVIRONMENT.md](./docs/ENVIRONMENT.md)**. After install: `node_modules/@marvalt/digivalt-core/docs/README.md`. WordPress shortcodes: **[docs/SHORTCODES.md](./docs/SHORTCODES.md)** (catalog also in **[GLOBAL-SHORTCODES.md](./GLOBAL-SHORTCODES.md)**).
|
|
12
12
|
|
|
13
13
|
In the **DigiVAlt monorepo**, **`digivalt-landing`** is the reference Vite app used to test this package with WordPress plugins and Cloudflare Pages.
|
|
14
14
|
|
|
@@ -19,7 +19,8 @@ Prefer explicit subpath imports so Node/build-time code does not pull browser ru
|
|
|
19
19
|
```ts
|
|
20
20
|
import { generateAllData } from '@marvalt/digivalt-core/generators';
|
|
21
21
|
import { getIntegrationConfig } from '@marvalt/digivalt-core/config';
|
|
22
|
-
import { loadWordPressData } from '@marvalt/digivalt-core/static';
|
|
22
|
+
import { getAppChrome, loadWordPressData } from '@marvalt/digivalt-core/static';
|
|
23
|
+
import { createContentRegistry, DigiValtProviders, DigiValtWpPage } from '@marvalt/digivalt-core/registry';
|
|
23
24
|
import { gravityFormsService } from '@marvalt/digivalt-core/services';
|
|
24
25
|
```
|
|
25
26
|
|
|
@@ -27,14 +28,14 @@ The root package export remains as a thin compatibility layer for generator-focu
|
|
|
27
28
|
|
|
28
29
|
## SEO and PageSpeed
|
|
29
30
|
|
|
30
|
-
- **Subpath:** `import { DigiValtSeoHead, JsonLd,
|
|
31
|
+
- **Subpath:** `import { DigiValtRouteSeo, DigiValtSeoHead, JsonLd, buildPageJsonLd, ... } from '@marvalt/digivalt-core/seo'`
|
|
31
32
|
- **Peer dependency:** `react-helmet-async` (v2+). Wrap the app in **`HelmetProvider`**.
|
|
32
|
-
- **Env:** **`VITE_SEO_*`**
|
|
33
|
+
- **Env:** **`VITE_SEO_*`** site identity (`VITE_SEO_SITE_URL`, `VITE_SEO_SITE_NAME`, `VITE_SEO_DEFAULT_TITLE`, …). Per-URL fields come from WordPress **`digivalt_seo`**. See **[docs/SEO-PERFORMANCE.md](./docs/SEO-PERFORMANCE.md)**.
|
|
33
34
|
- **Config:** `getSEOConfig()` / `getPerformanceConfig()` in `@marvalt/digivalt-core/config` read the same `VITE_*` values.
|
|
34
35
|
|
|
35
36
|
## Init Workflow
|
|
36
37
|
|
|
37
|
-
Run `npx digivalt-init` inside a Vite
|
|
38
|
+
Run `npx digivalt-init` inside a Vite app root. The command validates the target folder, inspects existing DigiVAlt wiring, and patches safe cases automatically.
|
|
38
39
|
|
|
39
40
|
Useful flags:
|
|
40
41
|
|
|
@@ -49,6 +50,7 @@ What init now does:
|
|
|
49
50
|
- adds or updates `generate`, `build`, and `build:dev` scripts when the app is still on plain Vite wiring
|
|
50
51
|
- refreshes `scripts/generate.ts` when it matches an older DigiVAlt-managed version
|
|
51
52
|
- warns instead of overwriting custom build logic or custom generator scripts
|
|
53
|
+
- warns when a local `wpRegistry.tsx` / `createAppRegistry` is present; use the published `/registry` helpers when practical
|
|
52
54
|
- reports stale legacy workarounds such as alias-link scripts and old root package generator imports
|
|
53
55
|
|
|
54
56
|
When to rerun it:
|
|
@@ -57,17 +59,17 @@ When to rerun it:
|
|
|
57
59
|
- after upgrading `@marvalt/digivalt-core` when scaffolded build wiring changes
|
|
58
60
|
- before publishing a new app if you want a quick preflight of the DigiVAlt setup
|
|
59
61
|
|
|
60
|
-
**Sitemap:** Each build regenerates **`public/sitemap-paths.json`**
|
|
62
|
+
**Sitemap:** Each build regenerates **`public/sitemap-paths.json`** (frontend paths + lastmod) and **`public/seo-manifest.json`**. After Vite, prerender writes HTML snapshots. See **[docs/SEO-PERFORMANCE.md](./docs/SEO-PERFORMANCE.md)**.
|
|
61
63
|
|
|
62
64
|
**Google Reviews static data:** Opt in by adding **`google_reviews`** to **`VITE_ENABLED_POST_TYPES`** (requires the `vibune-google-reviews` WordPress plugin). When enabled, `generateAllData()` fetches the plugin REST route and writes **`public/google-reviews-data.json`**. By default the endpoint is derived from `WORDPRESS_API_URL` / `VITE_WORDPRESS_API_URL` (`/wp-json/vibune-google-reviews/v1/reviews`). Override with `GOOGLE_REVIEWS_API_URL` / `VITE_GOOGLE_REVIEWS_API_URL` when needed. When `google_reviews` is not listed, generation is skipped (same optional pattern as Mautic/SuiteCRM).
|
|
63
65
|
|
|
64
|
-
**AI builders (Cursor /
|
|
65
|
-
-
|
|
66
|
+
**AI builders (Cursor / Pencil / Claude Design):**
|
|
67
|
+
- Vite + Cloudflare master prompt: **[docs/AI-MASTER-PROMPT.md](./docs/AI-MASTER-PROMPT.md)**
|
|
66
68
|
- Local-first human runbook: **[docs/AI-LOCAL-WORDPRESS-BOOTSTRAP.md](./docs/AI-LOCAL-WORDPRESS-BOOTSTRAP.md)**
|
|
67
69
|
|
|
68
70
|
## Developing this package
|
|
69
71
|
|
|
70
|
-
This repo uses **`.npmrc`** with `legacy-peer-deps=true` so `react-helmet-async` installs cleanly alongside **React 19**-compatible transitive deps during local builds. Consumers
|
|
72
|
+
This repo uses **`.npmrc`** with `legacy-peer-deps=true` so `react-helmet-async` installs cleanly alongside **React 19**-compatible transitive deps during local builds. Consumers satisfy `react`, `react-dom`, and `react-helmet-async`; install the optional `@tanstack/react-query` peer when injecting a QueryClient into `DigiValtProviders`.
|
|
71
73
|
|
|
72
74
|
## Cloudflare Secrets
|
|
73
75
|
|
|
@@ -55,6 +55,12 @@ VITE_SEO_TWITTER_SITE=@example
|
|
|
55
55
|
VITE_SEO_FACEBOOK_APP_ID=
|
|
56
56
|
VITE_SEO_GOOGLE_SITE_VERIFICATION=
|
|
57
57
|
VITE_SEO_BING_SITE_VERIFICATION=
|
|
58
|
+
# Opt-in frontend path prefixes for non-page post types: rest_base:/route-prefix
|
|
59
|
+
# VITE_SEO_ROUTE_PREFIXES=eventbrite_event:/events,member:/members/profile
|
|
60
|
+
# Optional: WP page slug that must map to `/` when Reading Settings front_page does not match the app homepage
|
|
61
|
+
# VITE_SEO_FRONT_PAGE_SLUG=
|
|
62
|
+
# PHPList public archive base (must match the app router)
|
|
63
|
+
# VITE_PHPLIST_NEWSLETTER_ROUTE_BASE=/newsletters
|
|
58
64
|
|
|
59
65
|
# Performance toggles (optional; omit to use defaults in getPerformanceConfig)
|
|
60
66
|
# VITE_PERF_LAZY_LOADING=true
|
package/bin/init.cjs
CHANGED
|
@@ -17,20 +17,24 @@ const args = process.argv.slice(2);
|
|
|
17
17
|
|
|
18
18
|
const EXPECTED_GENERATE_SCRIPT =
|
|
19
19
|
'npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts';
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
const EXPECTED_PRERENDER_SCRIPT =
|
|
21
|
+
'npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/prerender-seo.ts';
|
|
22
|
+
const EXPECTED_BUILD_SCRIPT = `${EXPECTED_GENERATE_SCRIPT} && vite build && ${EXPECTED_PRERENDER_SCRIPT}`;
|
|
23
|
+
const EXPECTED_BUILD_DEV_SCRIPT = `${EXPECTED_GENERATE_SCRIPT} && vite build --mode development && ${EXPECTED_PRERENDER_SCRIPT}`;
|
|
22
24
|
|
|
23
25
|
const TEMPLATE_MANAGED_FILES = new Set([
|
|
24
26
|
'.dev.vars.example',
|
|
25
27
|
'DIGIVALT_SETUP.md',
|
|
26
28
|
'functions/api/fetch-with-access.ts',
|
|
27
29
|
'functions/sitemap.xml.ts',
|
|
30
|
+
'functions/robots.txt.ts',
|
|
28
31
|
'functions/api/gravity-forms-submit.ts',
|
|
29
32
|
'functions/api/mautic-submit.ts',
|
|
30
33
|
'functions/api/webhook.js',
|
|
31
34
|
'scripts/deploy-secrets.js',
|
|
32
35
|
'scripts/deploy-pages.js',
|
|
33
36
|
'scripts/generate.ts',
|
|
37
|
+
'scripts/prerender-seo.ts',
|
|
34
38
|
'wrangler.toml',
|
|
35
39
|
]);
|
|
36
40
|
|
|
@@ -91,7 +95,7 @@ function ensureValidTarget(dir) {
|
|
|
91
95
|
const packageJsonPath = path.join(dir, 'package.json');
|
|
92
96
|
if (!fs.existsSync(packageJsonPath)) {
|
|
93
97
|
throw new Error(
|
|
94
|
-
'No package.json found in the target directory. Run `digivalt-init` inside a Vite
|
|
98
|
+
'No package.json found in the target directory. Run `digivalt-init` inside a Vite app root, or pass `--target <app-path>`.'
|
|
95
99
|
);
|
|
96
100
|
}
|
|
97
101
|
|
|
@@ -167,6 +171,14 @@ function isExpectedBuildDevScript(command) {
|
|
|
167
171
|
return normalizeScript(command) === normalizeScript(EXPECTED_BUILD_DEV_SCRIPT);
|
|
168
172
|
}
|
|
169
173
|
|
|
174
|
+
function isStaleDigivaltBuild(command) {
|
|
175
|
+
return normalizeScript(command) === normalizeScript(`${EXPECTED_GENERATE_SCRIPT} && vite build`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
function isStaleDigivaltBuildDev(command) {
|
|
179
|
+
return normalizeScript(command) === normalizeScript(`${EXPECTED_GENERATE_SCRIPT} && vite build --mode development`);
|
|
180
|
+
}
|
|
181
|
+
|
|
170
182
|
function isPlainViteBuild(command) {
|
|
171
183
|
return normalizeScript(command) === 'vite build';
|
|
172
184
|
}
|
|
@@ -191,6 +203,26 @@ function writeJson(filePath, value) {
|
|
|
191
203
|
}
|
|
192
204
|
}
|
|
193
205
|
|
|
206
|
+
function findLocalRegistryFiles(srcDir) {
|
|
207
|
+
if (!fs.existsSync(srcDir)) return [];
|
|
208
|
+
const matches = [];
|
|
209
|
+
const visit = (dir) => {
|
|
210
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
211
|
+
const fullPath = path.join(dir, entry.name);
|
|
212
|
+
if (entry.isDirectory()) {
|
|
213
|
+
visit(fullPath);
|
|
214
|
+
} else if (
|
|
215
|
+
entry.name === 'wpRegistry.tsx' ||
|
|
216
|
+
(/\.[jt]sx?$/.test(entry.name) && readTextIfExists(fullPath)?.includes('createAppRegistry'))
|
|
217
|
+
) {
|
|
218
|
+
matches.push(path.relative(targetDir, fullPath).replace(/\\/g, '/'));
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
visit(srcDir);
|
|
223
|
+
return matches;
|
|
224
|
+
}
|
|
225
|
+
|
|
194
226
|
function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
|
|
195
227
|
const packageJson = readJson(targetPackageJsonPath);
|
|
196
228
|
const scripts = packageJson.scripts || {};
|
|
@@ -235,7 +267,7 @@ function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
|
|
|
235
267
|
hasViteNode: Boolean(deps['vite-node'] || devDeps['vite-node']),
|
|
236
268
|
buildState: isExpectedBuildScript(scripts.build)
|
|
237
269
|
? 'current'
|
|
238
|
-
: isPlainViteBuild(scripts.build)
|
|
270
|
+
: isPlainViteBuild(scripts.build) || isStaleDigivaltBuild(scripts.build)
|
|
239
271
|
? 'plain'
|
|
240
272
|
: scriptRunsGenerate(scripts.build)
|
|
241
273
|
? 'custom-digivalt'
|
|
@@ -244,7 +276,7 @@ function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
|
|
|
244
276
|
: 'missing',
|
|
245
277
|
buildDevState: isExpectedBuildDevScript(scripts['build:dev'])
|
|
246
278
|
? 'current'
|
|
247
|
-
: isPlainViteBuildDev(scripts['build:dev'])
|
|
279
|
+
: isPlainViteBuildDev(scripts['build:dev']) || isStaleDigivaltBuildDev(scripts['build:dev'])
|
|
248
280
|
? 'plain'
|
|
249
281
|
: scriptRunsGenerate(scripts['build:dev'])
|
|
250
282
|
? 'custom-digivalt'
|
|
@@ -262,6 +294,7 @@ function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
|
|
|
262
294
|
legacyPostinstall: postinstall.includes('link-digivalt-alias'),
|
|
263
295
|
legacyRootImport: Boolean(generateScriptContent && generateScriptContent.includes("import { generators } from '@marvalt/digivalt-core';")),
|
|
264
296
|
legacyViteConfigs,
|
|
297
|
+
localRegistryFiles: findLocalRegistryFiles(path.join(targetDir, 'src')),
|
|
265
298
|
};
|
|
266
299
|
}
|
|
267
300
|
|
|
@@ -438,6 +471,12 @@ function collectLegacyWarnings(status) {
|
|
|
438
471
|
if (status.legacyViteConfigs.length > 0) {
|
|
439
472
|
report.warnings.push(`Legacy Vite SSR/noExternal workaround detected in: ${status.legacyViteConfigs.join(', ')}.`);
|
|
440
473
|
}
|
|
474
|
+
|
|
475
|
+
if (status.localRegistryFiles.length > 0) {
|
|
476
|
+
report.warnings.push(
|
|
477
|
+
`Local WordPress registry detected (${status.localRegistryFiles.join(', ')}). Prefer \`@marvalt/digivalt-core/registry\`; existing files were not overwritten.`
|
|
478
|
+
);
|
|
479
|
+
}
|
|
441
480
|
}
|
|
442
481
|
|
|
443
482
|
function printList(title, items) {
|
|
@@ -6,4 +6,7 @@ export * from './suitecrm';
|
|
|
6
6
|
export * from './google-reviews';
|
|
7
7
|
export * from './enabled-post-types';
|
|
8
8
|
export * from './sitemap-paths';
|
|
9
|
+
export * from './seo-manifest';
|
|
10
|
+
export * from './prerender-seo';
|
|
11
|
+
export * from './seo-urls';
|
|
9
12
|
export declare function generateAllData(): Promise<void>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SeoEntity, SitemapUrlEntry } from '../seo/seoTypes';
|
|
2
|
+
export declare const SITEMAP_URL_SHARD_SIZE = 45000;
|
|
3
|
+
export type GenerateSeoFilesOptions = {
|
|
4
|
+
cwd?: string;
|
|
5
|
+
wpDataPath?: string;
|
|
6
|
+
phplistDataPath?: string;
|
|
7
|
+
staticInputPath?: string;
|
|
8
|
+
outputPath?: string;
|
|
9
|
+
manifestOutputPath?: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function parseRoutePrefixes(raw?: string): Record<string, string>;
|
|
12
|
+
export declare function isPublishedEntity(item: {
|
|
13
|
+
status?: unknown;
|
|
14
|
+
}): boolean;
|
|
15
|
+
export declare function isNoindexEntity(item: SeoEntity): boolean;
|
|
16
|
+
export declare function entityLastmod(item: SeoEntity): string | undefined;
|
|
17
|
+
export declare function entityImage(item: SeoEntity): string | undefined;
|
|
18
|
+
export declare function getFrontPageRef(data: Record<string, unknown>): {
|
|
19
|
+
slug?: string;
|
|
20
|
+
id?: number;
|
|
21
|
+
};
|
|
22
|
+
export declare function getFrontPageSlug(data: Record<string, unknown>): string | undefined;
|
|
23
|
+
export declare function newsletterRouteBase(): string;
|
|
24
|
+
export declare function collectSitemapUrls(args: {
|
|
25
|
+
wpData?: Record<string, unknown>;
|
|
26
|
+
phplistData?: Record<string, unknown>;
|
|
27
|
+
staticPaths: string[];
|
|
28
|
+
prefixes?: Record<string, string>;
|
|
29
|
+
}): SitemapUrlEntry[];
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
cwd?: string;
|
|
3
|
-
wpDataPath?: string;
|
|
4
|
-
staticInputPath?: string;
|
|
5
|
-
outputPath?: string;
|
|
6
|
-
};
|
|
1
|
+
import { type GenerateSeoFilesOptions } from './seo-urls';
|
|
7
2
|
/**
|
|
8
|
-
* Merge
|
|
3
|
+
* Merge static app routes, WP pages (frontend paths), opt-in CPT prefixes, and PHPList issues.
|
|
9
4
|
*/
|
|
10
|
-
export declare function generateSitemapPaths(options?:
|
|
11
|
-
export declare function generateSitemapPathsSafe(options?:
|
|
5
|
+
export declare function generateSitemapPaths(options?: GenerateSeoFilesOptions): Promise<void>;
|
|
6
|
+
export declare function generateSitemapPathsSafe(options?: GenerateSeoFilesOptions): Promise<void>;
|
|
7
|
+
export type { GenerateSeoFilesOptions };
|