-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathseed-pokemon.js
More file actions
121 lines (113 loc) · 3.94 KB
/
Copy pathseed-pokemon.js
File metadata and controls
121 lines (113 loc) · 3.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
import { createClient } from "@base44/sdk";
import fs from "fs";
// Read app ID from config (strip comments from JSONC)
const configContent = fs.readFileSync("./base44/.app.jsonc", "utf8");
const jsonContent = configContent.split('\n').filter(line => !line.trim().startsWith('//')).join('\n');
const appConfig = JSON.parse(jsonContent);
const base44 = createClient({ appId: appConfig.id });
// Note: This will use the logged-in user's session from CLI
const Pokemon = base44.entities.Pokemon;
const funPokemons = [
{
name: "Sparklefluff",
type: "Electric",
description: "A fluffy cloud creature that shoots rainbow lightning! ⚡✨",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=sparklefluff&backgroundColor=yellow",
rarity: "Rare",
power_level: 75
},
{
name: "Bubbleblob",
type: "Water",
description: "A jiggly water balloon friend that loves to splash! 💧🎈",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=bubbleblob&backgroundColor=blue",
rarity: "Common",
power_level: 45
},
{
name: "Gigglewing",
type: "Fairy",
description: "Giggles so much it floats in the air! Makes everyone laugh! 😄✨",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=gigglewing&backgroundColor=pink",
rarity: "Uncommon",
power_level: 55
},
{
name: "Blazetail",
type: "Fire",
description: "A speedy fox with a flaming tail! Super fast and warm! 🔥🦊",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=blazetail&backgroundColor=red",
rarity: "Rare",
power_level: 80
},
{
name: "Leafhopper",
type: "Grass",
description: "Hops around gardens and makes flowers bloom instantly! 🌿🌸",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=leafhopper&backgroundColor=green",
rarity: "Common",
power_level: 40
},
{
name: "Thunderpaws",
type: "Electric",
description: "A puppy with electric paws! Zaps away bad dreams! ⚡🐕",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=thunderpaws&backgroundColor=yellow",
rarity: "Epic",
power_level: 85
},
{
name: "Frostwhisker",
type: "Ice",
description: "A cool cat that makes ice cream appear from thin air! ❄️🍦",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=frostwhisker&backgroundColor=lightblue",
rarity: "Rare",
power_level: 70
},
{
name: "Skydancer",
type: "Flying",
description: "Paints rainbows in the sky while dancing on clouds! 🌈☁️",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=skydancer&backgroundColor=lightblue",
rarity: "Epic",
power_level: 90
},
{
name: "Rockhopper",
type: "Rock",
description: "A friendly rock penguin that builds the coolest forts! 🪨🐧",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=rockhopper&backgroundColor=gray",
rarity: "Uncommon",
power_level: 60
},
{
name: "Dreamsparkle",
type: "Psychic",
description: "Reads minds and turns dreams into reality! The ultimate wish granter! 🔮💫",
image_url: "https://api.dicebear.com/7.x/bottts/svg?seed=dreamsparkle&backgroundColor=purple",
rarity: "Legendary",
power_level: 95
}
];
async function seedPokemons() {
console.log("🎮 Starting to seed Pokémons...");
try {
// Check if pokemons already exist
const existing = await Pokemon.list();
if (existing.length > 0) {
console.log(`⚠️ Found ${existing.length} existing Pokémons. Skipping seed.`);
return;
}
// Create all pokemons
for (const pokemon of funPokemons) {
console.log(`Creating ${pokemon.name}...`);
await Pokemon.create(pokemon);
}
console.log(`✨ Successfully created ${funPokemons.length} Pokémons!`);
console.log("🎉 Your Pokémon app is ready to play!");
} catch (error) {
console.error("❌ Error seeding Pokémons:", error);
process.exit(1);
}
}
seedPokemons();