[DRAFT] CI: Trigger pipeline (lint/type/test/build/preview/budgets) #1

Merged
Nicholai merged 19 commits from ci-run-20250918-2021 into main 2025-10-06 10:46:23 +00:00
2 changed files with 36 additions and 0 deletions
Showing only changes of commit f692b45926 - Show all commits

3
.gitignore vendored
View File

@ -44,3 +44,6 @@ temp/**
# database backups (local exports)
backups/
# wrangler local state (do not commit)
.wrangler/

View File

@ -0,0 +1,33 @@
#!/usr/bin/env node
import { readdirSync } from 'node:fs';
import { spawnSync } from 'node:child_process';
import { join } from 'node:path';
const MIGRATIONS_DIR = join(process.cwd(), 'sql', 'migrations');
const DB_NAME = 'united-tattoo';
const useRemote = process.argv.includes('--remote');
// Gather UP migration files (exclude *_down.sql), sorted lexicographically
const files = readdirSync(MIGRATIONS_DIR)
.filter((f) => f.endsWith('.sql') && !f.endsWith('_down.sql'))
.sort();
if (files.length === 0) {
console.log('No migration files found in sql/migrations.');
process.exit(0);
}
for (const f of files) {
const full = join(MIGRATIONS_DIR, f);
const args = ['d1', 'execute', DB_NAME, '--file', full];
if (useRemote) args.splice(2, 0, '--remote');
console.log(`\nApplying migration: ${f}${useRemote ? ' [--remote]' : ''}`);
const res = spawnSync('wrangler', args, { stdio: 'inherit' });
if (res.status !== 0) {
console.error(`Migration failed for ${f}. Aborting.`);
process.exit(res.status ?? 1);
}
}
console.log('\nAll migrations applied successfully.');