deckhearth/scripts/create-sample-cards.js
Randall Stillwell 1cc2e28423 Migrate Deck Hearth off Vercel/Neon to homelab Dokploy stack.
Replace @vercel/postgres, Blob, and Upstash with lib/sql.js, MinIO object
storage, and CT 102 Redis rate limits. Add Dockerfile for Dokploy deploy,
homelab runbooks, Neon data-copy helper, and point CI smoke/visual at the
homelab URL instead of Vercel previews.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-08-15 09:32:13 -05:00

125 lines
4.2 KiB
JavaScript
Executable file

#!/usr/bin/env node
import { config } from 'dotenv';
import { sql } from '../lib/sql.js';
// Load environment variables
config({ path: '.env.local' });
async function createSampleCards() {
try {
console.log('🃏 Creating sample cards...\n');
const sampleCards = [
{
name: 'Lightning Bolt',
set_name: 'Alpha',
set_code: 'LEA',
card_number: '161',
rarity: 'Common',
game: 'MTG',
mana_cost: '{R}',
cmc: 1,
card_type: 'Instant',
colors: '["Red"]',
oracle_text: 'Lightning Bolt deals 3 damage to any target.',
image_url: 'https://cards.scryfall.io/normal/front/c/e/ce711943-c1a1-43a0-8b89-8d169cfb8e06.jpg',
market_price: 2.50
},
{
name: 'Black Lotus',
set_name: 'Alpha',
set_code: 'LEA',
card_number: '232',
rarity: 'Rare',
game: 'MTG',
mana_cost: '{0}',
cmc: 0,
card_type: 'Artifact',
colors: '[]',
oracle_text: '{T}, Sacrifice Black Lotus: Add three mana of any one color.',
image_url: 'https://cards.scryfall.io/normal/front/b/d/bd8fa327-dd41-4737-8f19-2cf5eb1f7cdd.jpg',
market_price: 25000.00
},
{
name: 'Pikachu',
set_name: 'Base Set',
set_code: 'BS1',
card_number: '25',
rarity: 'Common',
game: 'Pokemon',
card_type: 'Basic Pokemon',
oracle_text: 'When several of these Pokemon gather, their electricity could build and cause lightning storms.',
image_url: 'https://images.pokemontcg.io/base1/25_hires.png',
market_price: 8.50
},
{
name: 'Charizard',
set_name: 'Base Set',
set_code: 'BS1',
card_number: '4',
rarity: 'Rare Holo',
game: 'Pokemon',
card_type: 'Stage 2 Pokemon',
oracle_text: 'Spits fire that is hot enough to melt boulders. Known to cause forest fires unintentionally.',
image_url: 'https://images.pokemontcg.io/base1/4_hires.png',
market_price: 350.00
},
{
name: 'Mickey Mouse - Brave Little Tailor',
set_name: 'The First Chapter',
set_code: 'TFC',
card_number: '1',
rarity: 'Legendary',
game: 'Lorcana',
card_type: 'Character',
oracle_text: 'Bravery - When you play this character, you may banish chosen character.',
image_url: 'https://cdn.lorcana-api.com/images/tfc/001_en_mickey_mouse-716.webp',
market_price: 45.00
},
{
name: 'Elsa - Snow Queen',
set_name: 'The First Chapter',
set_code: 'TFC',
card_number: '43',
rarity: 'Super Rare',
game: 'Lorcana',
card_type: 'Character',
oracle_text: 'Deep Freeze - Exert chosen character. They can\'t ready at the start of their next turn.',
image_url: 'https://cdn.lorcana-api.com/images/tfc/043_en_elsa-716.webp',
market_price: 15.75
}
];
for (const card of sampleCards) {
await sql`
INSERT INTO cards (
name, set_name, set_code, card_number, rarity, game,
mana_cost, cmc, card_type, colors, oracle_text,
image_url, market_price, verified
) VALUES (
${card.name}, ${card.set_name}, ${card.set_code}, ${card.card_number},
${card.rarity}, ${card.game}, ${card.mana_cost || null}, ${card.cmc || null},
${card.card_type}, ${card.colors || null}, ${card.oracle_text},
${card.image_url}, ${card.market_price}, true
)
`;
console.log(`✅ Added ${card.name} (${card.game})`);
}
console.log('\n🎉 Sample cards created successfully!');
console.log('\n🃏 Available Cards:');
console.log(' • Lightning Bolt (MTG) - $2.50');
console.log(' • Black Lotus (MTG) - $25,000');
console.log(' • Pikachu (Pokemon) - $8.50');
console.log(' • Charizard (Pokemon) - $350');
console.log(' • Mickey Mouse (Lorcana) - $45');
console.log(' • Elsa (Lorcana) - $15.75');
} catch (error) {
console.error('❌ Failed to create sample cards:', error.message);
process.exit(1);
}
}
createSampleCards();