build: use pnpm for the deploy
This commit is contained in:
parent
64e358f61c
commit
bac8813a8d
36 changed files with 19068 additions and 29560 deletions
|
|
@ -4,14 +4,23 @@
|
|||
"license": "../LICENSE",
|
||||
"type": "module",
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.0.0",
|
||||
"@types/pg": "^8.11.10",
|
||||
"kysely-codegen": "^0.18.5",
|
||||
"typescript": "^5.8.3"
|
||||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"types": "./src/index.ts",
|
||||
"default": "./lib/index.js"
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"build": "tsc --build",
|
||||
"start": "tsc --watch",
|
||||
"clean": "rm -rf lib",
|
||||
"generate-types": "kysely-codegen --camel-case --out-file ./src/types/types.d.ts"
|
||||
"dev": "tsc --watch",
|
||||
"generate-types": "kysely-codegen --camel-case --out-file ./src/types/types.d.ts",
|
||||
"postinstall": "npm run build"
|
||||
},
|
||||
"dependencies": {
|
||||
"kysely": "^0.28.2",
|
||||
|
|
|
|||
|
|
@ -1,7 +1,14 @@
|
|||
import { DB } from './types/types.js'
|
||||
import { Pool } from 'pg'
|
||||
import { Kysely, PostgresDialect, CamelCasePlugin } from 'kysely'
|
||||
import { PSQL_URL } from 'lamassu-server/lib/constants.js'
|
||||
|
||||
const POSTGRES_USER = process.env.POSTGRES_USER
|
||||
const POSTGRES_PASSWORD = process.env.POSTGRES_PASSWORD
|
||||
const POSTGRES_HOST = process.env.POSTGRES_HOST
|
||||
const POSTGRES_PORT = process.env.POSTGRES_PORT
|
||||
const POSTGRES_DB = process.env.POSTGRES_DB
|
||||
|
||||
const PSQL_URL = `postgres://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}`
|
||||
|
||||
const dialect = new PostgresDialect({
|
||||
pool: new Pool({
|
||||
|
|
@ -13,12 +20,4 @@ const dialect = new PostgresDialect({
|
|||
export default new Kysely<DB>({
|
||||
dialect,
|
||||
plugins: [new CamelCasePlugin()],
|
||||
log(event) {
|
||||
if (event.level === 'query') {
|
||||
console.log('Query:', event.query.sql)
|
||||
console.log('Parameters:', event.query.parameters)
|
||||
console.log('Duration:', event.queryDurationMillis + 'ms')
|
||||
console.log('---')
|
||||
}
|
||||
},
|
||||
})
|
||||
|
|
|
|||
1
packages/typesafe-db/src/index.ts
Normal file
1
packages/typesafe-db/src/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * as customers from './customers.js'
|
||||
|
|
@ -2,18 +2,17 @@
|
|||
"$schema": "https://json.schemastore.org/tsconfig",
|
||||
"display": "Node 22",
|
||||
"_version": "22.0.0",
|
||||
|
||||
"compilerOptions": {
|
||||
"lib": ["es2023"],
|
||||
"types": ["node"],
|
||||
"module": "nodenext",
|
||||
"target": "es2022",
|
||||
|
||||
"allowJs": true,
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"moduleResolution": "node16",
|
||||
|
||||
"noEmit": false,
|
||||
"outDir": "./lib",
|
||||
"declaration": true,
|
||||
"declarationMap": true,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue