From f8d42d7670000fc46ec93c9a3e93bf2de5410112 Mon Sep 17 00:00:00 2001 From: nelly439 Date: Thu, 25 Jun 2026 20:42:20 +0100 Subject: [PATCH] fix: remove duplicate dependencies block and add CI with publint validation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Merge the two 'dependencies' objects in package.json into one canonical block (js-sha3 ^0.9.3 is unchanged — only the duplicate entry is removed) - Add 'validate' script: npx publint, which statically checks exports, files, and package metadata for correctness before publish - Add .github/workflows/ci.yml: runs validate → lint → typecheck → unit tests → build → smoke tests across Node 18/20/22 on every push/PR to main, ensuring duplicate-key and malformed-metadata regressions are caught automatically - Document 'pnpm validate' in README Development section --- .github/workflows/ci.yml | 59 ++++++++++++++++++++++++++++++++++++++++ README.md | 3 ++ package.json | 6 ++-- 3 files changed, 64 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..2d53a47 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,59 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + branches: [main] + +jobs: + validate-and-test: + name: Validate, Lint, Test & Build + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up pnpm + uses: pnpm/action-setup@v3 + with: + version: 10 + + - name: Set up Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # ── Package metadata validation ─────────────────────────────────────── + # publint checks for malformed exports, missing files, and other issues + # that would break consumers of the published package. + - name: Validate package metadata (publint) + run: pnpm validate + + # ── Code quality ────────────────────────────────────────────────────── + - name: Lint + run: pnpm lint + + - name: Type-check + run: pnpm typecheck + + # ── Tests ───────────────────────────────────────────────────────────── + - name: Run unit tests + run: pnpm test:run + + # ── Build ───────────────────────────────────────────────────────────── + - name: Build + run: pnpm build + + # ── Smoke tests (require the built dist) ────────────────────────────── + - name: Run smoke tests + run: pnpm test:smoke diff --git a/README.md b/README.md index 7246872..1a3a490 100644 --- a/README.md +++ b/README.md @@ -236,6 +236,9 @@ pnpm typecheck # Generate TypeDoc API docs pnpm docs + +# Validate package metadata (publint — catches malformed exports, missing files, etc.) +pnpm validate ``` ## 🗺️ Roadmap diff --git a/package.json b/package.json index ae62787..7036a30 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,8 @@ "lint": "eslint .", "format": "prettier --write .", "typecheck": "tsc --noEmit", - "docs": "typedoc src/index.ts" + "docs": "typedoc src/index.ts", + "validate": "npx --yes publint" }, "keywords": [ "web3", @@ -85,8 +86,5 @@ "typedoc": "^0.25.8", "typescript": "^5.3.3", "vitest": "^1.3.1" - }, - "dependencies": { - "js-sha3": "^0.9.3" } }