diff --git a/.github/dependabot.yml b/.github/dependabot.yml index defb3df..c18a22b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -3,7 +3,7 @@ version: 2 updates: - - package-ecosystem: 'npm' # pnpm is detected automatically via pnpm-lock.yaml + - package-ecosystem: 'npm' directory: '/' schedule: interval: 'monthly' @@ -19,7 +19,11 @@ updates: - '*' exclude-patterns: - '@projectwallace/*' + cooldown: + default-days: 7 - package-ecosystem: 'github-actions' directory: '/' schedule: interval: 'monthly' + cooldown: + default-days: 7 diff --git a/.github/workflows/dependency-diff.yml b/.github/workflows/dependency-diff.yml index 178520a..dcf1cce 100644 --- a/.github/workflows/dependency-diff.yml +++ b/.github/workflows/dependency-diff.yml @@ -11,18 +11,19 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: ref: main + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile --ignore-scripts - run: pnpm run build - run: pnpm pack --pack-destination ./base-packs - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: base-packages path: ./base-packs/*.tgz @@ -33,16 +34,18 @@ jobs: permissions: contents: read steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: node-version: 22 cache: pnpm - run: pnpm install --frozen-lockfile --ignore-scripts - run: pnpm run build - run: pnpm pack --pack-destination ./source-packs - - uses: actions/upload-artifact@v7 + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 with: name: source-packages path: ./source-packs/*.tgz @@ -55,14 +58,15 @@ jobs: contents: read pull-requests: write steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: fetch-depth: 0 - - uses: actions/download-artifact@v8 + persist-credentials: false + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: base-packages path: ./base-packs - - uses: actions/download-artifact@v8 + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: name: source-packages path: ./source-packs @@ -71,5 +75,4 @@ jobs: base-packages: './base-packs/*.tgz' source-packages: './source-packs/*.tgz' pack-size-threshold: -1 - size-threshold: -1 - duplicate-threshold: 3 + duplicate-threshold: 2 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2036fc2..2b54659 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,38 +4,92 @@ on: release: types: [created] -permissions: - id-token: write # Required for OIDC provenance attestations - contents: write # Required to push version bump commit +permissions: {} jobs: - publish-npm: + test: runs-on: ubuntu-latest + permissions: {} steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: node-version: 24 - cache: pnpm - registry-url: https://registry.npmjs.org - - run: pnpm install --frozen-lockfile --ignore-scripts + package-manager-cache: false + - run: pnpm install --frozen-lockfile - run: pnpm test - - name: Bump version in package.json - env: - TAG_NAME: ${{ github.event.release.tag_name }} - run: | - VERSION="${TAG_NAME#v}" - pnpm version "$VERSION" --no-git-tag-version + + build: + needs: test + runs-on: ubuntu-latest + permissions: {} + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 + with: + node-version: 24 + package-manager-cache: false + - run: pnpm install --frozen-lockfile + - run: pnpm run build + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: dist + path: dist/ + + bump-version: + needs: build + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: true + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 + - run: | + VERSION=${GITHUB_REF_NAME#v} + pnpm version $VERSION --no-git-tag-version - name: Commit and push version bump env: - DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} - TAG_NAME: ${{ github.event.release.tag_name }} + DEFAULT_BRANCH: main run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add package.json pnpm-lock.yaml - git commit -m "chore: bump version to $TAG_NAME" + git commit -m "chore: bump version to ${GITHUB_REF_NAME#v}" git push origin HEAD:$DEFAULT_BRANCH - - run: pnpm run build + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: package-json + path: package.json + + publish: + needs: bump-version + runs-on: ubuntu-latest + permissions: + id-token: write # Required for OIDC provenance + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 + with: + persist-credentials: false + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 + - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 + with: + node-version: 24 + package-manager-cache: false + registry-url: 'https://registry.npmjs.org' + - run: pnpm install --frozen-lockfile + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: dist + path: dist/ + - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: package-json - run: pnpm publish --no-git-checks diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d38a3ce..5f63809 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: Test +name: Tests on: push: @@ -14,63 +14,82 @@ jobs: name: Unit tests runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - name: Use Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile --ignore-scripts - - run: pnpm run test-coverage - - run: pnpm run build + cache: 'pnpm' + node-version: 24 + - run: pnpm install --frozen-lockfile + - run: pnpm test - check-ts: + check: name: Check types runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - name: Use Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile --ignore-scripts + cache: 'pnpm' + node-version: 24 + - run: pnpm install --frozen-lockfile - run: pnpm run check - lint-code: - name: Lint code (oxlint) + build: + name: Build runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - name: Use Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile --ignore-scripts + cache: 'pnpm' + node-version: 24 + - run: pnpm install --frozen-lockfile + - run: pnpm run build + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 + - name: Use Node.js + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v6 + with: + cache: 'pnpm' + node-version: 24 + - run: pnpm install --frozen-lockfile - run: pnpm run lint npm-audit: name: Audit packages runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 - - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - node-version: 22 - cache: pnpm + persist-credentials: false + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - run: pnpm audit --audit-level=high knip: - name: Knip (dead code detection) + name: Lint unused code runs-on: ubuntu-latest steps: - - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v6 - - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6 + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - node-version: 22 - cache: pnpm - - run: pnpm install --frozen-lockfile --ignore-scripts + persist-credentials: false + - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9 - run: pnpm run knip diff --git a/package.json b/package.json index 1ae9ae6..2e44954 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "test-build": "pnpm run build && vitest run --config vitest.config.build.ts", "build": "tsdown", "benchmark": "pnpm run build && node --expose-gc benchmark/index.ts", - "lint": "oxlint --config .oxlintrc.json && oxfmt --check", + "lint": "oxlint --config .oxlintrc.json; oxfmt --check", "check": "tsc --noEmit", "knip": "knip", "precommit": "pnpm run test --run; pnpm run lint; pnpm run check"