@marvalt/digivalt-core 0.2.33 → 0.2.34

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 CHANGED
@@ -5,6 +5,15 @@ 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.34] - 2026-09-22
9
+
10
+ ### Added
11
+ - `digivalt-init` reports the app's dependency lockfile in preflight, warns when `.gitignore` excludes `package-lock.json`, and gives a manual action when no supported lockfile exists.
12
+ - Cloudflare Pages setup and AI scaffold guidance now require committing the package-manager lockfile so deployments install the tested dependency tree.
13
+ - Init smoke coverage for missing and ignored lockfiles.
14
+
15
+ **Publish/deploy:** publish **`@marvalt/digivalt-core@0.2.34`**. Consumer apps should upgrade and rerun `npx digivalt-init`; no WordPress plugin publish is required.
16
+
8
17
  ## [0.2.33] - 2026-09-19
9
18
 
10
19
  ### Added
package/README.md CHANGED
@@ -51,6 +51,7 @@ What init now does:
51
51
  - refreshes `scripts/generate.ts` when it matches an older DigiVAlt-managed version
52
52
  - warns instead of overwriting custom build logic or custom generator scripts
53
53
  - warns when a local `wpRegistry.tsx` / `createAppRegistry` is present; use the published `/registry` helpers when practical
54
+ - reports a missing dependency lockfile or a `package-lock.json` excluded by `.gitignore`; commit the lockfile before Cloudflare Pages deployment
54
55
  - reports stale legacy workarounds such as alias-link scripts and old root package generator imports
55
56
 
56
57
  When to rerun it:
package/bin/init.cjs CHANGED
@@ -51,6 +51,15 @@ const LEGACY_BUILD_MARKERS = [
51
51
  '@marvalt/digivalt-core',
52
52
  ];
53
53
 
