Skip to content

Commit

Permalink
Fix CI definitely for real this time
Browse files Browse the repository at this point in the history
  • Loading branch information
domdomegg committed Apr 18, 2024
1 parent c35128b commit 4fc6337
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"postinstall": "npm run kanel",
"start": "tsup --watch --onSuccess \"npm run kanel && NODE_ENV=development node dist/index.js\"",
"build": "tsup && cp ../../package-lock.json dist_tools",
"build": "tsc && tsup && cp ../../package-lock.json dist_tools",
"deploy:prod": "tools/deployDocker.sh",
"kanel": "tsup tools/kanel.ts --outDir dist_tools --external kanel --external kanel-kysely && NODE_ENV=development node dist_tools/kanel.js",
"resetdb": "dropdb --host=localhost --port=5432 --force postgres && createdb --host=localhost --port=5432 postgres",
Expand All @@ -31,6 +31,7 @@
"devDependencies": {
"@bluedot/eslint-config": "*",
"@bluedot/typescript-config": "*",
"@types/http-errors": "^2.0.4",
"@types/node": "^20.10.3",
"@types/pg": "^8.10.9",
"eslint": "^8.53.0",
Expand Down
5 changes: 5 additions & 0 deletions apps/backend/src/db/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
import { Pool } from 'pg';
import { Kysely, PostgresDialect } from 'kysely';
// All these ignores are to allow this to pass in CI, where we don't have a database to generate the files with
// If we do more with backend, we should fix this properly by having CI spin up a database
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
// eslint-disable-next-line import/extensions
import Database from './generated/Database';
import { env } from '../env';

Expand Down
5 changes: 5 additions & 0 deletions apps/backend/tools/kanel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { migrateDb } from '../src/db/migrations/migrator';
import { db } from '../src/db/client';

async function run() {
if (process.env.CI) {
console.warn('Skipping kanel script in CI, because no Postgres database to use to generate files');
return;
}

await migrateDb();
await db.destroy();

Expand Down
1 change: 1 addition & 0 deletions apps/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"compilerOptions": {
// See https://github.com/microsoft/TypeScript/issues/29172
"outDir": "./dist",
"noEmit": true
},
"extends": "@bluedot/typescript-config/base.json",
"include": ["src"]
Expand Down
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"$schema": "https://turbo.build/schema.json",
"globalDependencies": ["**/.env.*local"],
"globalEnv": ["CI"],
"pipeline": {
"build": {
"dependsOn": ["^build"],
Expand Down

0 comments on commit 4fc6337

Please sign in to comment.