Skip to content

Commit

Permalink
Bump TypeChain version (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
hasparus authored Nov 4, 2021
1 parent 4dc0afa commit 420987e
Show file tree
Hide file tree
Showing 27 changed files with 2,743 additions and 4,490 deletions.
5 changes: 5 additions & 0 deletions .changeset/moody-garlics-talk.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@dethcrypto/eth-sdk': patch
---

Updated dependencies. TypeChain upgrade causes change in emitted contract event types.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
build:
strategy:
matrix:
node: ['14.2']
node: ['14']
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}

Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.2
14
31 changes: 20 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,31 @@
],
"devDependencies": {
"@changesets/cli": "^2.17.0",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.10",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"@types/debug": "^4.1.7",
"@types/fs-extra": "^9.0.13",
"@types/glob": "^7.2.0",
"@types/lodash": "^4.14.176",
"@types/mkdirp": "^1.0.2",
"@types/mocha": "^9.0.0",
"@types/node": "^16.11.6",
"@types/proxyquire": "^1.3.28",
"@types/tmp": "^0.2.2",
"@typescript-eslint/eslint-plugin": "^5.3.0",
"@typescript-eslint/parser": "^5.3.0",
"dotenv": "^10.0.0",
"earljs": "^0.1.10",
"eslint": "^7.29.0",
"eslint-config-typestrict": "^1.0.1",
"eslint-plugin-import": "^2.23.4",
"eslint-config-typestrict": "^1.0.2",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonarjs": "^0.8.0-125",
"eslint-plugin-unused-imports": "^1.1.1",
"mocha": "^9.0.1",
"eslint-plugin-sonarjs": "^0.10.0",
"eslint-plugin-unused-imports": "^1.1.5",
"eslint": "^7",
"mocha": "^9.1.3",
"prettier": "^2.4.1",
"ts-node": "^10.0.0",
"proxyquire": "^2.1.3",
"ts-essentials": "^9.0.0",
"ts-node": "^10.4.0",
"typescript": "^4.4.4",
"wsrun": "^5.2.4"
}
Expand Down
39 changes: 6 additions & 33 deletions packages/eth-sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,48 +38,21 @@
"test:fix": "yarn lint:fix && yarn format:fix && yarn test && yarn typecheck"
},
"dependencies": {
"@typechain/ethers-v5": "^7.0.1",
"chalk": "^4.1.1",
"commander": "^8.0.0",
"debug": "^4.3.1",
"@typechain/ethers-v5": "^8.0.1",
"chalk": "^4.1.2",
"commander": "^8.3.0",
"debug": "^4.3.2",
"fs-extra": "^10.0.0",
"glob": "^7.1.7",
"glob": "^7.2.0",
"got": "^11.8.2",
"lodash": "^4.17.21",
"mkdirp": "^1.0.4",
"ora": "^5.4.1",
"tmp-promise": "^3.0.3",
"typechain": "^5.1.1",
"typechain": "^6.0.2",
"zod": "^3.11.5"
},
"peerDependencies": {
"ethers": "^5.3.1"
},
"devDependencies": {
"@types/debug": "^4.1.6",
"@types/fs-extra": "^9.0.11",
"@types/glob": "^7.1.3",
"@types/lodash": "^4.14.170",
"@types/mkdirp": "^1.0.1",
"@types/mocha": "^8.2.2",
"@types/node": "^14.14.10",
"@types/proxyquire": "^1.3.28",
"@types/tmp": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^4.28.0",
"@typescript-eslint/parser": "^4.28.0",
"earljs": "^0.1.10",
"eslint": "^7.29.0",
"eslint-config-typestrict": "^1.0.1",
"eslint-plugin-import": "^2.23.4",
"eslint-plugin-no-only-tests": "^2.6.0",
"eslint-plugin-simple-import-sort": "^7.0.0",
"eslint-plugin-sonarjs": "^0.8.0-125",
"eslint-plugin-unused-imports": "^1.1.1",
"mocha": "^9.0.1",
"prettier": "^2.3.1",
"proxyquire": "^2.1.3",
"ts-essentials": "^7.0.2",
"ts-node": "^10.0.0",
"typescript": "^4.4.4"
}
}
22 changes: 2 additions & 20 deletions packages/eth-sdk/src/client/transpileClient.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import debug from 'debug'
import * as glob from 'glob'
import { basename, join, resolve } from 'path'
import { resolve } from 'path'
import * as tsc from 'typescript'