54
+ const LOCKFILE_NAMES = [
55
+ 'package-lock.json',
56
+ 'npm-shrinkwrap.json',
57
+ 'pnpm-lock.yaml',
58
+ 'yarn.lock',
59
+ 'bun.lock',
60
+ 'bun.lockb',
61
+ ];
62
+
54
63
  function getArgValue(flag) {
55
64
  const index = args.indexOf(flag);
56
65
  return index >= 0 ? args[index + 1] : undefined;
@@ -223,6 +232,24 @@ function findLocalRegistryFiles(srcDir) {
223
232
  return matches;
224
233
  }
225
234
 
235
+ function packageLockIsIgnored() {
236
+ const gitignore = readTextIfExists(path.join(targetDir, '.gitignore'));
237
+ if (!gitignore) return false;
238
+
239
+ let ignored = false;
240
+ for (const rawLine of gitignore.split(/\r?\n/)) {
241
+ const line = rawLine.trim();
242
+ if (!line || line.startsWith('#')) continue;
243
+
244
+ const negated = line.startsWith('!');
245
+ const pattern = (negated ? line.slice(1) : line).replace(/^\//, '');
246
+ if (pattern === 'package-lock.json') {
247
+ ignored = !negated;
248
+ }
249
+ }
250
+ return ignored;
251
+ }
252
+
226
253
  function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
227
254
  const packageJson = readJson(targetPackageJsonPath);
228
255
  const scripts = packageJson.scripts || {};
@@ -295,6 +322,8 @@ function inspectTargetApp(targetPackageJsonPath, templateGenerateScript) {
295
322
  legacyRootImport: Boolean(generateScriptContent && generateScriptContent.includes("import { generators } from '@marvalt/digivalt-core';")),
296
323
  legacyViteConfigs,
297
324
  localRegistryFiles: findLocalRegistryFiles(path.join(targetDir, 'src')),
325
+ lockfiles: LOCKFILE_NAMES.filter((name) => fs.existsSync(path.join(targetDir, name))),
326
+ packageLockIgnored: packageLockIsIgnored(),
298
327
  };
299
328
  }
300
329
 
@@ -305,6 +334,7 @@ function printPreflight(status) {
305
334
  console.log(`- scripts.build: ${status.buildState}`);
306
335
  console.log(`- scripts.build:dev: ${status.buildDevState}`);
307
336
  console.log(`- scripts/generate.ts: ${status.generateState}`);
337
+ console.log(`- dependency lockfile: ${status.lockfiles.length > 0 ? status.lockfiles.join(', ') : 'missing'}`);
308
338
 
309
339
  if (status.legacyHackFiles.length > 0 || status.legacyPostinstall || status.legacyRootImport || status.legacyViteConfigs.length > 0) {
310
340
  console.log('- legacy DigiVAlt wiring detected: yes');
@@ -477,6 +507,18 @@ function collectLegacyWarnings(status) {
477
507
  `Local WordPress registry detected (${status.localRegistryFiles.join(', ')}). Prefer \`@marvalt/digivalt-core/registry\`; existing files were not overwritten.`
478
508
  );
479
509
  }
510
+
511
+ if (status.packageLockIgnored) {
512
+ report.warnings.push(
513
+ '`package-lock.json` is ignored by `.gitignore`. Remove that rule and commit the lockfile so Cloudflare Pages installs the tested dependency tree.'
514
+ );
515
+ }
516
+
517
+ if (status.lockfiles.length === 0) {
518
+ report.manualActions.push(
519
+ 'Generate and commit a dependency lockfile before deploying (for npm: run `npm install` and commit `package-lock.json`).'
520
+ );
521
+ }
480
522
  }
481
523
 
482
524
  function printList(title, items) {
@@ -503,9 +545,10 @@ function printSummary() {
503
545
  console.log('2. Copy `.env.local.example` to `.env.local`, fill secrets, and keep `.env.example` as the team-facing public template.');
504
546
  console.log('3. Copy `.dev.vars.example` to `.dev.vars` if you need local Wrangler secrets.');
505
547
  console.log('4. Confirm `wrangler.toml` matches your Cloudflare Pages project name.');
506
- console.log('5. Run `npm run build` to verify static generation now runs before `vite build`.');
507
- console.log('6. Run `node scripts/deploy-secrets.js` when you are ready to sync allowed env vars to Cloudflare Pages.');
508
- console.log('7. Run `node scripts/deploy-pages.js` (or `npm run deploy:pages`) to build and deploy via Wrangler.');
548
+ console.log('5. Commit your dependency lockfile so Cloudflare Pages installs the same dependency tree.');
549
+ console.log('6. Run `npm run build` to verify static generation now runs before `vite build`.');
550
+ console.log('7. Run `node scripts/deploy-secrets.js` when you are ready to sync allowed env vars to Cloudflare Pages.');
551
+ console.log('8. Run `node scripts/deploy-pages.js` (or `npm run deploy:pages`) to build and deploy via Wrangler.');
509
552
  }
510
553
 
511
554
  try {
@@ -14,6 +14,7 @@ Build a DigiValt consumer app with React, TypeScript, Vite, Tailwind, and Cloudf
14
14
  - Render WordPress page bodies with `DigiValtWpPage` or `createContentRegistry` from `@marvalt/digivalt-core/registry`.
15
15
  - Read app chrome with `getAppChrome()` from `@marvalt/digivalt-core/static`.
16
16
  - Keep `functions/`, `wrangler.toml`, SEO helpers, sitemap + robots Functions, prerender script, and generated sitemap flow enabled.
17
+ - Generate and commit the package-manager lockfile. For npm, do not ignore `package-lock.json`; Cloudflare Pages must install the tested tree rather than re-resolve dependency ranges.
17
18
  - Never commit `.env`, `.env.local`, `.env.*.local`, or `.dev.vars`.
18
19
  - Update `public/sitemap-static-paths.json` for public app routes. Never hand-edit generated `public/sitemap-paths.json`.
19
20
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marvalt/digivalt-core",
3
- "version": "0.2.33",
3
+ "version": "0.2.34",
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",
@@ -62,6 +62,9 @@ VITE_AUTH_MODE="direct"
62
62
 
63
63
  ## đŸŒŠī¸ 5. Deploy Infrastructure to Cloudflare
64
64
  Once you connect this GitHub repository to the Cloudflare Pages dashboard:
65
+
66
+ Before connecting the build, generate and commit your dependency lockfile. For npm, run `npm install`, ensure `.gitignore` does **not** exclude `package-lock.json`, and commit it. Pages must install the tested dependency tree rather than resolve fresh `^` ranges on every deployment.
67
+
65
68
  1. Open `wrangler.toml` and change `name="digivalt-landing-api"` to match the exact name of your Cloudflare Pages project.
66
69
  2. Run this automated script to inject your allowed DigiVAlt `.env` / `.env.local` variables into Cloudflare Pages:
67
70
  ```bash
@@ -73,6 +76,7 @@ node scripts/deploy-secrets.js
73
76
  Rerun `npx digivalt-init` after upgrading `@marvalt/digivalt-core` when DigiVAlt-managed scaffolding changes.
74
77
 
75
78
  Init will:
79
+ - report a missing dependency lockfile or a `package-lock.json` excluded by `.gitignore`
76
80
  - patch safe `package.json` script cases automatically
77
81
  - refresh older DigiVAlt-managed `scripts/generate.ts` files
78
82
  - reconcile the DigiValt-managed sections inside `.env.example` and `.env.local.example`