@marvalt/digivalt-core 0.2.13 → 0.2.16
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 +19 -0
- package/README.md +4 -2
- package/bin/env-example-fragments.cjs +6 -1
- package/dist/generators/enabled-post-types.d.ts +5 -0
- package/dist/generators/index.d.ts +1 -0
- package/dist/generators.cjs +33 -9
- package/dist/generators.cjs.map +1 -1
- package/dist/generators.d.ts +7 -1
- package/dist/generators.esm.js +30 -10
- package/dist/generators.esm.js.map +1 -1
- package/dist/index.cjs +38 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +12 -2
- package/dist/index.esm.js +35 -11
- package/dist/index.esm.js.map +1 -1
- package/docs/ENVIRONMENT.md +51 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ 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.16] - 2026-05-29
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
- Google Reviews static generation is now **opt-in** via **`google_reviews`** in **`VITE_ENABLED_POST_TYPES`**. When absent, `generateGoogleReviewsData()` skips (build continues). When present, fetch still hard-fails on error. Explicit `GOOGLE_REVIEWS_API_URL` / `VITE_GOOGLE_REVIEWS_API_URL` does not enable fetch without `google_reviews` in post types.
|
|
12
|
+
- **`google_reviews`** is filtered from WordPress CPT fetch list (pseudo-type, not passed to `@marvalt/wadapter`).
|
|
13
|
+
|
|
14
|
+
### Added
|
|
15
|
+
- **`enabled-post-types.ts`:** shared helpers `parseEnabledPostTypes`, `isGoogleReviewsEnabled`, `getWordPressPostTypes` (exported from `@marvalt/digivalt-core/generators`).
|
|
16
|
+
- Smoke test **`scripts/test-google-reviews-gate.cjs`**.
|
|
17
|
+
|
|
18
|
+
## [0.2.14] - 2026-04-23
|
|
19
|
+
|
|
20
|
+
### Added
|
|
21
|
+
- **`docs/ENVIRONMENT.md`:** handover doc for developers and DevOps (two-file model, `digivalt-init` managed block, `deploy-secrets` allowlist/excludes, wrangler, variable groups). Linked from the package README.
|
|
22
|
+
- **Reference templates:** [`.env.example`](.env.example) and [`.env.local.example`](.env.local.example) at the package root (same shape as `npx digivalt-init`); keep in sync with [`bin/env-example-fragments.cjs`](bin/env-example-fragments.cjs) when changing managed lines.
|
|
23
|
+
|
|
24
|
+
### Changed
|
|
25
|
+
- **`bin/env-example-fragments.cjs`:** optional commented lines for `VITE_THEME` and `VITE_SUITECRM_TOKEN_URL` to match `loadTheme` in `config/themes` and SuiteCRM direct-mode token URL support.
|
|
26
|
+
|
|
8
27
|
## [0.2.13] - 2026-04-20
|
|
9
28
|
|
|
10
29
|
### Added
|
package/README.md
CHANGED
|
@@ -8,7 +8,9 @@ Core DigiVAlt package for static data generation, runtime service wiring, and Cl
|
|
|
8
8
|
npm install @marvalt/digivalt-core
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Full handover reference for env vars (developers and DevOps): **[docs/ENVIRONMENT.md](./docs/ENVIRONMENT.md)**.
|
|
12
|
+
|
|
13
|
+
In the **DigiVAlt monorepo**, **`digivalt-landing`** is the reference Vite app used to test this package with WordPress plugins and Cloudflare Pages.
|
|
12
14
|
|
|
13
15
|
## Entry Points
|
|
14
16
|
|
|
@@ -57,7 +59,7 @@ When to rerun it:
|
|
|
57
59
|
|
|
58
60
|
**Sitemap:** Each build regenerates **`public/sitemap-paths.json`** from **`public/sitemap-static-paths.json`** (paths you add for SPA-only routes) plus WordPress menu and CPT links in **`wordpress-data.json`**. See **[docs/SEO-PERFORMANCE.md](./docs/SEO-PERFORMANCE.md)**.
|
|
59
61
|
|
|
60
|
-
**Google Reviews static data:**
|
|
62
|
+
**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).
|
|
61
63
|
|
|
62
64
|
**AI builders (Cursor / Claude Code / Antigravity / Lovable):**
|
|
63
65
|
- Tool-agnostic master prompt: **[docs/LOVABLE-MASTER-PROMPT.md](./docs/LOVABLE-MASTER-PROMPT.md)**
|
|
@@ -9,7 +9,7 @@ VITE_WORDPRESS_API_URL=https://cms.example.com/wp-json
|
|
|
9
9
|
VITE_AUTH_MODE=direct
|
|
10
10
|
VITE_CLOUDFLARE_WORKER_URL=
|
|
11
11
|
VITE_LOCAL_DEVELOPMENT=false
|
|
12
|
-
# Optional explicit endpoint for vibune-google-reviews static generation.
|
|
12
|
+
# Optional explicit endpoint for vibune-google-reviews static generation (only when google_reviews is in VITE_ENABLED_POST_TYPES).
|
|
13
13
|
# Defaults to <WORDPRESS_API_URL>/vibune-google-reviews/v1/reviews.
|
|
14
14
|
# VITE_GOOGLE_REVIEWS_API_URL=https://cms.example.com/wp-json/vibune-google-reviews/v1/reviews
|
|
15
15
|
|
|
@@ -17,9 +17,12 @@ VITE_LOCAL_DEVELOPMENT=false
|
|
|
17
17
|
VITE_FRONTEND_ID=my-app
|
|
18
18
|
VITE_FRONTEND_NAME=My App
|
|
19
19
|
|
|
20
|
+
# Comma-separated WordPress CPT slugs plus optional pseudo-types (e.g. google_reviews for vibune-google-reviews static fetch).
|
|
20
21
|
VITE_ENABLED_POST_TYPES=posts,pages
|
|
21
22
|
VITE_DEFAULT_MAX_ITEMS=200
|
|
22
23
|
VITE_USE_DSTYLER=true
|
|
24
|
+
# Optional theme name (default digivalt_core; see loadTheme in config/themes)
|
|
25
|
+
# VITE_THEME=
|
|
23
26
|
|
|
24
27
|
# Optional: Gravity Forms API base if not derived from WordPress URL
|
|
25
28
|
# VITE_GRAVITY_FORMS_API_URL=
|
|
@@ -29,6 +32,8 @@ VITE_MAUTIC_URL=
|
|
|
29
32
|
VITE_MAUTIC_PROXY_URL=
|
|
30
33
|
VITE_SUITECRM_URL=
|
|
31
34
|
VITE_SUITECRM_PROXY_URL=
|
|
35
|
+
# Optional; OAuth token endpoint if not the default for your SuiteCRM
|
|
36
|
+
# VITE_SUITECRM_TOKEN_URL=
|
|
32
37
|
VITE_SUPABASE_URL=
|
|
33
38
|
VITE_SUPABASE_ANON_KEY=
|
|
34
39
|
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Integration tokens in VITE_ENABLED_POST_TYPES that are not WordPress CPTs. */
|
|
2
|
+
export declare const PSEUDO_POST_TYPES: Set<string>;
|
|
3
|
+
export declare function parseEnabledPostTypes(): string[];
|
|
4
|
+
export declare function isGoogleReviewsEnabled(): boolean;
|
|
5
|
+
export declare function getWordPressPostTypes(): string[];
|
package/dist/generators.cjs
CHANGED
|
@@ -1826,6 +1826,30 @@ async function generateGravityFormsData$1(config) {
|
|
|
1826
1826
|
return generator.generateStaticData();
|
|
1827
1827
|
}
|
|
1828
1828
|
|
|
1829
|
+
const DEFAULT_ENABLED_POST_TYPES = 'posts,pages';
|
|
1830
|
+
/** Integration tokens in VITE_ENABLED_POST_TYPES that are not WordPress CPTs. */
|
|
1831
|
+
const PSEUDO_POST_TYPES = new Set(['google_reviews']);
|
|
1832
|
+
const POST_TYPE_ALIASES = {
|
|
1833
|
+
members: 'member',
|
|
1834
|
+
testimonials: 'testimonial',
|
|
1835
|
+
faqs: 'faq',
|
|
1836
|
+
eventbrite_events: 'eventbrite_event',
|
|
1837
|
+
};
|
|
1838
|
+
function parseEnabledPostTypes() {
|
|
1839
|
+
const raw = process.env.VITE_ENABLED_POST_TYPES ||
|
|
1840
|
+
process.env.ENABLED_POST_TYPES ||
|
|
1841
|
+
DEFAULT_ENABLED_POST_TYPES;
|
|
1842
|
+
return raw.split(',').map((pt) => pt.trim()).filter(Boolean);
|
|
1843
|
+
}
|
|
1844
|
+
function isGoogleReviewsEnabled() {
|
|
1845
|
+
return parseEnabledPostTypes().includes('google_reviews');
|
|
1846
|
+
}
|
|
1847
|
+
function getWordPressPostTypes() {
|
|
1848
|
+
return parseEnabledPostTypes()
|
|
1849
|
+
.filter((pt) => !PSEUDO_POST_TYPES.has(pt))
|
|
1850
|
+
.map((pt) => POST_TYPE_ALIASES[pt] || pt);
|
|
1851
|
+
}
|
|
1852
|
+
|
|
1829
1853
|
async function generateWordPressData(options) {
|
|
1830
1854
|
const outputPath = options?.outputPath || './public/wordpress-data.json';
|
|
1831
1855
|
const apiUrl = process.env.WORDPRESS_API_URL || process.env.VITE_WORDPRESS_API_URL;
|
|
@@ -1851,15 +1875,7 @@ async function generateWordPressData(options) {
|
|
|
1851
1875
|
cfAccessClientId,
|
|
1852
1876
|
cfAccessClientSecret,
|
|
1853
1877
|
};
|
|
1854
|
-
const
|
|
1855
|
-
const rawPostTypes = enabledPostTypes.split(',').map(pt => pt.trim()).filter(Boolean);
|
|
1856
|
-
const postTypeMapping = {
|
|
1857
|
-
'members': 'member',
|
|
1858
|
-
'testimonials': 'testimonial',
|
|
1859
|
-
'faqs': 'faq',
|
|
1860
|
-
'eventbrite_events': 'eventbrite_event',
|
|
1861
|
-
};
|
|
1862
|
-
const postTypes = rawPostTypes.map(pt => postTypeMapping[pt] || pt);
|
|
1878
|
+
const postTypes = getWordPressPostTypes();
|
|
1863
1879
|
const frontendId = process.env.VITE_FRONTEND_ID || process.env.FRONTEND_ID || undefined;
|
|
1864
1880
|
const frontendName = process.env.VITE_FRONTEND_NAME || process.env.FRONTEND_NAME || 'Default Frontend';
|
|
1865
1881
|
try {
|
|
@@ -2507,6 +2523,10 @@ function truncateBody(body, max = 1200) {
|
|
|
2507
2523
|
return `${body.slice(0, max)}...`;
|
|
2508
2524
|
}
|
|
2509
2525
|
async function generateGoogleReviewsData(options) {
|
|
2526
|
+
if (!isGoogleReviewsEnabled()) {
|
|
2527
|
+
console.log('⚠️ Skipping Google Reviews data generation (google_reviews not in VITE_ENABLED_POST_TYPES).');
|
|
2528
|
+
return true;
|
|
2529
|
+
}
|
|
2510
2530
|
const outputPath = options?.outputPath || './public/google-reviews-data.json';
|
|
2511
2531
|
const endpointUrl = resolveEndpointUrl();
|
|
2512
2532
|
if (!endpointUrl) {
|
|
@@ -2772,6 +2792,7 @@ async function generateAllData() {
|
|
|
2772
2792
|
console.log('✅ Generation complete!');
|
|
2773
2793
|
}
|
|
2774
2794
|
|
|
2795
|
+
exports.PSEUDO_POST_TYPES = PSEUDO_POST_TYPES;
|
|
2775
2796
|
exports.generateAllData = generateAllData;
|
|
2776
2797
|
exports.generateGoogleReviewsData = generateGoogleReviewsData;
|
|
2777
2798
|
exports.generateGravityFormsData = generateGravityFormsData;
|
|
@@ -2780,4 +2801,7 @@ exports.generateSitemapPaths = generateSitemapPaths;
|
|
|
2780
2801
|
exports.generateSitemapPathsSafe = generateSitemapPathsSafe;
|
|
2781
2802
|
exports.generateSuiteCRMData = generateSuiteCRMData;
|
|
2782
2803
|
exports.generateWordPressData = generateWordPressData;
|
|
2804
|
+
exports.getWordPressPostTypes = getWordPressPostTypes;
|
|
2805
|
+
exports.isGoogleReviewsEnabled = isGoogleReviewsEnabled;
|
|
2806
|
+
exports.parseEnabledPostTypes = parseEnabledPostTypes;
|
|
2783
2807
|
//# sourceMappingURL=generators.cjs.map
|