Skip to content

Update dependencies and configuration for pnpm #47

Update dependencies and configuration for pnpm

Update dependencies and configuration for pnpm #47

Workflow file for this run

name: CI
on:
push:
branches: [main]
tags:
- 'v*'
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
components: rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Check Rust format
run: cargo fmt --check
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
cache-dependency-path: ts/pnpm-lock.yaml
- name: Install wasm-pack
uses: jetli/wasm-pack-action@v0.4.0
- name: Build WASM
run: wasm-pack build --target nodejs --out-dir ts/wasm
- name: Install dependencies
working-directory: ts
run: pnpm install --frozen-lockfile
- name: Lint TypeScript
working-directory: ts
run: pnpm run lint
- name: Build TypeScript
working-directory: ts
run: pnpm run build:ts
- name: Run tests
working-directory: ts
run: pnpm test
- name: Verify ESM and CJS builds
working-directory: ts
run: |
echo "Testing CJS import..."
node -e "const p = require('./dist/index.cjs'); console.log('CJS: Parser loaded:', typeof p.Parser)"
echo "Testing ESM import..."
node --input-type=module -e "import { Parser } from './dist/index.mjs'; console.log('ESM: Parser loaded:', typeof Parser)"
- name: Upload build artifacts
if: startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
ts/wasm/
ts/dist/
ts/package.json
ts/README.md
retention-days: 1
publish:
needs: build-and-test
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
id-token: write
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: build-artifacts
path: ts
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
registry-url: 'https://registry.npmjs.org'
- name: Publish to npm
working-directory: ts
run: pnpm publish --access public --no-git-checks
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true