Skip to content

Commit 9678258

Browse files
committed
add seeds script
1 parent 2a1caa4 commit 9678258

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

epicshop/run-all-seeds.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
set -e
3+
4+
find exercises -path '*/src/db/seed.ts' | while read -r file; do
5+
if [ -f "$file" ]; then
6+
echo "🌱 Seeding $file"
7+
# we want to run the script from the root of the exercise directory
8+
# so that paths to the database are resolved correctly.
9+
dir=$(dirname "$file" | xargs dirname | xargs dirname)
10+
seed_file=${file#"$dir/"}
11+
(cd "$dir" && npx tsx "$seed_file")
12+
fi
13+
done
14+
15+
echo "✅ All seeds completed."

0 commit comments

Comments
 (0)