Skip to content

Commit

Permalink
Have a better setup for playground
Browse files Browse the repository at this point in the history
  • Loading branch information
needs committed Mar 5, 2024
1 parent 87a8cf2 commit c6a1b9f
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 47,8 @@ Thumbs.db

# NX cache
.nx/cache

# Playground
playground/*
!playground/example.ts
!playground/setup-playground.sh
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 4,10 @@
"license": "MIT",
"scripts": {
"preinstall": "npx only-allow npm",
"prepare": "husky install",
"prepare": "husky install && bash playground/setup-playground.sh",
"proxy-prod": "fly proxy 5434:5432 --app teerankio-postgres",
"playground": "ts-node scripts/playground.ts",
"playground-prod": "DATABASE_URL=postgres://postgres-test:postgres-test@localhost:5434/teerank ts-node scripts/playground.ts"
"playground:dev": "ts-node playground/playground.dev.ts",
"playground:prod": "DATABASE_URL=postgres://postgres-test:postgres-test@localhost:5434/teerank ts-node playground/playground.prod.ts"
},
"private": true,
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions scripts/playground.example.ts → playground/example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 7,8 @@ export const prisma = new PrismaClient({
});

async function main() {
// This is a playground to test the code. Run it using `npm run playground`
// or `npm run playground-prod`. Be careful with the code you write here if
// This is a playground to test the code. Run it using `npm run playground:dev`
// or `npm run playground:prod`. Be careful with the code you write here if
// you are running it against prod.
}

Expand Down
3 changes: 3 additions & 0 deletions playground/setup-playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 1,3 @@
cp -n playground/example.ts playground/playground.dev.ts
cp -n playground/example.ts playground/playground.prod.ts
echo "Playground setup complete"

0 comments on commit c6a1b9f

Please sign in to comment.