Try and update npm build & publish step
Some checks failed
Generate and Release Protos / release (push) Failing after 21s

This commit is contained in:
2026-01-07 13:52:38 +00:00
parent 90fe8be81d
commit affdb052b2

View File

@@ -50,19 +50,23 @@ jobs:
run: | run: |
npm init -y npm init -y
# 1. Update package.json to be a proper ESM module # 1. Create a dynamic index.ts that exports everything from the subfolders
# We point "main" and "types" to the expected generated location # This makes 'import { PisMapping } from "@owlboard/backend-data-contracts"' work.
find . -name "*.ts" | sed 's|^\./||; s|\.ts$||' | xargs -I {} echo "export * from './{}';" > index.ts
# 2. Update package.json
# We point main/types to the root dist/index file we are about to create
jq '.name = "@owlboard/backend-data-contracts" | jq '.name = "@owlboard/backend-data-contracts" |
.version = "${{ steps.get_version.outputs.VERSION }}" | .version = "${{ steps.get_version.outputs.VERSION }}" |
.type = "module" | .type = "module" |
.main = "./dist/rail_backend/v1/pis_mapping.js" | .main = "./dist/index.js" |
.types = "./dist/rail_backend/v1/pis_mapping.d.ts" | .types = "./dist/index.d.ts" |
.publishConfig = { "registry": "https://git.fjla.uk/api/packages/owlboard/npm" }' \ .publishConfig = { "registry": "https://git.fjla.uk/api/packages/owlboard/npm" }' \
package.json > temp.json && mv temp.json package.json package.json > temp.json && mv temp.json package.json
# 2. Compile all TS files found in any subdirectories # 3. Compile using the created index.ts as the entry point
# Using '**/*.ts' allows tsc to find the nested files # tsc will automatically follow the imports in index.ts and find the nested files
npx tsc **/*.ts --declaration --module esnext --target es2022 --moduleResolution node --outDir dist/ npx tsc index.ts --declaration --module esnext --target es2022 --moduleResolution node --outDir dist/
npm publish npm publish
env: env: