A local-first personal finance app
Move migrations script to typescript (#7075)
Julian Dominguez-Schatz448da13cf549
diff --git a/.github/workflows/check.yml b/.github/workflows/check.ymlindex 9c32fcbec6..9162014604 100644--- a/.github/workflows/check.yml+++ b/.github/workflows/check.yml@@ -60,8 +60,9 @@ jobs:runs-on: ubuntu-lateststeps:- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0- - uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0+ - name: Set up environment+ uses: ./.github/actions/setupwith:- node-version: 22+ download-translations: 'false'- name: Check migrations- run: node ./.github/actions/check-migrations.js+ run: yarn workspace @actual-app/ci-actions tsx bin/check-migrations.tsdiff --git a/.github/actions/check-migrations.js b/packages/ci-actions/bin/check-migrations.tssimilarity index 88%rename from .github/actions/check-migrations.jsrename to packages/ci-actions/bin/check-migrations.tsindex f590372ee6..d8d05d98ed 100644--- a/.github/actions/check-migrations.js+++ b/packages/ci-actions/bin/check-migrations.ts@@ -1,14 +1,14 @@-#!/usr/bin/env node-// overview:// 1. Identify the migrations in packages/loot-core/migrations/* on `master` and HEAD// 2. Make sure that any new migrations on HEAD are dated after the latest migration on `master`.-const { spawnSync } = require('child_process');-const path = require('path');+import { spawnSync } from 'child_process';+import path from 'path';+import { fileURLToPath } from 'url';const migrationsDir = path.join(- __dirname,+ path.dirname(fileURLToPath(import.meta.url)),+ '..','..','..','packages',@@ -16,7 +16,7 @@ const migrationsDir = path.join('migrations',);-function readMigrations(ref) {+function readMigrations(ref: string) {const { stdout } = spawnSync('git', ['ls-tree','--name-only',diff --git a/packages/ci-actions/package.json b/packages/ci-actions/package.jsonindex 02b9d4f83e..7e1bce054e 100644--- a/packages/ci-actions/package.json+++ b/packages/ci-actions/package.json@@ -3,9 +3,18 @@"private": true,"type": "module","scripts": {- "test": "vitest --run"+ "tsx": "node --import=extensionless/register --experimental-strip-types",+ "test": "vitest --run",+ "typecheck": "tsc --noEmit"},"devDependencies": {+ "extensionless": "^2.0.6",+ "typescript": "^5.9.3","vitest": "^4.0.18"+ },+ "extensionless": {+ "lookFor": [+ "ts"+ ]}}diff --git a/packages/ci-actions/tsconfig.json b/packages/ci-actions/tsconfig.jsonnew file mode 100644index 0000000000..481967bab1--- /dev/null+++ b/packages/ci-actions/tsconfig.json@@ -0,0 +1,15 @@+{+ "compilerOptions": {+ "target": "ES2022",+ "lib": [],+ "module": "nodenext",+ "moduleResolution": "nodenext",+ "skipLibCheck": true,+ "strict": true,+ "types": ["node"],+ "outDir": "dist",+ "rootDir": "."+ },+ "include": ["src/**/*", "bin/**/*"],+ "exclude": ["node_modules"]+}diff --git a/upcoming-release-notes/7075.md b/upcoming-release-notes/7075.mdnew file mode 100644index 0000000000..51b3c4e2ad--- /dev/null+++ b/upcoming-release-notes/7075.md@@ -0,0 +1,6 @@+---+category: Maintenance+authors: [jfdoming]+---++Move migrations CI script to typescript + ci-actionsdiff --git a/yarn.lock b/yarn.lockindex e4eb095d46..0e250c40bb 100644--- a/yarn.lock+++ b/yarn.lock@@ -39,6 +39,8 @@ __metadata:version: 0.0.0-use.localresolution: "@actual-app/ci-actions@workspace:packages/ci-actions"dependencies:+ extensionless: "npm:^2.0.6"+ typescript: "npm:^5.9.3"vitest: "npm:^4.0.18"languageName: unknownlinkType: soft@@ -16031,6 +16033,13 @@ __metadata:languageName: nodelinkType: hard+"extensionless@npm:^2.0.6":+ version: 2.0.6+ resolution: "extensionless@npm:2.0.6"+ checksum: 10/4a264600d9ff811534b35a66ff59eb075ca5c1ae4f25213bfa71d26a5e28ba5188a0d743f4e1dc8255cf9739258d5d374c6f757957faf4fe0d4ec5f57f51034f+ languageName: node+ linkType: hard+"extract-zip@npm:^2.0.1":version: 2.0.1resolution: "extract-zip@npm:2.0.1"