Skip to content

Commit

Permalink
refactor: dev updates (#198)
Browse files Browse the repository at this point in the history
* wip: dev updates

* wip: refactor

* refactor: register

* fix: path

* docs: update

* ci: update workflows

* fix: tests

* fix: script

* fix: publint

* chore: changes

* chore: fix knip

* chore: knip

* test: boost coverage

* chore: symlink readme

* chore: readme

* chore: readme

* chore: tweak

* chore: changeset

* chore: update keywords
  • Loading branch information
tmm committed Oct 11, 2023
1 parent e2797ef commit a12abfd
Show file tree
Hide file tree
Showing 159 changed files with 2,288 additions and 1,677 deletions.
35 changes: 35 additions & 0 deletions .changeset/angry-walls-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
"abitype": minor
---

**Breaking**: Renamed `'abitype/test`' entrypoint to `'abitype/abis'`.

```diff
- import { erc20Abi } from 'abitype/test'
+ import { erc20Abi } from 'abitype/abis'
```

**Breaking**: Removed `zeroAddress` export from `'abitype/abis'`. You can copy it directly into your project if you still need to use it.

```diff
- import { zeroAddress } from 'abitype/abis'
+ export const zeroAddress = '0x0000000000000000000000000000000000000000' as const
```

**Breaking**: Renamed `Config`, `DefaultConfig`, and `ResolvedConfig` to `Register`, `DefaultRegister`, and `ResolvedRegister` respectively.

```diff
- import { Config, DefaultConfig, ResolvedConfig } from 'abitype'
+ import { Register, DefaultRegister, ResolvedRegister } from 'abitype'
```

To configure ABIType, target `Register` instead of `Config`:

```diff
declare module 'abitype' {
- export interface Config {
+ export interface Register {
BigIntType: bigint & { foo: 'bar' }
}
}
```
9 changes: 4 additions & 5 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.3/schema.json",
"$schema": "https://unpkg.com/@changesets/config@2.1.0/schema.json",
"access": "public",
"baseBranch": "main",
"changelog": [
"@changesets/changelog-github",
{ "repo": "wagmi-dev/abitype" }
],
"commit": false,
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true
},
"ignore": ["docs", "examples", "playground"]
}
}
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Edit the `playground/trace.ts` file to include whatever code you want to test an
pnpm trace
```

This outputs a `trace/trace.json` file. You can open that file in a trace analysis app, like [Perfetto](https://ui.perfetto.dev) or `chrome://tracing`.
This outputs a `playgrounds/performance/out/trace.json` file. You can open that file in a trace analysis app, like [Perfetto](https://ui.perfetto.dev) or `chrome://tracing`.

<div align="right">
<a href="#advanced-guide">&uarr; back to top</a></b>
Expand Down
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,3 @@ body:
required: true
- label: Followed the [Code of Conduct](https://github.com/wagmi-dev/.github/blob/main/CODE_OF_CONDUCT.md).
required: true
- label: Read the [Contributing Guide](https://github.com/wagmi-dev/abitype/blob/main/.github/CONTRIBUTING.md).
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ contact_links:
about: Ask questions and discuss with other community members.
- name: Feature Request
url: https://github.com/wagmi-dev/abitype/discussions/new?category=ideas
about: Requests features or brainstorm ideas for new functionality.
about: Requests features or brainstorm ideas for new functionality.
2 changes: 1 addition & 1 deletion .github/actions/install-dependencies/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ runs:

- name: Install dependencies
shell: bash
run: pnpm install --ignore-scripts
run: pnpm install
8 changes: 4 additions & 4 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ What changes are made in this PR? Is it a feature or a bug fix?

## Additional Information

- [ ] I read the [contributing guide](https://github.com/wagmi-dev/abitype/blob/main/.github/CONTRIBUTING.md)
- [ ] I added documentation related to the changes made.
- [ ] I added or updated tests related to the changes made.
Before submitting this issue, please make sure you do the following.

Your ENS/address:
- [ ] Read the [contributing guide](https://github.com/wagmi-dev/abitype/blob/main/.github/CONTRIBUTING.md)
- [ ] Added documentation related to the changes made.
- [ ] Added or updated tests (and snapshots) related to the changes made.
37 changes: 37 additions & 0 deletions .github/workflows/canary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Release (Canary)
on:
push:
branches: [main]
workflow_dispatch:

jobs:
canary:
name: Release canary
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Setup .npmrc file
uses: actions/setup-node@v3
with:
registry-url: 'https://registry.npmjs.org'

- name: Set version
run: |
npm --no-git-tag-version version 0.0.0
npm --no-git-tag-version version $(npm pkg get version | sed 's/"//g')-$(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//').$(date +'%Y%m%dT%H%M%S')
pnpm bun .scripts/updateVersion.ts
- name: Build
run: pnpm build

- name: Publish to npm
run: npm publish --tag $(git branch --show-current | tr -cs '[:alnum:]-' '-' | tr '[:upper:]' '[:lower:]' | sed 's/-$//')
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Changesets
on:
push:
branches: [main]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
verify:
name: Verify
uses: ./.github/workflows/verify.yml
secrets: inherit

changesets:
name: Create pull request or publish
needs: verify
permissions: write-all
runs-on: ubuntu-latest
timeout-minutes: 5

steps:
- name: Clone repository
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Create version pull request or publish to npm
uses: changesets/action@v1
with:
title: 'chore: version packages'
commit: 'chore: version packages'
createGithubReleases: ${{ github.ref == 'refs/heads/main' }}
publish: pnpm changeset:publish
version: pnpm changeset:version
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
73 changes: 0 additions & 73 deletions .github/workflows/on-push-to-main.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pull request
name: Pull Request
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
Expand Down Expand Up @@ -43,4 +43,5 @@ jobs:
- name: Report build size
uses: preactjs/compressed-size-action@v2
with:
pattern: 'packages/**/dist/**'
repo-token: ${{ secrets.GITHUB_TOKEN }}
22 changes: 0 additions & 22 deletions .github/workflows/snapshot.yml

This file was deleted.

42 changes: 27 additions & 15 deletions .github/workflows/verify.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Verify
on:
workflow_call:
workflow_dispatch:

jobs:
lint:
Expand All @@ -16,7 +17,18 @@ jobs:
uses: ./.github/actions/install-dependencies

- name: Lint code
run: pnpm lint
run: pnpm format && pnpm lint:fix

- name: Update package versions
run: pnpm version:update

- uses: stefanzweifel/git-auto-commit-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
commit_message: 'chore: format'
commit_user_name: 'github-actions[bot]'
commit_user_email: 'github-actions[bot]@users.noreply.github.com'

build:
name: Build
Expand All @@ -33,13 +45,19 @@ jobs:
- name: Build
run: pnpm build

- name: Publint
run: pnpm test:build

- name: Check for unused files, dependencies, and exports
run: pnpm knip --production --ignore-internal

types:
name: Types
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
version: ['5.0.4', '5.1.3', 'latest']
version: ['5.0.4', '5.1.3', '5.2.2', 'latest']

steps:
- name: Clone repository
Expand All @@ -51,25 +69,24 @@ jobs:
- name: Use `typescript@${{ matrix.version }}`
run: pnpm add -D -w typescript@${{ matrix.version }}

- name: Build
run: pnpm build
- name: Link packages
run: pnpm preconstruct

- name: Check types
run: pnpm typecheck

- name: Check types (--exactOptionalPropertyTypes false)
run: pnpm typecheck:propertyTypes

- name: Test types
run: pnpm test:typecheck

# Redundant with `pnpm typecheck`
# If Vitest adds special features in the future, e.g. type coverage, can add this back!
# - name: Test types
# run: pnpm test:typecheck

test:
name: Test
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
version: ['5.0.4', '5.1.3', 'latest']

steps:
- name: Clone repository
Expand All @@ -78,13 +95,8 @@ jobs:
- name: Install dependencies
uses: ./.github/actions/install-dependencies

- name: Use `typescript@${{ matrix.version }}`
run: pnpm add -D -w typescript@${{ matrix.version }}

- name: Run tests
run: pnpm test:cov

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}

1 comment on commit a12abfd

@vercel
Copy link

@vercel vercel bot commented on a12abfd Oct 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

abitype – ./

abitype.vercel.app
abitype-git-main-wagmi-dev.vercel.app
abitype-wagmi-dev.vercel.app
abitype.dev

Please sign in to comment.