Skip to content

Commit

Permalink
refactor: clean up scripts folder (#557)
Browse files Browse the repository at this point in the history
  • Loading branch information
douglance authored Dec 18, 2024
1 parent c47d1f5 commit 48cecb6
Show file tree
Hide file tree
Showing 33 changed files with 32 additions and 1,026 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Lint sdk
run: |
yarn gen:abi
yarn build --reporter-options output=$TEST_PATH/sdk.xml
yarn build
yarn lint --format junit -o $TEST_PATH/sdk-lint.xml
- name: Upload build artifacts
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@
"scripts": {
"audit:ci": "audit-ci --config ./audit-ci.jsonc",
"prepare": "yarn run gen:abi",
"gen:abi": "node ./scripts/genAbi.js",
"gen:abi": "ts-node ./scripts/genAbi.ts",
"gen:network": "ts-node ./scripts/genNetwork.ts",
"prepublishOnly": "yarn build && yarn format",
"preversion": "yarn lint",
"prebuild": "yarn gen:abi",
"build": "./scripts/builder",
"build": "rm -rf dist && tsc -p tsconfig.json",
"watch": "tsc --watch",
"test": "mocha",
"test:coverage": "nyc mocha",
Expand Down
4 changes: 0 additions & 4 deletions packages/sdk/scripts/builder

This file was deleted.

41 changes: 0 additions & 41 deletions packages/sdk/scripts/cancelRetryable.ts

This file was deleted.

37 changes: 0 additions & 37 deletions packages/sdk/scripts/checkRetryableStatus.ts

This file was deleted.

27 changes: 0 additions & 27 deletions packages/sdk/scripts/cleanCompileContracts.ts

This file was deleted.

189 changes: 0 additions & 189 deletions packages/sdk/scripts/deployStandard.ts

This file was deleted.

26 changes: 14 additions & 12 deletions packages/sdk/scripts/genAbi.js → packages/sdk/scripts/genAbi.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
const { runTypeChain, glob } = require('typechain')
const { execSync } = require('child_process')
const { unlinkSync, existsSync, rmSync } = require('fs')
import { runTypeChain, glob } from 'typechain'
import { execSync } from 'child_process'
import { unlinkSync, rmSync } from 'fs'
import * as path from 'path'

const getPackagePath = packageName => {
const ABI_PATH = path.resolve(__dirname, '../src/lib/abi')

const getPackagePath = (packageName: string): string => {
const path = require.resolve(`${packageName}/package.json`)
return path.substr(0, path.indexOf('package.json'))
}

async function main() {
if (existsSync('./src/lib/abi/')) {
console.log('Removing previously generated ABIs.\n')
rmSync('./src/lib/abi/', { recursive: true })
}
console.log('Removing previously generated ABIs.\n')
rmSync(`${ABI_PATH}`, { recursive: true, force: true })
rmSync(`${ABI_PATH}/classic`, { recursive: true, force: true })

const cwd = process.cwd()

Expand Down Expand Up @@ -59,7 +61,7 @@ async function main() {
cwd,
filesToProcess: nitroFiles,
allFiles: nitroFiles,
outDir: './src/lib/abi/',
outDir: `${ABI_PATH}`,
target: 'ethers-v5',
})

Expand All @@ -72,13 +74,13 @@ async function main() {
cwd,
filesToProcess: classicFiles,
allFiles: classicFiles,
outDir: './src/lib/abi/classic',
outDir: `${ABI_PATH}/classic`,
target: 'ethers-v5',
})

// we delete the index file since it doesn't play well with tree shaking
unlinkSync(`${cwd}/src/lib/abi/index.ts`)
unlinkSync(`${cwd}/src/lib/abi/classic/index.ts`)
unlinkSync(`${ABI_PATH}/index.ts`)
unlinkSync(`${ABI_PATH}/classic/index.ts`)

console.log('Typechain generated')
}
Expand Down
Loading

0 comments on commit 48cecb6

Please sign in to comment.