Skip to content

Commit

Permalink
Try pnpm-node equivalent
Browse files Browse the repository at this point in the history
  • Loading branch information
farreldarian committed Dec 24, 2023
1 parent 30102fe commit 3aa8864
Show file tree
Hide file tree
Showing 9 changed files with 5,267 additions and 16 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,28 @@ jobs:
steps:
- uses: actions/checkout@v4

- uses: oven-sh/setup-bun@v1
- name: Install turbo globally
run: bun -g add turbo
- name: Install packages
run: bun install
# Bun
# - uses: oven-sh/setup-bun@v1
# - name: Install turbo globally
# run: bun -g add turbo
# - name: Install packages
# run: bun install
# -

# Pnpm
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: 20
cache: 'pnpm'
- name: Install turbo
run: pnpm -g add turbo
- name: Install dependencies
run: pnpm install
# -

- name: Set environment variables
run: |
Expand Down
Binary file removed bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions packages/generator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"dev": "tsup src/generator.ts src/bin.ts --watch",
"build": "tsup src/generator.ts src/bin.ts",
"prepack": "yarn build",
"test": "bun test"
"test": "vitest run --globals"
},
"dependencies": {
"@prisma/client": "5.7.0",
Expand All @@ -24,7 +24,8 @@
"fp-ts": "^2.16.1",
"lodash": "^4.17.21",
"pluralize": "^8.0.0",
"prettier": "3.1.1"
"prettier": "3.1.1",
"vitest": "^1.1.0"
},
"devDependencies": {
"@types/lodash": "^4.14.202",
Expand Down
11 changes: 7 additions & 4 deletions packages/usage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
"private": true,
"version": "1.0.0",
"license": "MIT",
"type": "module",
"scripts": {
"start": "bun run src/index.ts",
"test": "bun run scripts/test.ts",
"start": "tsx run src/index.ts",
"test": "tsx scripts/test.ts --globals",
"generate": "prisma generate"
},
"dependencies": {
Expand All @@ -19,9 +20,11 @@
"devDependencies": {
"@types/node": "20.10.4",
"@types/pg": "^8.10.9",
"bun-types": "^1.0.19",
"dotenv": "^16.3.1",
"prisma": "5.7.0",
"prisma-generator-drizzle": "workspace:*",
"typescript": "5.3.3"
"tsx": "^4.7.0",
"typescript": "5.3.3",
"vitest": "^1.1.0"
}
}
2 changes: 1 addition & 1 deletion packages/usage/prisma/mysql/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generator drizzle {
provider = "bunx prisma-generator-drizzle"
provider = "prisma-generator-drizzle"
}

datasource db {
Expand Down
2 changes: 1 addition & 1 deletion packages/usage/prisma/schema.prisma
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
generator drizzle {
provider = "bunx prisma-generator-drizzle"
provider = "prisma-generator-drizzle"
}

datasource db {
Expand Down
7 changes: 4 additions & 3 deletions packages/usage/scripts/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { execSync } from 'child_process'
import { object, parse, string, url } from 'valibot'
import 'dotenv/config'

const env = parse(
object({
Expand All @@ -11,15 +12,15 @@ const env = parse(

const promises = [
execSync(
`DATABASE_URL=${env.PG_DATABASE_URL} bun prisma db push --schema prisma/schema.prisma --force-reset --accept-data-loss`
`DATABASE_URL=${env.PG_DATABASE_URL} prisma db push --schema prisma/schema.prisma --force-reset --accept-data-loss`
),
execSync(
`DATABASE_URL=${env.MYSQL_DATABASE_URL} bun prisma db push --schema prisma/mysql/schema.prisma --force-reset --accept-data-loss`
`DATABASE_URL=${env.MYSQL_DATABASE_URL} prisma db push --schema prisma/mysql/schema.prisma --force-reset --accept-data-loss`
),
]

await Promise.all(promises)

execSync('bun test', { stdio: 'inherit' })
execSync('vitest run --globals', { stdio: 'inherit' })

process.exit(0)
Loading

0 comments on commit 3aa8864

Please sign in to comment.