Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: cleans up scripts folder #557

Merged
merged 4 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor Author

@douglance douglance Dec 17, 2024

Choose a reason for hiding this comment

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

this wasn't actually doing anything as far as I can tell. we don't need it.

it also fails using the inline commands, rather than the build script which was perhaps needed in the past but is unnecessary indirection now.

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 })
Copy link
Contributor Author

Choose a reason for hiding this comment

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

force: true doesn't need to check if it exists.

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
Loading