import { Fs } from '../peripherals/fs'
Expand All @@ -9,7 +8,7 @@ const d = debug('@dethcrypto/eth-sdk-cli:client')
export async function transpileClient(clientPath: string, outputPath: string, fs: Fs): Promise<void> {
d(`Transpiling client from ${clientPath} to ${outputPath}`)

const tsFiles = glob.sync('**/*.ts', { cwd: clientPath, absolute: true })
const tsFiles = await fs.glob('**/*.ts', { cwd: clientPath, absolute: true })

await Promise.all(
outputs.map(async ({ directory, module }) => {
Expand Down Expand Up @@ -40,8 +39,6 @@ export async function transpileClient(clientPath: string, outputPath: string, fs
}

program.emit()

await copyDeclarationFiles(clientPath, outDir, fs)
}),
)
}
Expand All @@ -50,18 +47,3 @@ const outputs = [
{ module: tsc.ModuleKind.CommonJS, directory: 'cjs' },
{ module: tsc.ModuleKind.ESNext, directory: 'esm' },
]

/**
* We need to manually copy d.ts files b/c tsc won't do it
* @see https://stackoverflow.com/questions/56018167/typescript-does-not-copy-d-ts-files-to-build
*/
async function copyDeclarationFiles(clientPath: string, outDir: string, fs: Fs): Promise<void> {
const tsdFiles = glob.sync('types/**/*.d.ts', { cwd: clientPath, absolute: true })
await Promise.all(
tsdFiles.map(async (tsdPath) => {
const outputFilePath = join(outDir, 'types', basename(tsdPath))
d(`Copying ${tsdPath} to ${outputFilePath}`)
await fs.copy(tsdPath, outputFilePath)
}),
)
}
1 change: 0 additions & 1 deletion packages/eth-sdk/src/config/readConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export async function readConfig(filePath: string, requireJs: (id: string) => un
await registerTsNode()
exported = requireJs(filePath)
} else {
// @todo Support TypeScript configs
throw new Error(`Unsupported config file extension: ${extension}`)
}

Expand Down
4 changes: 4 additions & 0 deletions packages/eth-sdk/src/peripherals/fs.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import fs from 'fs'
import fsExtra from 'fs-extra'
import glob, { IOptions as GlobOptions } from 'glob'
import mkdirp from 'mkdirp'
import { dir as tmpDir } from 'tmp-promise'
import { promisify } from 'util'

export interface Fs {
exists(path: string): boolean
Expand All @@ -10,6 +12,7 @@ export interface Fs {
copy(src: string, dest: string): Promise<void>
readDir(path: string): Promise<string[]>
tmpDir(prefix: string): Promise<string>
glob(pattern: string, options?: GlobOptions | undefined): Promise<string[]>
}

export const realFs: Fs = {
Expand All @@ -24,4 +27,5 @@ export const realFs: Fs = {
const { path } = await tmpDir({ prefix })
return path
},
glob: promisify(glob),
}
6 changes: 3 additions & 3 deletions packages/test-e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@
"test:fix": "yarn lint:fix && yarn format:fix && yarn test && yarn typecheck"
},
"dependencies": {
"conditional-type-checks": "^1.0.5",
"earljs": "^0.1.10",
"ethers": "^5.4.6",
"ethers": "^5.5.1",
"ts-essentials": "^9.0.0",
"ts-node": "^10.2.1",
"conditional-type-checks": "^1.0.5"
"ts-node": "^10.4.0"
}
}
Loading

0 comments on commit 420987e

Please sign in to comment.