diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml new file mode 100644 index 0000000..388b819 --- /dev/null +++ b/.github/actions/setup/action.yaml @@ -0,0 +1,20 @@ +name: "Setup dependencies" +description: "Prepare repository and all dependencies" + +runs: + using: "composite" + steps: + - name: Set up pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + + - name: Setup Node.js 18.x + uses: actions/setup-node@v3 + with: + node-version: 18.x + cache: 'pnpm' + + - name: Install dependencies + shell: bash + run: pnpm install diff --git a/.github/workflows/on-pull-request.yaml b/.github/workflows/on-pull-request.yaml new file mode 100644 index 0000000..472f400 --- /dev/null +++ b/.github/workflows/on-pull-request.yaml @@ -0,0 +1,14 @@ +name: Pull request +on: + pull_request: + types: [opened, reopened, synchronize, ready_for_review] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + verify: + name: Verify + uses: ./.github/workflows/verify.yml + secrets: inherit diff --git a/.github/workflows/changesets.yaml b/.github/workflows/on-push-master.yaml similarity index 69% rename from .github/workflows/changesets.yaml rename to .github/workflows/on-push-master.yaml index a526916..304ce1a 100644 --- a/.github/workflows/changesets.yaml +++ b/.github/workflows/on-push-master.yaml @@ -8,24 +8,19 @@ on: concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - release: - name: Release + verify: + name: Verify + uses: ./.github/workflows/verify.yml + secrets: inherit + changesets: + name: Changesets runs-on: ubuntu-latest steps: - name: Checkout Repo uses: actions/checkout@v3 - - uses: pnpm/action-setup@v2 - with: - version: 8 - - - name: Setup Node.js 18.x - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: 'pnpm' - name: Install Dependencies - run: pnpm install + uses: ./.github/actions/setup - name: Create Release Pull Request or Publish to npm id: changesets diff --git a/.github/workflows/verify.yaml b/.github/workflows/verify.yaml new file mode 100644 index 0000000..7db6257 --- /dev/null +++ b/.github/workflows/verify.yaml @@ -0,0 +1,66 @@ +name: Verify +on: + workflow_call: + workflow_dispatch: + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Lint code + run: pnpm lint + + build: + name: Build + needs: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Build + run: pnpm build + + types: + name: Types + needs: lint + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/setup + + - name: Check types + run: pnpm typecheck + + test: + name: Test + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Install dependencies + uses: ./.github/actions/install-dependencies + + - name: Run tests + uses: nick-fields/retry@v2 + with: + timeout_minutes: 20 + max_attempts: 3 + command: pnpm test:coverage diff --git a/package.json b/package.json index d7d2f1f..869636d 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,12 @@ "main": "index.js", "scripts": { "sync:deps": "syncpack", - "release": "pnpm -r build && changeset publish" + "release": "pnpm -r build && changeset publish", + "build": "pnpm -r build", + "lint": "pnpm -r lint", + "test": "pnpm -r test", + "test:coverage": "pnpm -r test -- --coverage", + "typecheck": "pnpm -r typecheck" }, "keywords": [], "author": "", diff --git a/packages/base/tsconfig.base.json b/packages/base/tsconfig.base.json index fd50b1d..dc25c8d 100644 --- a/packages/base/tsconfig.base.json +++ b/packages/base/tsconfig.base.json @@ -3,7 +3,7 @@ "moduleResolution": "node", "target": "es2022", "module": "es2022", - "lib": ["es2015", "es2016", "es2017", "es2020"], + "lib": ["es2015", "es2016", "es2017", "es2020", "DOM"], "strict": true, "declaration": true, "allowSyntheticDefaultImports": true, diff --git a/packages/chains/package.json b/packages/chains/package.json index 9c9501c..ca94323 100644 --- a/packages/chains/package.json +++ b/packages/chains/package.json @@ -8,7 +8,8 @@ "lint": "eslint --ext .ts,.tsx src", "pub": "pnpm publish --no-git-checks", "build": "tsup", - "test": "vitest run" + "test": "vitest run", + "typecheck": "tsc --noEmit" }, "exports": { ".": { @@ -22,6 +23,7 @@ "license": "lgpl-3.0", "devDependencies": { "@ens-tools/base": "workspace:*", + "@vitest/coverage-v8": "^0.34.5", "tsup": "^7.2.0", "typescript": "^5.2.2", "vitest": "^0.34.5" diff --git a/packages/chains/tsconfig.json b/packages/chains/tsconfig.json index 26a9bfc..cf17a59 100644 --- a/packages/chains/tsconfig.json +++ b/packages/chains/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": ["@ens-tools/base/tsconfig.base.json"], + "extends": [ + "@ens-tools/base/tsconfig.base.json" + ], } diff --git a/packages/format/package.json b/packages/format/package.json index 2039df6..1859299 100644 --- a/packages/format/package.json +++ b/packages/format/package.json @@ -8,7 +8,8 @@ "test": "vitest run", "lint": "eslint --ext .ts,.tsx src", "pub": "pnpm publish --no-git-checks", - "build": "tsup" + "build": "tsup", + "typecheck": "tsc --noEmit" }, "exports": { ".": { @@ -48,6 +49,8 @@ "license": "lgpl-3.0", "devDependencies": { "@ens-tools/base": "workspace:*", + "@types/node": "^20.7.0", + "@vitest/coverage-v8": "^0.34.5", "tsup": "^7.2.0", "typescript": "^5.2.2", "vitest": "^0.34.5" diff --git a/packages/format/tsconfig.json b/packages/format/tsconfig.json index 26a9bfc..cf17a59 100644 --- a/packages/format/tsconfig.json +++ b/packages/format/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": ["@ens-tools/base/tsconfig.base.json"], + "extends": [ + "@ens-tools/base/tsconfig.base.json" + ], } diff --git a/packages/react/package.json b/packages/react/package.json index 3e840f3..3db27c2 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -8,7 +8,8 @@ "lint": "eslint --ext .ts,.tsx src", "pub": "pnpm publish --no-git-checks", "build": "tsup", - "test": "vitest run" + "test": "vitest run", + "typecheck": "tsc --noEmit" }, "exports": { ".": { @@ -23,7 +24,9 @@ "devDependencies": { "@ens-tools/base": "workspace:*", "@testing-library/react": "^14.0.0", + "@types/node": "^20.7.0", "@types/react": "^18.2.21", + "@vitest/coverage-v8": "^0.34.5", "eslint": "^8.49.0", "happy-dom": "^12.1.6", "react-dom": "^18.2.0", diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 26a9bfc..cf17a59 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,3 +1,5 @@ { - "extends": ["@ens-tools/base/tsconfig.base.json"], + "extends": [ + "@ens-tools/base/tsconfig.base.json" + ], } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index fd574d3..2610c35 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -35,6 +35,9 @@ importers: '@ens-tools/base': specifier: workspace:* version: link:../base + '@vitest/coverage-v8': + specifier: ^0.34.5 + version: 0.34.5(vitest@0.34.5) tsup: specifier: ^7.2.0 version: 7.2.0(typescript@5.2.2) @@ -50,6 +53,12 @@ importers: '@ens-tools/base': specifier: workspace:* version: link:../base + '@types/node': + specifier: ^20.7.0 + version: 20.7.0 + '@vitest/coverage-v8': + specifier: ^0.34.5 + version: 0.34.5(vitest@0.34.5) tsup: specifier: ^7.2.0 version: 7.2.0(typescript@5.2.2) @@ -84,9 +93,15 @@ importers: '@testing-library/react': specifier: ^14.0.0 version: 14.0.0(react-dom@18.2.0)(react@18.2.0) + '@types/node': + specifier: ^20.7.0 + version: 20.7.0 '@types/react': specifier: ^18.2.21 version: 18.2.21 + '@vitest/coverage-v8': + specifier: ^0.34.5 + version: 0.34.5(vitest@0.34.5) eslint: specifier: ^8.49.0 version: 8.49.0 @@ -113,6 +128,14 @@ packages: engines: {node: '>=0.10.0'} dev: true + /@ampproject/remapping@2.2.1: + resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} + engines: {node: '>=6.0.0'} + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + '@jridgewell/trace-mapping': 0.3.19 + dev: true + /@babel/code-frame@7.22.13: resolution: {integrity: sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==} engines: {node: '>=6.9.0'} @@ -141,6 +164,10 @@ packages: dependencies: regenerator-runtime: 0.14.0 + /@bcoe/v8-coverage@0.2.3: + resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} + dev: true + /@changesets/apply-release-plan@6.1.4: resolution: {integrity: sha512-FMpKF1fRlJyCZVYHr3CbinpZZ+6MwvOtWUuO8uo+svcATEoc1zRDcj23pAurJ2TZ/uVz1wFHH6K3NlACy0PLew==} dependencies: @@ -956,6 +983,11 @@ packages: resolution: {integrity: sha512-ZnQMnLV4e7hDlUvw8H+U8ASL02SS2Gn6+9Ac3wGGLIe7+je2AeAOxPY+izIPJDfFDb7eDjev0Us8MO1iFRN8hA==} dev: true + /@istanbuljs/schema@0.1.3: + resolution: {integrity: sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==} + engines: {node: '>=8'} + dev: true + /@jest/schemas@29.6.3: resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -1425,6 +1457,10 @@ packages: ci-info: 3.8.0 dev: true + /@types/istanbul-lib-coverage@2.0.4: + resolution: {integrity: sha512-z/QT1XN4K4KYuslS23k62yDIDLwLFkzxOuMplDtObz0+y7VqJCaO2o+SPwHCvLFZh7xazvvoor2tA/hPz9ee7g==} + dev: true + /@types/json-schema@7.0.13: resolution: {integrity: sha512-RbSSoHliUbnXj3ny0CNFOoxrIDV6SUGyStHsvDqosw6CkdPV8TtWGlfecuK4ToyMEAql6pzNxgCFKanovUzlgQ==} dev: true @@ -1440,6 +1476,10 @@ packages: /@types/node@12.20.55: resolution: {integrity: sha512-J8xLz7q2OFulZ2cyGTLE1TbbZcjpno7FaN6zdJNrgAdrJ+DZzh/uFR6YrTb4C+nXakvud8Q4+rbhoIWlYQbUFQ==} + /@types/node@20.7.0: + resolution: {integrity: sha512-zI22/pJW2wUZOVyguFaUL1HABdmSVxpXrzIqkjsHmyUjNhPoWM1CKfvVuXfetHhIok4RY573cqS0mZ1SJEnoTg==} + dev: true + /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} dev: true @@ -1559,6 +1599,27 @@ packages: eslint-visitor-keys: 3.4.3 dev: true + /@vitest/coverage-v8@0.34.5(vitest@0.34.5): + resolution: {integrity: sha512-97xjhRTSdmeeHCm2nNHhT3hLsMYkAhHXm/rwj6SZ3voka8xiCJrwgtfIjoZIFEL4OO0KezGmVuHWQXcMunULIA==} + peerDependencies: + vitest: '>=0.32.0 <1' + dependencies: + '@ampproject/remapping': 2.2.1 + '@bcoe/v8-coverage': 0.2.3 + istanbul-lib-coverage: 3.2.0 + istanbul-lib-report: 3.0.1 + istanbul-lib-source-maps: 4.0.1 + istanbul-reports: 3.1.6 + magic-string: 0.30.3 + picocolors: 1.0.0 + std-env: 3.4.3 + test-exclude: 6.0.0 + v8-to-istanbul: 9.1.0 + vitest: 0.34.5(happy-dom@12.1.6) + transitivePeerDependencies: + - supports-color + dev: true + /@vitest/expect@0.34.5: resolution: {integrity: sha512-/3RBIV9XEH+nRpRMqDJBufKIOQaYUH2X6bt0rKSCW0MfKhXFLYsR5ivHifeajRSTsln0FwJbitxLKHSQz/Xwkw==} dependencies: @@ -2592,6 +2653,10 @@ packages: resolution: {integrity: sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==} dev: true + /convert-source-map@1.9.0: + resolution: {integrity: sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==} + dev: true + /copy-to-clipboard@3.3.3: resolution: {integrity: sha512-2KV8NhB5JqC3ky0r9PMCAZKbUHSwtEo4CwCs0KXgruG43gX5PMqDEBbVU4OUzw2MuAWUfsuFmWvEKG5QRfSnJA==} dependencies: @@ -3752,6 +3817,10 @@ packages: lru-cache: 7.18.3 dev: true + /html-escaper@2.0.2: + resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} + dev: true + /human-id@1.0.2: resolution: {integrity: sha512-UNopramDEhHJD+VR+ehk8rOslwSfByxPIZyJRfV739NDhN5LF1fa1MqnzKm2lGTQRjNrjK19Q5fhkgIfjlVUKw==} dev: true @@ -4053,6 +4122,39 @@ packages: ws: 7.5.9 dev: false + /istanbul-lib-coverage@3.2.0: + resolution: {integrity: sha512-eOeJ5BHCmHYvQK7xt9GkdHuzuCGS1Y6g9Gvnx3Ym33fz/HpLRYxiS0wHNr+m/MBC8B647Xt608vCDEvhl9c6Mw==} + engines: {node: '>=8'} + dev: true + + /istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} + dependencies: + istanbul-lib-coverage: 3.2.0 + make-dir: 4.0.0 + supports-color: 7.2.0 + dev: true + + /istanbul-lib-source-maps@4.0.1: + resolution: {integrity: sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==} + engines: {node: '>=10'} + dependencies: + debug: 4.3.4 + istanbul-lib-coverage: 3.2.0 + source-map: 0.6.1 + transitivePeerDependencies: + - supports-color + dev: true + + /istanbul-reports@3.1.6: + resolution: {integrity: sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==} + engines: {node: '>=8'} + dependencies: + html-escaper: 2.0.2 + istanbul-lib-report: 3.0.1 + dev: true + /jayson@4.1.0: resolution: {integrity: sha512-R6JlbyLN53Mjku329XoRT2zJAE6ZgOQ8f91ucYdMCD4nkGCF9kZSrcGXpHIU4jeKj58zUZke2p+cdQchU7Ly7A==} engines: {node: '>=8'} @@ -4346,6 +4448,13 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true + /make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} + dependencies: + semver: 7.5.4 + dev: true + /map-obj@1.0.1: resolution: {integrity: sha512-7N/q3lyZ+LVCp7PzuxrJr4KMbBE2hW7BT7YNia330OFxIf4d3r5zVpicP2650l7CPN6RM9zOJRl3NGpqSiw3Eg==} engines: {node: '>=0.10.0'} @@ -5329,6 +5438,11 @@ packages: engines: {node: '>=0.10.0'} dev: true + /source-map@0.6.1: + resolution: {integrity: sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==} + engines: {node: '>=0.10.0'} + dev: true + /source-map@0.8.0-beta.0: resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} engines: {node: '>= 8'} @@ -5574,6 +5688,15 @@ packages: engines: {node: '>=8'} dev: true + /test-exclude@6.0.0: + resolution: {integrity: sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==} + engines: {node: '>=8'} + dependencies: + '@istanbuljs/schema': 0.1.3 + glob: 7.2.3 + minimatch: 3.1.2 + dev: true + /text-encoding-utf-8@1.0.2: resolution: {integrity: sha512-8bw4MY9WjdsD2aMtO0OzOCY3pXGYNx2d2FfHRVUKkiCPDWjKuOlhLVASS+pD7VkLTVjW268LYJHwsnPFlBpbAg==} dev: false @@ -5882,6 +6005,15 @@ packages: hasBin: true dev: false + /v8-to-istanbul@9.1.0: + resolution: {integrity: sha512-6z3GW9x8G1gd+JIIgQQQxXuiJtCXeAjp6RaPEPLv62mH3iPHPxV6W3robxtCzNErRo6ZwTmzWhsbNvjyEBKzKA==} + engines: {node: '>=10.12.0'} + dependencies: + '@jridgewell/trace-mapping': 0.3.19 + '@types/istanbul-lib-coverage': 2.0.4 + convert-source-map: 1.9.0 + dev: true + /validate-npm-package-license@3.0.4: resolution: {integrity: sha512-DpKm2Ui/xN7/HQKCtpZxoRWBhZ9Z0kqtygG8XCgNQ8ZlDnxuQmWhj566j8fN4Cu3/JmbhsDo7fcAJq4s9h27Ew==} dependencies: @@ -5914,7 +6046,7 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - /vite-node@0.34.5(@types/node@12.20.55): + /vite-node@0.34.5(@types/node@20.7.0): resolution: {integrity: sha512-RNZ+DwbCvDoI5CbCSQSyRyzDTfFvFauvMs6Yq4ObJROKlIKuat1KgSX/Ako5rlDMfVCyMcpMRMTkJBxd6z8YRA==} engines: {node: '>=v14.18.0'} hasBin: true @@ -5924,7 +6056,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.4.9(@types/node@12.20.55) + vite: 4.4.9(@types/node@20.7.0) transitivePeerDependencies: - '@types/node' - less @@ -5936,7 +6068,7 @@ packages: - terser dev: true - /vite@4.4.9(@types/node@12.20.55): + /vite@4.4.9(@types/node@20.7.0): resolution: {integrity: sha512-2mbUn2LlUmNASWwSCNSJ/EG2HuSRTnVNaydp6vMCm5VIqJsjMfbIWtbH2kDuwUVW5mMUKKZvGPX/rqeqVvv1XA==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -5964,7 +6096,7 @@ packages: terser: optional: true dependencies: - '@types/node': 12.20.55 + '@types/node': 20.7.0 esbuild: 0.18.20 postcss: 8.4.30 rollup: 3.29.2 @@ -6005,7 +6137,7 @@ packages: dependencies: '@types/chai': 4.3.6 '@types/chai-subset': 1.3.3 - '@types/node': 12.20.55 + '@types/node': 20.7.0 '@vitest/expect': 0.34.5 '@vitest/runner': 0.34.5 '@vitest/snapshot': 0.34.5 @@ -6025,8 +6157,8 @@ packages: strip-literal: 1.3.0 tinybench: 2.5.1 tinypool: 0.7.0 - vite: 4.4.9(@types/node@12.20.55) - vite-node: 0.34.5(@types/node@12.20.55) + vite: 4.4.9(@types/node@20.7.0) + vite-node: 0.34.5(@types/node@20.7.0) why-is-node-running: 2.2.2 transitivePeerDependencies: - less