From 591713df256aa695f6ef16e6c33422314609376b Mon Sep 17 00:00:00 2001 From: Rami Abdou Date: Fri, 5 Apr 2024 16:11:32 -0700 Subject: [PATCH] try --- .github/workflows/ci.yml | 5 +++++ packages/db/package.json | 2 +- .../db/src/scripts/{windows.js => windows.ts} | 18 ++++++++---------- 3 files changed, 14 insertions(+), 11 deletions(-) rename packages/db/src/scripts/{windows.js => windows.ts} (70%) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c9be0e69..cda1c249 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,11 @@ jobs: uses: actions/checkout@v4 - name: Setup Node.js 20 uses: actions/setup-node@v4 + with: + node-version: 20 + cache: 'yarn' + - name: Install dependencies + run: yarn install --frozen-lockfile - name: Test windows run: yarn workspace @oyster/db windows diff --git a/packages/db/package.json b/packages/db/package.json index e6174e49..94023e10 100644 --- a/packages/db/package.json +++ b/packages/db/package.json @@ -18,7 +18,7 @@ "seed": "tsx ./src/scripts/seed.ts && yarn types", "type-check": "tsc --noEmit", "types": "node ./src/scripts/kysely-codegen.js", - "windows": "node ./src/scripts/windows.js" + "windows": "tsx ./src/scripts/windows.ts" }, "dependencies": { "kysely": "^0.26.3", diff --git a/packages/db/src/scripts/windows.js b/packages/db/src/scripts/windows.ts similarity index 70% rename from packages/db/src/scripts/windows.js rename to packages/db/src/scripts/windows.ts index 49b9785d..f13bf1a1 100644 --- a/packages/db/src/scripts/windows.js +++ b/packages/db/src/scripts/windows.ts @@ -1,21 +1,19 @@ import { promises as fs } from 'fs'; import path from 'path'; -import { fileURLToPath, pathToFileURL } from 'url'; +import { fileURLToPath } from 'url'; class FileMigrationProvider { - #props; - constructor(props) { - this.#props = props; - } + constructor(private props: any) {} + async getMigrations() { const migrations = {}; - console.log('1', this.#props.migrationFolder); - const files = await this.#props.fs.readdir(this.#props.migrationFolder); + console.log('1', this.props.migrationFolder); + const files = await this.props.fs.readdir(this.props.migrationFolder); console.log('2'); for (const fileName of files) { - const name = this.#props.path.join( + const name = this.props.path.join( 'file://', - this.#props.migrationFolder, + this.props.migrationFolder, fileName ); console.log('3', name); @@ -39,5 +37,5 @@ class FileMigrationProvider { path, }).getMigrations(); - console.log(migrations.length); + console.log(migrations); })();