Skip to content

Commit b32a561

Browse files
authored
match viem tsconfig and build settings, ready to try publishing (#65)
* match viem tsconfig and build settings, ready to try publishing * updated to more closely match viem * more cleanup and matching, build working now I think * more fixes * build and import working, but not seeing types as expected * closer, still not type checking how I want it to * fix typecheck, revert: different errors on different machines * bump version * fix types for package * add src/utils/index.ts * version bump * fix export * version bump * fixes * improve exports * version bump * format and add more utils exports * add export * 17 * improve types * add chains to export * add export types, I think that will be the last for this * attempt type fix * fix types * add typecheck to workflow
1 parent 31121dd commit b32a561

File tree

71 files changed

+1064
-986
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1064
-986
lines changed

.github/workflows/verify.yml

+26
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,32 @@ jobs:
3333

3434
- name: Lint code
3535
run: pnpm format:check && pnpm lint
36+
37+
types:
38+
name: Types
39+
runs-on: ubuntu-latest
40+
timeout-minutes: 5
41+
42+
steps:
43+
- name: Checkout code
44+
uses: actions/checkout@v3
45+
46+
- name: Set up pnpm
47+
uses: pnpm/action-setup@v2
48+
with:
49+
version: 8
50+
51+
- name: Set up node
52+
uses: actions/setup-node@v3
53+
with:
54+
cache: pnpm
55+
node-version: 18
56+
57+
- name: Install dependencies
58+
run: pnpm install
59+
60+
- name: Check types
61+
run: pnpm typecheck
3662

3763
test:
3864
name: Test

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,4 +24,6 @@ yarn-error.log*
2424
bench
2525
dist
2626
cache
27-
node_modules
27+
node_modules
28+
tsconfig*.tsbuildinfo
29+
*.tgz

.vscode/settings.json

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"editor.defaultFormatter": "dprint.dprint",
3+
"editor.formatOnSave": true,
4+
"typescript.tsdk": "node_modules/typescript/lib",
5+
"typescript.enablePromptUseWorkspaceTsdk": true,
6+
"editor.codeActionsOnSave": {
7+
"source.organizeImports.biome": true
8+
}
9+
}

package.json

+64-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,49 @@
11
{
2-
"name": "op-viem",
3-
"version": "0.1.0",
2+
"name": "test-op-viem",
3+
"version": "0.0.21-alpha",
4+
"type": "module",
5+
"main": "./dist/cjs/index.js",
6+
"module": "./dist/esm/index.js",
7+
"types": "./dist/types/index.d.ts",
8+
"typings": "./dist/types/index.d.ts",
9+
"sideEffects": false,
10+
"files": [
11+
"dist",
12+
"!dist/**/*.tsbuildinfo",
13+
"src/**/*.ts",
14+
"!src/**/*.test.ts",
15+
"!src/**/*.test-d.ts",
16+
"!src/**/*.bench.ts",
17+
"!src/_test/**/*"
18+
],
19+
"exports": {
20+
".": {
21+
"types": "./dist/types/index.d.ts",
22+
"import": "./dist/esm/index.js",
23+
"default": "./dist/cjs/index.js"
24+
},
25+
"./chains": {
26+
"types": "./dist/types/chains/index.d.ts",
27+
"import": "./dist/esm/chains/index.js",
28+
"default": "./dist/cjs/chains/index.js"
29+
},
30+
"./utils": {
31+
"types": "./dist/types/utils/index.d.ts",
32+
"import": "./dist/esm/utils/index.js",
33+
"default": "./dist/cjs/utils/index.js"
34+
},
35+
"./package.json": "./package.json"
36+
},
37+
"typesVersions": {
38+
"*": {
39+
"chains": [
40+
"./dist/types/chains.d.ts"
41+
],
42+
"utils": [
43+
"./dist/types/utils/index.d.ts"
44+
]
45+
}
46+
},
447
"devDependencies": {
548
"@biomejs/biome": "1.0.0",
649
"@eth-optimism/core-utils": "^0.12.3",
@@ -17,11 +60,17 @@
1760
"ethers": "^5.7.0",
1861
"react": "^18.1.0",
1962
"react-dom": "^18.1.0",
20-
"typescript": "^5.2.2",
63+
"rimraf": "^5.0.1",
64+
"typescript": "5.0.4",
2165
"vitest": "^0.34.1",
2266
"wagmi": "^1.3.11"
2367
},
2468
"scripts": {
69+
"build": "pnpm run clean && pnpm run build:cjs && pnpm run build:esm && pnpm run build:types",
70+
"build:cjs": "tsc --project tsconfig.build.json --module commonjs --outDir ./dist/cjs --removeComments --verbatimModuleSyntax false && echo > ./dist/cjs/package.json '{\"type\":\"commonjs\"}'",
71+
"build:esm": "tsc --project tsconfig.build.json --module es2015 --outDir ./dist/esm && echo > ./dist/esm/package.json '{\"type\":\"module\",\"sideEffects\":false}'",
72+
"build:types": "tsc --project tsconfig.build.json --module esnext --declarationDir ./dist/types --emitDeclarationOnly --declaration --declarationMap",
73+
"clean": "rimraf dist",
2574
"format": "dprint fmt",
2675
"format:check": "dprint check",
2776
"lint": "biome check .",
@@ -40,6 +89,17 @@
4089
"@eth-optimism/contracts-ts": "^0.15.0"
4190
},
4291
"peerDependencies": {
43-
"viem": "1.x"
92+
"viem": "1.x",
93+
"typescript": ">=5.0.4"
94+
},
95+
"peerDependenciesMeta": {
96+
"typescript": {
97+
"optional": true
98+
}
99+
},
100+
"pnpm": {
101+
"overrides": {
102+
"test-op-viem": "workspace:*"
103+
}
44104
}
45105
}

0 commit comments

Comments
 (0)