From 90fe8be81d90741af7ca4387aed5afa6a79b2bcc Mon Sep 17 00:00:00 2001 From: Fred Boniface Date: Wed, 7 Jan 2026 13:37:56 +0000 Subject: [PATCH] Update tsc command --- .gitea/workflows/release.yaml | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/.gitea/workflows/release.yaml b/.gitea/workflows/release.yaml index 55210cc..3f6b1d8 100644 --- a/.gitea/workflows/release.yaml +++ b/.gitea/workflows/release.yaml @@ -49,16 +49,21 @@ jobs: working-directory: gen/ts run: | npm init -y - # Add a build script to the generated package.json + + # 1. Update package.json to be a proper ESM module + # We point "main" and "types" to the expected generated location jq '.name = "@owlboard/backend-data-contracts" | .version = "${{ steps.get_version.outputs.VERSION }}" | - .main = "./dist/index.js" | - .types = "./dist/index.d.ts" | - .scripts.build = "tsc *.ts --declaration --esm --outDir dist/" | - .devDependencies.typescript = "^5.0.0"' \ + .type = "module" | + .main = "./dist/rail_backend/v1/pis_mapping.js" | + .types = "./dist/rail_backend/v1/pis_mapping.d.ts" | + .publishConfig = { "registry": "https://git.fjla.uk/api/packages/owlboard/npm" }' \ package.json > temp.json && mv temp.json package.json - npx tsc *.ts --declaration --module esnext --target es2022 --moduleResolution node --outDir dist/ + # 2. Compile all TS files found in any subdirectories + # Using '**/*.ts' allows tsc to find the nested files + npx tsc **/*.ts --declaration --module esnext --target es2022 --moduleResolution node --outDir dist/ + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.PACKAGE_PUSH }}