Last active
          March 24, 2023 14:45 
        
      - 
      
- 
        Save joshnuss/a287981b45cd88f9ec72b3db43b48052 to your computer and use it in GitHub Desktop. 
Revisions
- 
        joshnuss revised this gist Mar 23, 2023 . No changes.There are no files selected for viewing
- 
        joshnuss created this gist Mar 23, 2023 .There are no files selected for viewingThis file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ # Create a vanilla SvelteKit project # usage: sk <folder-name> sk() { pnpm create svelte@latest $1 \ && cd $1 \ && pnpm install \ && git init \ && git add . \ && git commit -m 'Initial commit' } # Create a SvelteKit project with Prisma configured # usage: sk-prisma <folder-name> sk_prisma() { # replace dashes with underscores and add _dev suffix DB_NAME=$(echo "$1_dev" | sed s/-/_/g) DB_URL="postgresql://postgres:postgres@localhost:5432/$DB_NAME?schema=public" sk $1 \ && pnpm install -D prisma @prisma/client \ && pnpm prisma init --url "$DB_URL" \ && mkdir -p src/lib \ && echo -e "import { PrismaClient } from '@prisma/client'\n\nexport const db = new PrismaClient()" >> src/lib/db.server.js \ && git add . \ && git commit -m 'Added prisma' } # function names can't have dashes, but aliases can alias sk-prisma=sk_prisma