@marvalt/digivalt-core 0.2.9 → 0.2.12
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 +29 -0
- package/README.md +9 -1
- package/bin/env-example-fragments.cjs +3 -0
- package/dist/generators/google-reviews.d.ts +5 -0
- package/dist/generators/index.d.ts +2 -0
- package/dist/generators/sitemap-paths.d.ts +11 -0
- package/dist/generators.cjs +303 -1
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.d.ts +19 -1
- package/dist/generators.esm.js +301 -2
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.cjs +306 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +25 -9
- package/dist/index.esm.js +304 -2
- package/dist/index.esm.js.map +1 -1
- package/docs/AI-LOCAL-WORDPRESS-BOOTSTRAP.md +116 -0
- package/docs/LOVABLE-MASTER-PROMPT.md +140 -0
- package/docs/SEO-PERFORMANCE.md +9 -1
- package/package.json +3 -2
- package/template/DIGIVALT_SETUP.md +1 -1
- package/template/functions/sitemap.xml.ts +1 -1
- package/template/public/gravity-forms-data.json +7 -0
- package/template/public/sitemap-static-paths.json +3 -0
- package/template/public/wordpress-data.json +44 -0
- package/template/scripts/deploy-secrets.js +9 -7
- package/template/scripts/generate.ts +9 -5
- package/template/src/data/mautic-data.json +7 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# AI local bootstrap runbook — full WordPress control
|
|
2
|
+
|
|
3
|
+
This runbook is for projects scaffolded by AI tools (Cursor, Claude Code, Antigravity, Lovable) when you want full control from WordPress-managed static pages, menus, header/footer blocks, and theme styles.
|
|
4
|
+
|
|
5
|
+
Primary goal: after AI scaffolding is complete, the human should only need env values before first local run:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run build && npm run dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## What AI must already have done
|
|
14
|
+
|
|
15
|
+
Before using this runbook, the generated project should already include:
|
|
16
|
+
|
|
17
|
+
- `@marvalt/digivalt-core@latest`
|
|
18
|
+
- `vite-node` and `react-helmet-async`
|
|
19
|
+
- `npx digivalt-init` output (or equivalent)
|
|
20
|
+
- `scripts/generate.ts` wired to `@marvalt/digivalt-core/generators`
|
|
21
|
+
- `functions/` + `wrangler.toml` for Pages Functions
|
|
22
|
+
- `.gitignore` rules for `.env`, `.env.local`, `.env.*.local`, `.dev.vars`
|
|
23
|
+
|
|
24
|
+
If missing, run:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install @marvalt/digivalt-core@latest
|
|
28
|
+
npm install -D vite-node
|
|
29
|
+
npm install react-helmet-async
|
|
30
|
+
npx digivalt-init
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## Human-only step: set env values
|
|
36
|
+
|
|
37
|
+
Create/update `.env` and `.env.local` from the generated examples (`.env.example`, `.env.local.example`) and set values.
|
|
38
|
+
|
|
39
|
+
Important local rule:
|
|
40
|
+
|
|
41
|
+
- Do **not** set `VITE_IS_LOVABLE=true` locally for full-data mode.
|
|
42
|
+
|
|
43
|
+
### Minimum env matrix for first successful full-data build
|
|
44
|
+
|
|
45
|
+
| Group | Required for first local `build` | Keys |
|
|
46
|
+
|------|------|------|
|
|
47
|
+
| WordPress static generation | Yes | `VITE_WORDPRESS_API_URL` (or `WORDPRESS_API_URL`) |
|
|
48
|
+
| WordPress auth | Usually yes (if API protected) | `VITE_WP_API_USERNAME` + `VITE_WP_APP_PASSWORD` (or `WP_API_USERNAME` + `WP_APP_PASSWORD`) |
|
|
49
|
+
| Gravity Forms | Uses WP creds by default | Optional dedicated keys: `VITE_GRAVITY_FORMS_API_URL`, `VITE_GRAVITY_FORMS_USERNAME`, `VITE_GRAVITY_FORMS_PASSWORD` |
|
|
50
|
+
| Mautic | Optional; generator skips when URL missing | `VITE_MAUTIC_URL` (+ optional `VITE_MAUTIC_API_PUBLIC_KEY`, `VITE_MAUTIC_API_SECRET_KEY`) |
|
|
51
|
+
| Cloudflare Access (if WP/API behind Zero Trust) | Conditional | `VITE_CF_ACCESS_CLIENT_ID`, `VITE_CF_ACCESS_CLIENT_SECRET` |
|
|
52
|
+
| SEO defaults | Recommended | `VITE_SEO_SITE_URL`, `VITE_SEO_SITE_NAME`, `VITE_SEO_DEFAULT_TITLE`, `VITE_SEO_DEFAULT_DESCRIPTION`, `VITE_SEO_DEFAULT_OG_IMAGE` |
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## First local run
|
|
57
|
+
|
|
58
|
+
From app root:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm install
|
|
62
|
+
npm run build
|
|
63
|
+
npm run dev
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`npm run build` runs generation first and should produce/update:
|
|
67
|
+
|
|
68
|
+
- `public/wordpress-data.json`
|
|
69
|
+
- `public/gravity-forms-data.json`
|
|
70
|
+
- `src/data/mautic-data.json` (if Mautic configured)
|
|
71
|
+
- `public/sitemap-paths.json`
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Verification checklist
|
|
76
|
+
|
|
77
|
+
- Build succeeds without missing env errors.
|
|
78
|
+
- WordPress shell renders (menu/header/footer/theme) from static data.
|
|
79
|
+
- `public/sitemap-paths.json` is generated.
|
|
80
|
+
- No static `public/sitemap.xml` exists when using `functions/sitemap.xml.ts`.
|
|
81
|
+
- Local secrets are not tracked by git.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Quick failure recovery
|
|
86
|
+
|
|
87
|
+
### `Missing WordPress API URL`
|
|
88
|
+
|
|
89
|
+
Set `VITE_WORDPRESS_API_URL` (or `WORDPRESS_API_URL`) in env and rerun build.
|
|
90
|
+
|
|
91
|
+
### WordPress or Gravity Forms auth failures
|
|
92
|
+
|
|
93
|
+
Verify app password credentials:
|
|
94
|
+
|
|
95
|
+
- `VITE_WP_API_USERNAME`
|
|
96
|
+
- `VITE_WP_APP_PASSWORD`
|
|
97
|
+
|
|
98
|
+
Or set dedicated GF credentials if needed.
|
|
99
|
+
|
|
100
|
+
### No Mautic output
|
|
101
|
+
|
|
102
|
+
If `VITE_MAUTIC_URL` is missing, Mautic generation is skipped by design. Set it only if needed for your app.
|
|
103
|
+
|
|
104
|
+
### Build behaves like fixture mode
|
|
105
|
+
|
|
106
|
+
Ensure `VITE_IS_LOVABLE` is not set to `true` locally.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## References
|
|
111
|
+
|
|
112
|
+
- [digivalt-npm-packages/digivalt-core/src/generators/wp.ts](../src/generators/wp.ts)
|
|
113
|
+
- [digivalt-npm-packages/digivalt-core/src/generators/gf.ts](../src/generators/gf.ts)
|
|
114
|
+
- [digivalt-npm-packages/digivalt-core/src/generators/mautic.ts](../src/generators/mautic.ts)
|
|
115
|
+
- [digivalt-npm-packages/digivalt-core/src/generators/sitemap-paths.ts](../src/generators/sitemap-paths.ts)
|
|
116
|
+
- [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md)
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
# AI master prompt — DigiVAlt full local WordPress control
|
|
2
|
+
|
|
3
|
+
Use this as a single copy-paste master prompt in Cursor, Claude Code, Antigravity, Lovable, or similar AI coding tools.
|
|
4
|
+
|
|
5
|
+
The objective is a DigiValt app scaffold that is production-shaped from day one, where after generation a human only needs to set `.env` / `.env.local` values before first local run:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run build && npm run dev
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Scope
|
|
12
|
+
|
|
13
|
+
- **AI responsibilities:** scaffold code, install/wire dependencies, run `digivalt-init`, ensure scripts/files are correct, keep cloud/function wiring and SEO enabled, and build a WordPress-driven shell.
|
|
14
|
+
- **Human responsibilities:** set real env values on local PC and cloud dashboard, run first local build/dev, replace placeholder static data with real generated exports as needed.
|
|
15
|
+
|
|
16
|
+
## Canonical sources
|
|
17
|
+
|
|
18
|
+
- [README.md](../README.md)
|
|
19
|
+
- [template/DIGIVALT_SETUP.md](../template/DIGIVALT_SETUP.md)
|
|
20
|
+
- [template/scripts/generate.ts](../template/scripts/generate.ts)
|
|
21
|
+
- [docs/SEO-PERFORMANCE.md](./SEO-PERFORMANCE.md)
|
|
22
|
+
- [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md)
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
## Master prompt text (paste below into your AI tool)
|
|
27
|
+
|
|
28
|
+
You are a senior full-stack engineer scaffolding a DigiValt consumer app (Vite + React + TypeScript) with full WordPress-controlled static content behavior. This workflow must work the same whether run from Cursor, Claude Code, Antigravity, Lovable, or another AI assistant.
|
|
29
|
+
|
|
30
|
+
### Non-negotiables
|
|
31
|
+
|
|
32
|
+
- Install `@marvalt/digivalt-core@latest`.
|
|
33
|
+
- Use `npx digivalt-init` to enforce DigiValt-managed scaffold files and scripts.
|
|
34
|
+
- Keep Cloudflare Pages Functions + `wrangler.toml` enabled.
|
|
35
|
+
- Keep SEO enabled by default (Helmet provider + DigiValt SEO helpers).
|
|
36
|
+
- Keep local secrets out of git and ignore `.env`, `.env.local`, `.env.*.local`, `.dev.vars`.
|
|
37
|
+
- Do not hand-maintain `public/sitemap-paths.json`; it is generated.
|
|
38
|
+
- Do not create `public/sitemap.xml` when using `functions/sitemap.xml.ts`.
|
|
39
|
+
|
|
40
|
+
### File/path requirements
|
|
41
|
+
|
|
42
|
+
Use these exact static data paths:
|
|
43
|
+
|
|
44
|
+
- `public/wordpress-data.json`
|
|
45
|
+
- `public/gravity-forms-data.json`
|
|
46
|
+
- `src/data/mautic-data.json`
|
|
47
|
+
|
|
48
|
+
If real exports are unavailable, use template starter fixtures (or equivalent minimal placeholders) so the app boots. Mark placeholders clearly.
|
|
49
|
+
|
|
50
|
+
### Build wiring requirements
|
|
51
|
+
|
|
52
|
+
Ensure these commands exist and are used:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @marvalt/digivalt-core@latest
|
|
56
|
+
npm install -D vite-node
|
|
57
|
+
npx digivalt-init
|
|
58
|
+
npm install react-helmet-async
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Expected scripts:
|
|
62
|
+
|
|
63
|
+
- `generate`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts`
|
|
64
|
+
- `build`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts && vite build`
|
|
65
|
+
- `build:dev`: `npx vite-node --options.deps.inline="@marvalt/digivalt-core/generators" scripts/generate.ts && vite build --mode development`
|
|
66
|
+
- `dev`: `vite`
|
|
67
|
+
|
|
68
|
+
### `scripts/generate.ts` behavior
|
|
69
|
+
|
|
70
|
+
Import from `@marvalt/digivalt-core/generators` only:
|
|
71
|
+
|
|
72
|
+
- In hosted fixture mode (`VITE_IS_LOVABLE=true`): skip fetch, run `generateSitemapPathsSafe()`.
|
|
73
|
+
- In normal local mode (default): run `generateAllData()` then sitemap; on fetch failure still run sitemap safe fallback.
|
|
74
|
+
|
|
75
|
+
### WordPress-driven runtime wiring (must implement)
|
|
76
|
+
|
|
77
|
+
After `loadWordPressData()` from `@marvalt/digivalt-core/static`, wire the app shell and routes using WordPress static data:
|
|
78
|
+
|
|
79
|
+
1. Menus from `getNavigationMenu()` / `getMenuById()` (+ `getParsedHeader()` / `getHeaderMenuId()`).
|
|
80
|
+
2. Header/footer template blocks from `getHeader()` / `getFooter()`.
|
|
81
|
+
3. Site identity from `getSiteSettings()` / `getLogoUrl()` / `getSiteIconUrl()`.
|
|
82
|
+
4. Theme styles from `getWordPressData().theme_styles` mapped into app styling/tokens.
|
|
83
|
+
5. Pages/posts/CPT routes from `getWordPressPages()`, `getWordPressPageBySlug()`, `getWordPressPosts()`, and `front_page`.
|
|
84
|
+
|
|
85
|
+
For forms, support Gravity Forms and Mautic via `@marvalt/digivalt-core/services` and/or JSON static stores.
|
|
86
|
+
|
|
87
|
+
### Cloudflare and sitemap requirements
|
|
88
|
+
|
|
89
|
+
- Keep `functions/sitemap.xml.ts`.
|
|
90
|
+
- Keep `functions/api/*` handlers from template and keep `wrangler.toml`.
|
|
91
|
+
- Ensure sitemap flow is active:
|
|
92
|
+
- input: `public/sitemap-static-paths.json`
|
|
93
|
+
- generated output: `public/sitemap-paths.json`
|
|
94
|
+
- runtime endpoint: `/sitemap.xml` from Pages Function
|
|
95
|
+
|
|
96
|
+
### AI output constraints
|
|
97
|
+
|
|
98
|
+
- Do not request humans to hand-edit code before first run.
|
|
99
|
+
- After scaffolding, the only required manual step before first run is env values in `.env` / `.env.local`.
|
|
100
|
+
- Provide a final validation checklist and commands:
|
|
101
|
+
- `npm run build`
|
|
102
|
+
- `npm run dev`
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## Built-in defaults (use unless humans override later)
|
|
107
|
+
|
|
108
|
+
- Package: `@marvalt/digivalt-core@latest`
|
|
109
|
+
- Static data: template starter fixtures for WordPress, Gravity Forms, Mautic
|
|
110
|
+
- SEO: ON
|
|
111
|
+
- Cloudflare Functions + `wrangler.toml`: ON
|
|
112
|
+
- Form/page mapping: derive from WordPress content and shortcodes first
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Pre-flight checklist
|
|
117
|
+
|
|
118
|
+
| Step | Done |
|
|
119
|
+
|------|------|
|
|
120
|
+
| `@marvalt/digivalt-core@latest` installed | ☐ |
|
|
121
|
+
| `digivalt-init` run and scripts verified | ☐ |
|
|
122
|
+
| Required static data files exist (`wordpress`, `gravity-forms`, `mautic`) | ☐ |
|
|
123
|
+
| `sitemap-static-paths.json` exists and `sitemap-paths.json` is generated | ☐ |
|
|
124
|
+
| Cloudflare functions/wrangler files present | ☐ |
|
|
125
|
+
| SEO imports + `HelmetProvider` wired | ☐ |
|
|
126
|
+
| `.gitignore` excludes local secret files | ☐ |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Reference paths in this monorepo
|
|
131
|
+
|
|
132
|
+
| Concern | File |
|
|
133
|
+
|---------|------|
|
|
134
|
+
| Local setup baseline | [digivalt-landing/DIGIVALT_SETUP.md](../../../digivalt-landing/DIGIVALT_SETUP.md) |
|
|
135
|
+
| Template setup baseline | [template/DIGIVALT_SETUP.md](../template/DIGIVALT_SETUP.md) |
|
|
136
|
+
| Init behavior and script expectations | [README.md](../README.md) |
|
|
137
|
+
| Generator script template | [template/scripts/generate.ts](../template/scripts/generate.ts) |
|
|
138
|
+
| Landing generator implementation | [digivalt-landing/scripts/generate.ts](../../../digivalt-landing/scripts/generate.ts) |
|
|
139
|
+
| SEO and sitemap behavior | [docs/SEO-PERFORMANCE.md](./SEO-PERFORMANCE.md) |
|
|
140
|
+
| WP static getters and shell helpers | [src/static/wpStatic.ts](../src/static/wpStatic.ts) |
|
package/docs/SEO-PERFORMANCE.md
CHANGED
|
@@ -43,7 +43,15 @@ Read via `getPerformanceConfig()` from `@marvalt/digivalt-core/config`. Set to `
|
|
|
43
43
|
|
|
44
44
|
## Sitemap (`/sitemap.xml`)
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
**Runtime:** A **Cloudflare Pages Function** at **`functions/sitemap.xml.ts`** serves **`/sitemap.xml`**. It **`fetch`es `/sitemap-paths.json`** from the deployed static assets and uses **`VITE_SEO_SITE_URL`** (or **`SITE_URL`**) for canonical `<loc>` values (fallback: request origin). Do not add **`public/sitemap.xml`**; it would shadow the Function.
|
|
47
|
+
|
|
48
|
+
**Build time:** **`public/sitemap-paths.json`** is **generated** by **`@marvalt/digivalt-core/generators`** (`generateSitemapPaths`) at the end of **`generateAllData`**, and when **`VITE_IS_LOVABLE=true`** the app’s **`scripts/generate.ts`** still runs that step so paths stay in sync with committed **`wordpress-data.json`**. Sources merged:
|
|
49
|
+
|
|
50
|
+
1. **`public/sitemap-static-paths.json`** — you maintain this for **React-only / Lovable** public routes (not inferred from code).
|
|
51
|
+
2. **`navigation_menu`** items in **`wordpress-data.json`** (recursive `url` fields), filtered to **`http(s)`** and the CMS host from **`VITE_WORDPRESS_API_URL`** / **`WORDPRESS_API_URL`**.
|
|
52
|
+
3. **`link`** on entities in top-level arrays whose keys match **`config.post_types`** (fallback: other top-level arrays minus a fixed skip list). Taxonomy archives are omitted by default.
|
|
53
|
+
|
|
54
|
+
Paths are normalized (no trailing slash except **`/`**), deduped, and sorted. If generation fails, a safe fallback writes **`{ "paths": ["/"] }`**.
|
|
47
55
|
|
|
48
56
|
## Imports
|
|
49
57
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marvalt/digivalt-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.12",
|
|
4
4
|
"description": "Core glue logic and shared context for DigiVAlt frontend applications",
|
|
5
5
|
"license": "GPL-3.0-or-later",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -65,7 +65,8 @@
|
|
|
65
65
|
"clean": "rimraf dist",
|
|
66
66
|
"smoke:imports": "node ./scripts/smoke-imports.mjs",
|
|
67
67
|
"smoke:init": "node ./scripts/smoke-init.cjs",
|
|
68
|
-
"smoke": "
|
|
68
|
+
"smoke:sitemap": "node ./scripts/test-sitemap-paths.cjs",
|
|
69
|
+
"smoke": "npm run smoke:imports && npm run smoke:init && npm run smoke:sitemap",
|
|
69
70
|
"prepublishOnly": "npm run clean && npm run build && npm run smoke"
|
|
70
71
|
},
|
|
71
72
|
"devDependencies": {
|
|
@@ -84,7 +84,7 @@ Init will:
|
|
|
84
84
|
1. Install **`react-helmet-async`** and wrap your app with **`HelmetProvider`** at the root (next to the router).
|
|
85
85
|
2. Set at least **`VITE_SEO_SITE_URL`** (no trailing slash), **`VITE_SEO_SITE_NAME`**, **`VITE_SEO_DEFAULT_TITLE`**, **`VITE_SEO_DEFAULT_DESCRIPTION`**, and **`VITE_SEO_DEFAULT_OG_IMAGE`** in Cloudflare Pages / `.env.local`.
|
|
86
86
|
3. Import **`DigiValtSeoHead`** and **`JsonLd`** from **`@marvalt/digivalt-core/seo`** in your layouts or page components; pass **`pathname`** per route for correct canonical URLs.
|
|
87
|
-
4. **Sitemap:**
|
|
87
|
+
4. **Sitemap:** **`/sitemap.xml`** is served by **`functions/sitemap.xml.ts`**. **`public/sitemap-paths.json`** is **generated** when you run **`npm run build`** (or `generate`): it merges (a) **`public/sitemap-static-paths.json`** — edit this for Lovable/SPA-only routes, (b) URLs from **`navigation_menu`** in **`wordpress-data.json`**, (c) **`link`** pathnames from CPT/post arrays listed under **`config.post_types`**. Only CMS links whose host matches **`VITE_WORDPRESS_API_URL`** / **`WORDPRESS_API_URL`** are included. Canonical `<loc>` values use **`VITE_SEO_SITE_URL`** (or **`SITE_URL`**). Do not add **`public/sitemap.xml`** (it would shadow the Function). With **`VITE_IS_LOVABLE=true`**, static fetch is skipped but sitemap paths are still regenerated from committed JSON.
|
|
88
88
|
5. Read the full guide shipped with the package: **`node_modules/@marvalt/digivalt-core/docs/SEO-PERFORMANCE.md`** (or in the repo: `digivalt-npm-packages/digivalt-core/docs/SEO-PERFORMANCE.md`).
|
|
89
89
|
|
|
90
90
|
You are fully onboarded and ready to develop offline!
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Serves /sitemap.xml from canonical site URL + public/sitemap-paths.json (
|
|
2
|
+
* Serves /sitemap.xml from canonical site URL + public/sitemap-paths.json (generated at build).
|
|
3
3
|
* Set VITE_SEO_SITE_URL (or SITE_URL) on Cloudflare Pages for production canonical hosts.
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"_placeholder": true,
|
|
3
|
+
"_placeholder_note": "Replace with generated WordPress data before production.",
|
|
4
|
+
"generated_at": "1970-01-01T00:00:00.000Z",
|
|
5
|
+
"frontend_id": "lovable-starter",
|
|
6
|
+
"frontend_name": "Lovable Starter",
|
|
7
|
+
"front_page": null,
|
|
8
|
+
"site_settings": {
|
|
9
|
+
"site_name": "DigiValt Starter",
|
|
10
|
+
"site_description": "Placeholder data",
|
|
11
|
+
"logo": null,
|
|
12
|
+
"site_icon": null
|
|
13
|
+
},
|
|
14
|
+
"theme_styles": {
|
|
15
|
+
"colors": {
|
|
16
|
+
"theme_palette": []
|
|
17
|
+
},
|
|
18
|
+
"typography": {}
|
|
19
|
+
},
|
|
20
|
+
"header": {
|
|
21
|
+
"slug": "header",
|
|
22
|
+
"area": "header",
|
|
23
|
+
"blocks": [],
|
|
24
|
+
"blocks_count": 0
|
|
25
|
+
},
|
|
26
|
+
"footer": {
|
|
27
|
+
"slug": "footer",
|
|
28
|
+
"area": "footer",
|
|
29
|
+
"blocks": [],
|
|
30
|
+
"blocks_count": 0
|
|
31
|
+
},
|
|
32
|
+
"navigation_menu": {
|
|
33
|
+
"id": 0,
|
|
34
|
+
"name": "Primary",
|
|
35
|
+
"slug": "primary",
|
|
36
|
+
"items": []
|
|
37
|
+
},
|
|
38
|
+
"menus": {},
|
|
39
|
+
"pages": [],
|
|
40
|
+
"posts": [],
|
|
41
|
+
"config": {
|
|
42
|
+
"post_types": {}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -11,10 +11,13 @@ import { execSync } from 'child_process';
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
const secrets = {};
|
|
14
|
+
/** Keys we never push from .env / .env.local (local dev or set manually on Cloudflare Pages). */
|
|
14
15
|
const excludedKeys = new Set([
|
|
15
16
|
'NODE_ENV',
|
|
16
17
|
'VITE_IS_LOVABLE',
|
|
17
18
|
'VITE_LOCAL_DEVELOPMENT',
|
|
19
|
+
'VITE_AUTH_MODE',
|
|
20
|
+
'VITE_DEFAULT_MAX_ITEMS',
|
|
18
21
|
]);
|
|
19
22
|
|
|
20
23
|
// VITE_SEO_* are often public (verification meta, titles); allow upload when teams store them as Pages secrets.
|
|
@@ -27,13 +30,7 @@ const allowedPatterns = [
|
|
|
27
30
|
/^VITE_(WORDPRESS|WP|GF|GRAVITY_FORMS|FRONTEND|FRONTENDS|MAUTIC|SUITECRM|SUPABASE|CLOUDFLARE|AUTH|TURNSTILE|CHATWOOT|THEME|GOOGLE_|FACEBOOK_|LINKEDIN_)/,
|
|
28
31
|
];
|
|
29
32
|
|
|
30
|
-
const isAllowedSecretKey = (key) =>
|
|
31
|
-
if (excludedKeys.has(key)) {
|
|
32
|
-
return false;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return allowedPatterns.some((pattern) => pattern.test(key));
|
|
36
|
-
};
|
|
33
|
+
const isAllowedSecretKey = (key) => allowedPatterns.some((pattern) => pattern.test(key));
|
|
37
34
|
|
|
38
35
|
const parseEnvFile = (filePath) => {
|
|
39
36
|
if (!fs.existsSync(filePath)) return;
|
|
@@ -51,6 +48,11 @@ const parseEnvFile = (filePath) => {
|
|
|
51
48
|
const key = match[1].trim();
|
|
52
49
|
let value = match[2].trim();
|
|
53
50
|
|
|
51
|
+
if (excludedKeys.has(key)) {
|
|
52
|
+
console.log(`⚠️ Skipping ${key} (DigiVAlt: excluded from Cloudflare bulk upload)`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
54
56
|
if (!isAllowedSecretKey(key)) {
|
|
55
57
|
console.log(`⚠️ Skipping ${key} (not in DigiVAlt allowlist)`);
|
|
56
58
|
return;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
import { generateAllData } from '@marvalt/digivalt-core/generators';
|
|
1
|
+
import { generateAllData, generateSitemapPathsSafe } from '@marvalt/digivalt-core/generators';
|
|
2
2
|
|
|
3
3
|
async function runGenerators() {
|
|
4
4
|
console.log('🚀 Starting DigiVAlt static data generation for Landing Project...');
|
|
5
|
-
|
|
5
|
+
|
|
6
6
|
if (process.env.VITE_IS_LOVABLE === 'true') {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
console.log(
|
|
8
|
+
'⚡ Lovable Environment Detected (VITE_IS_LOVABLE). Skipping static data fetch; refreshing sitemap paths from committed JSON.'
|
|
9
|
+
);
|
|
10
|
+
await generateSitemapPathsSafe();
|
|
11
|
+
return;
|
|
9
12
|
}
|
|
10
|
-
|
|
13
|
+
|
|
11
14
|
try {
|
|
12
15
|
await generateAllData();
|
|
13
16
|
console.log('✅ Customized static generation complete!');
|
|
14
17
|
} catch (error) {
|
|
15
18
|
console.error('❌ Data fetching encountered an error, but continuing build gracefully:', error);
|
|
19
|
+
await generateSitemapPathsSafe();
|
|
16
20
|
}
|
|
17
21
|
}
|
|
18
22
|
|