Make typescript a peerDependency (#228) #879
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: Node.js CI | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ["v*"] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build: | |
| name: "Build and run integration tests" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: &node-versions | |
| - 20.x # LTS | |
| - 22.x # LTS | |
| - 24.x # LTS | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9.3.0 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| - name: Install dependencies | |
| run: pnpm install -r | |
| - name: Build Grats for each project | |
| run: pnpm run --filter="!website" -r grats | |
| - name: Assert no files changed after grats generation | |
| run: | | |
| if [ -n "$(git status --porcelain)" ]; then | |
| echo "Files were modified after running grats:" | |
| git status --porcelain | |
| git diff | |
| exit 1 | |
| fi | |
| - name: Build Other Packages (excluding docs website) | |
| run: pnpm run --filter="!website" -r build | |
| - name: Test Example Projects | |
| run: pnpm run test-example-projects | |
| - name: Build Docs Website | |
| working-directory: ./website | |
| run: ./scripts/build.sh | |
| test: | |
| name: "JS Tests" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: *node-versions | |
| typescript-version: | |
| - "5.5.4" | |
| - "5.7.3" | |
| - "5.9.3" | |
| - "6.0.2" | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9.3.0 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Install TypeScript ${{ matrix.typescript-version }} | |
| run: pnpm add -wD typescript@${{ matrix.typescript-version }} | |
| - name: Build # Integration tests depend upon having .js versions created by tsc | |
| run: pnpm run build | |
| - name: Unit Tests | |
| run: pnpm run test | |
| lint: | |
| name: "Lint" | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: *node-versions | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9.3.0 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Lint | |
| run: pnpm run lint | |
| publish: | |
| name: Publish to NPM | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) && github.repository == 'captbaritone/grats' | |
| needs: [build, test, lint] | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 9.3.0 | |
| - name: Use Node.js 20.x | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20.x" | |
| registry-url: "https://registry.npmjs.org" | |
| cache: "pnpm" | |
| - name: Ensure npm 11.5.1 or later for trusted publishing | |
| run: npm install -g npm@11.7.0 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm run build | |
| - name: Set dev version (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| run: pnpm version --no-git-tag-version 0.0.0-main-${RELEASE_COMMIT_SHA:0:8} | |
| env: | |
| RELEASE_COMMIT_SHA: ${{ github.sha }} | |
| - name: Publish dev version (main branch) | |
| if: github.ref == 'refs/heads/main' | |
| run: pnpm publish --tag main --access=public --no-git-checks | |
| - name: Publish release (tag) | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: pnpm publish --access=public --no-git-checks |