Merge pull request #700 from hed-standard/dependabot/npm_and_yarn/mai… #423
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test TypeScript Definitions | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| permissions: | |
| contents: read | |
| jobs: | |
| test-types: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22.x, lts/*] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build the package | |
| run: npm run build | |
| - name: Pack the package | |
| run: npm pack | |
| - name: Create test directory | |
| run: mkdir -p test-package | |
| - name: Install packed package | |
| run: | | |
| cd test-package | |
| npm init -y | |
| npm install ../hed-validator-*.tgz | |
| npm install typescript @types/node tsx | |
| - name: Copy test files and tsconfig | |
| run: | | |
| cp types/test.ts test-package/ | |
| cp types/tsconfig.json test-package/ | |
| cp tsconfig.json test-package/tsconfig.base.json | |
| cp scripts/runtime-test.template.ts test-package/runtime-test.ts | |
| - name: Update tsconfig paths | |
| run: | | |
| cd test-package | |
| node -e "const fs=require('fs'),c=JSON.parse(fs.readFileSync('tsconfig.json','utf8'));c.extends='./tsconfig.base.json';delete c.compilerOptions.paths;fs.writeFileSync('tsconfig.json',JSON.stringify(c,null,2));" | |
| - name: Test TypeScript definitions | |
| run: | | |
| cd test-package | |
| npx tsc --project tsconfig.json | |
| - name: Test runtime execution (basic smoke test) | |
| run: | | |
| cd test-package | |
| npx tsx runtime-test.ts |