build: use pnpm for the deploy

This commit is contained in:
Rafael Taranto 2025-05-23 16:02:58 +01:00
parent 64e358f61c
commit bac8813a8d
36 changed files with 19068 additions and 29560 deletions

View file

@ -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",

View file

@ -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('---')
}
},
})

View file

@ -0,0 +1 @@
export * as customers from './customers.js'

View file

@ -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,