Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.6"
"ref": "v0.7.8"
}
}
},
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"formatVersion": 1,
"preset": "lvbt-web",
"release": "v0.7.6",
"commit": "71bd6ea8a314417be4d85829480444bb61bba232",
"contentHash": "8533976f630e4836a9fa2cda0bc43616b646f577ef896118b50f1fe349ca245c",
"release": "v0.7.8",
"commit": "3690a066080a394bb3af97dc5717844d3011a467",
"contentHash": "4221255e2e275d9630e40922f45132c25fc5787903eedb5d43b4c6a59b120103",
"executables": [
"examples/with-astro/.githooks/commit-msg",
"examples/with-astro/.githooks/pre-commit",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.6"
"ref": "v0.7.8"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"validate": "cf deploy --dry-run"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.6",
"@lasvegasfortransit/eslint-config": "0.7.8",
"@lasvegasfortransit/site": "workspace:*",
"@lasvegasfortransit/typescript-config": "0.7.6",
"@lasvegasfortransit/typescript-config": "0.7.8",
"cf": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
Expand Down
8 changes: 4 additions & 4 deletions .lvbt/web-platform/examples/with-astro/apps/site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
},
"devDependencies": {
"@astrojs/check": "catalog:",
"@lasvegasfortransit/eslint-config": "0.7.6",
"@lasvegasfortransit/playwright-config": "0.7.6",
"@lasvegasfortransit/typescript-config": "0.7.6",
"@lasvegasfortransit/vitest-config": "0.7.6",
"@lasvegasfortransit/eslint-config": "0.7.8",
"@lasvegasfortransit/playwright-config": "0.7.8",
"@lasvegasfortransit/typescript-config": "0.7.8",
"@lasvegasfortransit/vitest-config": "0.7.8",
"@playwright/test": "catalog:",
"@types/node": "catalog:",
"eslint": "catalog:",
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform/examples/with-astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"*": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@lasvegasfortransit/cli": "0.7.6",
"@lasvegasfortransit/prettier-config": "0.7.6",
"@lasvegasfortransit/cli": "0.7.8",
"@lasvegasfortransit/prettier-config": "0.7.8",
"lint-staged": "catalog:",
"markdownlint-cli2": "catalog:",
"markdownlint-rule-relative-links": "catalog:",
Expand All @@ -39,7 +39,7 @@
"typescript": "catalog:",
"wrangler": "catalog:",
"tsx": "catalog:",
"@lasvegasfortransit/web-platform": "0.7.6"
"@lasvegasfortransit/web-platform": "0.7.8"
},
"packageManager": "pnpm@11.25.0",
"engines": {
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/examples/with-astro/pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ overrides:
sharp: 0.35.5
'undici@^7.0.0': 7.29.1
'undici@^8.0.0': 8.10.2
smol-toml: 1.8.0
smol-toml: 1.9.0
source-map-js: 1.2.2
svgo: 4.1.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"source": {
"source": "github",
"repo": "LasVegasForTransit/repository-tooling",
"ref": "v0.7.6"
"ref": "v0.7.8"
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"react-dom": "catalog:"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.6",
"@lasvegasfortransit/playwright-config": "0.7.6",
"@lasvegasfortransit/typescript-config": "0.7.6",
"@lasvegasfortransit/vitest-config": "0.7.6",
"@lasvegasfortransit/eslint-config": "0.7.8",
"@lasvegasfortransit/playwright-config": "0.7.8",
"@lasvegasfortransit/typescript-config": "0.7.8",
"@lasvegasfortransit/vitest-config": "0.7.8",
"@playwright/test": "catalog:",
"@tailwindcss/vite": "catalog:",
"@types/node": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"validate": "cf deploy --dry-run"
},
"devDependencies": {
"@lasvegasfortransit/eslint-config": "0.7.6",
"@lasvegasfortransit/eslint-config": "0.7.8",
"@lasvegasfortransit/app": "workspace:*",
"@lasvegasfortransit/typescript-config": "0.7.6",
"@lasvegasfortransit/typescript-config": "0.7.8",
"cf": "catalog:",
"eslint": "catalog:",
"typescript": "catalog:",
Expand Down
6 changes: 3 additions & 3 deletions .lvbt/web-platform/examples/with-vite-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
"*": "prettier --write --ignore-unknown"
},
"devDependencies": {
"@lasvegasfortransit/cli": "0.7.6",
"@lasvegasfortransit/prettier-config": "0.7.6",
"@lasvegasfortransit/cli": "0.7.8",
"@lasvegasfortransit/prettier-config": "0.7.8",
"lint-staged": "catalog:",
"markdownlint-cli2": "catalog:",
"markdownlint-rule-relative-links": "catalog:",
Expand All @@ -38,7 +38,7 @@
"typescript": "catalog:",
"wrangler": "catalog:",
"tsx": "catalog:",
"@lasvegasfortransit/web-platform": "0.7.6"
"@lasvegasfortransit/web-platform": "0.7.8"
},
"packageManager": "pnpm@11.25.0",
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ overrides:
sharp: 0.35.5
'undici@^7.0.0': 7.29.1
'undici@^8.0.0': 8.10.2
smol-toml: 1.8.0
smol-toml: 1.9.0
source-map-js: 1.2.2
svgo: 4.1.0

Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/cli/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"sharp": "0.35.5",
"undici@^7.0.0": "7.29.1",
"undici@^8.0.0": "8.10.2",
"smol-toml": "1.8.0",
"smol-toml": "1.9.0",
"source-map-js": "1.2.2",
"svgo": "4.1.0"
},
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/cli",
"version": "0.7.6",
"version": "0.7.8",
"description": "The lvbt command every LVBT repository runs for bootstrap, preflight, and deploy, plus the production platform setup, the shared git hooks, and the lvbt-contributions agent plugin.",
"license": "MIT",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lvbt-contributions",
"version": "0.7.6",
"version": "0.7.8",
"description": "Create readable LVBT contributions and reconcile trusted audit and recurring issues through the organization workflow.",
"author": {
"name": "Las Vegans for Better Transit",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lvbt-contributions",
"version": "0.7.6",
"version": "0.7.8",
"description": "Create readable LVBT contributions and reconcile trusted audit and recurring issues through the organization workflow.",
"author": {
"name": "Las Vegans for Better Transit",
Expand Down
21 changes: 21 additions & 0 deletions .lvbt/web-platform/packages/cli/src/lib/git-hooks.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { spawnSync } from 'node:child_process';
import { CliError } from './arguments.mjs';

/** Protect a fresh checkout even when dependency installation never finishes. */
export function installGitHooks(cwd) {
const installed = spawnSync('git', ['config', '--local', 'core.hooksPath', '.githooks'], {
cwd,
encoding: 'utf8',
});
if (installed.status !== 0)
throw new CliError('bootstrap: cannot install Git hooks; run inside a Git checkout.', 1);
const effective = spawnSync('git', ['config', '--get', 'core.hooksPath'], {
cwd,
encoding: 'utf8',
});
if (effective.status !== 0 || effective.stdout.trim() !== '.githooks')
throw new CliError(
'bootstrap: another Git configuration overrides .githooks. Remove the override shown by git config --show-origin --get core.hooksPath, then rerun pnpm bootstrap.',
1,
);
}
6 changes: 4 additions & 2 deletions .lvbt/web-platform/packages/cli/src/lib/operate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { findManifests } from './platform/manifest.mjs';
import { platformBootstrap, platformPreflight } from './platform/index.mjs';
import { readTooling } from './tooling.mjs';
import { secretScannerFinding } from './check/secrets.mjs';
import { installGitHooks } from './git-hooks.mjs';

function output(command, args, cwd) {
const result = spawnSync(command, args, {
Expand Down Expand Up @@ -170,13 +171,13 @@ async function toolchainFindings(cwd, packageJson, report, { includeDependencies
}

async function repositoryFindings(cwd, report, { production = false } = {}) {
const hooksPath = output('git', ['config', '--local', 'core.hooksPath'], cwd);
const hooksPath = output('git', ['config', '--get', 'core.hooksPath'], cwd);
if (hooksPath === '.githooks') report.pass('git hooks', 'core.hooksPath is .githooks');
else
report.fail(
'git hooks',
`core.hooksPath is ${hooksPath ?? 'unset'}`,
'pnpm install # the prepare script sets it',
'pnpm bootstrap; remove any overriding hooks path shown by git config --show-origin --get core.hooksPath',
);

const scopes = await readFile(path.join(cwd, '.lvbt/commit-scopes.txt'), 'utf8').catch(
Expand Down Expand Up @@ -330,6 +331,7 @@ export async function preflight({ cwd, options = {} }) {
export async function bootstrap({ cwd, options = {} }) {
if (options.rotate !== undefined && !options.production)
throw new CliError('--rotate replaces production secrets, so it needs --production.', 2);
installGitHooks(cwd);
const tools = await machineFindings(cwd, { toolsOnly: true, includeDependencies: false });
if (tools) throw new CliError(tools, 1);
process.stdout.write('pnpm install\n');
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/eslint-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/eslint-config",
"version": "0.7.6",
"version": "0.7.8",
"description": "The ESLint configurations every LVBT repository uses.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/playwright-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/playwright-config",
"version": "0.7.6",
"version": "0.7.8",
"description": "The Playwright configuration every LVBT repository spreads into its own: end-to-end tests under tests/e2e, desktop and mobile projects, traces on failure.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/prettier-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/prettier-config",
"version": "0.7.6",
"version": "0.7.8",
"description": "The Prettier configuration every LVBT repository uses.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/typescript-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/typescript-config",
"version": "0.7.6",
"version": "0.7.8",
"description": "TypeScript configurations every LVBT repository extends.",
"license": "MIT",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/vitest-config/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/vitest-config",
"version": "0.7.6",
"version": "0.7.8",
"description": "The Vitest configuration every LVBT repository spreads into its own.",
"license": "MIT",
"type": "module",
Expand Down
2 changes: 1 addition & 1 deletion .lvbt/web-platform/packages/web-platform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lasvegasfortransit/web-platform",
"version": "0.7.6",
"version": "0.7.8",
"description": "Provider-neutral deployment, provisioning, and validation primitives for LVBT web repositories.",
"license": "MIT",
"type": "module",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { z } from 'zod';
import type { ReleaseConfiguration } from './release-config.js';
import { configuredReleaseIdentity, workerReleaseEntry } from './worker-release-entry.js';
import { sealSavedRelease, type WebsiteRelease } from './saved-release-artifact.js';
import { assertServiceWorkerIsolation, serviceWorkerBindingSchema } from './worker-bindings.js';

const dataset = z.strictObject({
type: z.literal('analytics-engine-dataset'),
Expand All @@ -18,7 +19,12 @@ const rateLimit = z.strictObject({
}),
});
const secret = z.strictObject({ type: z.literal('secret') });
const binding = z.discriminatedUnion('type', [dataset, rateLimit, secret]);
const binding = z.discriminatedUnion('type', [
dataset,
rateLimit,
secret,
serviceWorkerBindingSchema,
]);
const bindings = z.record(z.string().regex(/^[A-Z][A-Z0-9_]*$/), binding);
type Bindings = z.infer<typeof bindings>;
const modulePath = z
Expand Down Expand Up @@ -56,6 +62,12 @@ function assertBindingIsolation(
): void {
if (candidate?.type !== value.type)
throw new Error(`Preview binding ${name} must retain its declared type.`);
if (value.type === 'worker' && candidate.type === 'worker') {
if (candidate.worker === value.worker)
throw new Error(`Preview binding ${name} must use an isolated Worker service.`);
if (candidate.exportName !== value.exportName)
throw new Error(`Preview binding ${name} must retain its Worker service entrypoint.`);
}
if (
value.type === 'analytics-engine-dataset' &&
candidate.type === 'analytics-engine-dataset' &&
Expand Down Expand Up @@ -83,21 +95,29 @@ function previewBindings(production: Bindings, config: WorkerReleaseConfiguratio
throw new Error('Preview Worker and origin must be isolated from production.');
if (Object.keys(preview).sort().join(',') !== Object.keys(production).sort().join(','))
throw new Error('Preview bindings must explicitly match every production binding.');
assertServiceWorkerIsolation(production, preview, config.productionWorker);
for (const [name, value] of Object.entries(production))
assertBindingIsolation(name, value, preview[name]);
return preview;
}
function wranglerBindings(values: Bindings): Record<string, unknown> {
const analytics_engine_datasets = [];
const ratelimits = [];
const services = [];
for (const [name, value] of Object.entries(values)) {
if (value.type === 'analytics-engine-dataset')
analytics_engine_datasets.push({ binding: name, dataset: value.name });
if (value.type === 'rate-limit')
ratelimits.push({ name, namespace_id: value.namespace, simple: value.simple });
if (value.type === 'worker')
services.push({
binding: name,
service: value.worker,
...(value.exportName ? { entrypoint: value.exportName } : {}),
});
// Secrets belong to the target Worker; names declare requirements but never copy values.
}
return { analytics_engine_datasets, ratelimits };
return { analytics_engine_datasets, ratelimits, services };
}
async function copyModules(
source: string,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ export function typedWorkerConfiguration(
built.env,
config.previewBindings,
config.previewReadOnlyBindings,
config.productionWorker,
);
durableNamespaces(built, preview, config);
const assetNames = Object.entries(built.env)
Expand Down
Loading
Loading