feat(seed): add seed script + fix Tailwind scanning adjacent projects
- scripts/seed.ts: inserts one complete test client with 3 phases, 6 tasks, 4 deliverables, 2 payments, 2 documents, 2 notes; prints shareable URL to console - globals.css: add @source not directives to exclude .01_projects/ and .claude/ — Tailwind v4 was scanning the SparklingOrbit .venv Python files and generating invalid CSS class [-:|] from a regex pattern in a markdown-it table parser, causing dev server 500s Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+107
@@ -0,0 +1,107 @@
|
||||
import { db } from '@/db';
|
||||
import {
|
||||
clients,
|
||||
phases,
|
||||
tasks,
|
||||
deliverables,
|
||||
payments,
|
||||
documents,
|
||||
notes,
|
||||
} from '@/db/schema';
|
||||
import { nanoid } from 'nanoid';
|
||||
|
||||
async function seed() {
|
||||
console.log('🌱 Seeding database...\n');
|
||||
|
||||
try {
|
||||
const clientToken = nanoid();
|
||||
const [client] = await db
|
||||
.insert(clients)
|
||||
.values({
|
||||
name: 'Test Client Inc.',
|
||||
brand_name: 'TestBrand',
|
||||
brief:
|
||||
'A comprehensive personal branding overhaul, positioning as a premium consultancy in the digital transformation space.',
|
||||
token: clientToken,
|
||||
accepted_total: '5000.00',
|
||||
})
|
||||
.returning();
|
||||
|
||||
console.log(`✓ Client created: ${client.name} (ID: ${client.id})`);
|
||||
|
||||
const [phase1, phase2, phase3] = await db
|
||||
.insert(phases)
|
||||
.values([
|
||||
{ client_id: client.id, title: 'Discovery & Strategy', sort_order: 1, status: 'done' },
|
||||
{ client_id: client.id, title: 'Design & Messaging', sort_order: 2, status: 'active' },
|
||||
{ client_id: client.id, title: 'Implementation & Launch', sort_order: 3, status: 'upcoming' },
|
||||
])
|
||||
.returning();
|
||||
|
||||
console.log('✓ Phases created (3 total)');
|
||||
|
||||
const [task1, task2, task3, task4, task5, task6] = await db
|
||||
.insert(tasks)
|
||||
.values([
|
||||
{ phase_id: phase1.id, title: 'Stakeholder interviews', description: 'In-depth conversations with leadership team', sort_order: 1, status: 'done' },
|
||||
{ phase_id: phase1.id, title: 'Competitive analysis', description: 'Research top 10 competitors in the space', sort_order: 2, status: 'done' },
|
||||
{ phase_id: phase2.id, title: 'Brand positioning document', description: 'Write and refine the core positioning statement', sort_order: 1, status: 'in_progress' },
|
||||
{ phase_id: phase2.id, title: 'Visual identity design', description: 'Logo, color palette, typography', sort_order: 2, status: 'in_progress' },
|
||||
{ phase_id: phase3.id, title: 'Website build & launch', description: 'Design and develop new company website', sort_order: 1, status: 'todo' },
|
||||
{ phase_id: phase3.id, title: 'Social media rollout', description: 'Launch branded social media accounts', sort_order: 2, status: 'todo' },
|
||||
])
|
||||
.returning();
|
||||
|
||||
console.log('✓ Tasks created (6 total)');
|
||||
|
||||
await db
|
||||
.insert(deliverables)
|
||||
.values([
|
||||
{ task_id: task1.id, title: 'Interview notes & synthesis', url: 'https://docs.google.com/document/d/1example', status: 'approved', approved_at: new Date('2026-04-15') },
|
||||
{ task_id: task2.id, title: 'Competitive landscape report', url: 'https://docs.google.com/presentation/d/1example', status: 'approved', approved_at: new Date('2026-04-20') },
|
||||
{ task_id: task3.id, title: 'Brand positioning document (draft)', url: 'https://docs.google.com/document/d/2example', status: 'submitted', approved_at: null },
|
||||
{ task_id: task4.id, title: 'Logo concepts (3 variations)', url: 'https://www.figma.com/file/example', status: 'pending', approved_at: null },
|
||||
]);
|
||||
|
||||
console.log('✓ Deliverables created (4 total)');
|
||||
|
||||
await db
|
||||
.insert(payments)
|
||||
.values([
|
||||
{ client_id: client.id, label: 'Acconto 50%', amount: '2500.00', status: 'saldato', paid_at: new Date('2026-04-01') },
|
||||
{ client_id: client.id, label: 'Saldo 50%', amount: '2500.00', status: 'inviata', paid_at: null },
|
||||
]);
|
||||
|
||||
console.log('✓ Payments created (2 total)');
|
||||
|
||||
await db
|
||||
.insert(documents)
|
||||
.values([
|
||||
{ client_id: client.id, label: 'Brand Guidelines PDF', url: 'https://example.com/brand-guidelines.pdf' },
|
||||
{ client_id: client.id, label: 'Design Mockups Figma', url: 'https://www.figma.com/file/example' },
|
||||
]);
|
||||
|
||||
console.log('✓ Documents created (2 total)');
|
||||
|
||||
await db
|
||||
.insert(notes)
|
||||
.values([
|
||||
{ client_id: client.id, body: 'Initial strategy session completed. Key insight: positioning needs to emphasize tech expertise and creative thinking balance.', created_at: new Date('2026-04-10') },
|
||||
{ client_id: client.id, body: 'Phase 1 approved. Moving forward with design phase. Stakeholders excited about direction.', created_at: new Date('2026-04-22') },
|
||||
]);
|
||||
|
||||
console.log('✓ Notes created (2 total)');
|
||||
|
||||
console.log('\n✨ Seed complete!\n');
|
||||
console.log('📎 Shareable client link:');
|
||||
console.log(` http://localhost:3000/c/${clientToken}\n`);
|
||||
console.log('This link is unique and secret. Send it to the client via Slack or email.\n');
|
||||
|
||||
process.exit(0);
|
||||
} catch (error) {
|
||||
console.error('❌ Seed failed:', error);
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
seed();
|
||||
@@ -1,4 +1,7 @@
|
||||
@import "tailwindcss";
|
||||
@source not "../../.01_projects/**";
|
||||
@source not "../../.claude/**";
|
||||
@source not "../../scripts/**";
|
||||
|
||||
/* =========================================================
|
||||
Design tokens — light & clean palette (Tailwind v4 @theme)
|
||||
|
||||
Reference in New Issue
Block a user