carlos / carloku Public

The ordinary site build runs the price book check too

npm run build now refuses a pricing page built from a draft book the
same way npm run check does, so neither entry point publishes one.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev 9427c22a82a6c87bfafd6fc114b7a55783129ba5 parent 4feb1cd
2 files changed, +6 −1
  • package.json +1 −1
  • test/pricing-pricebook.test.mjs +5 −0
diff --git a/package.json b/package.json
index b897737..8f0e8a8 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"private": true,
"type": "module",
"scripts": {
- "build": "eleventy",
+ "build": "node hack/check-pricebook.mjs && eleventy",
"serve": "eleventy --serve",
"check": "eleventy && node hack/check-docs.mjs && node hack/check-pricebook.mjs && node --test test/*.test.mjs"
},
diff --git a/test/pricing-pricebook.test.mjs b/test/pricing-pricebook.test.mjs
index 6e1ad2f..5a1249c 100644
--- a/test/pricing-pricebook.test.mjs
+++ b/test/pricing-pricebook.test.mjs
@@ -148,6 +148,11 @@ test('a page built from a draft book says so on its first line, and the check re
assert.throws(() => execFileSync('node', [check], { stdio: 'pipe', env: envWith(v) }), /must not be published/, `check with ${JSON.stringify(v)}`);
assert.throws(() => execFileSync('node', [build], { stdio: 'pipe', env: envWith(v) }), /not approved/, `build with ${JSON.stringify(v)}`);
}
+ // The ordinary build runs the check too, so a draft page cannot be
+ // published by `npm run build` any more than by `npm run check`.
+ const scripts = JSON.parse(readFileSync(new URL('package.json', root), 'utf8')).scripts;
+ assert.ok(scripts.build.startsWith('node hack/check-pricebook.mjs && '), scripts.build);
+ assert.ok(scripts.check.includes('node hack/check-pricebook.mjs'), scripts.check);
// A refused build still wrote the preview, for review.
assert.ok(readFileSync(new URL('copy-review/pricing/preview/index.html', root), 'utf8').includes('data-pricing-currency'));
execFileSync('node', [check], { stdio: 'pipe', env: envWith('1') });