-
Notifications
You must be signed in to change notification settings - Fork 192
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
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 }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
rmSync(`${ABI_PATH}/classic`, { recursive: true, force: true }) | ||
|
||
const cwd = process.cwd() | ||
|
||
|
@@ -59,7 +61,7 @@ async function main() { | |
cwd, | ||
filesToProcess: nitroFiles, | ||
allFiles: nitroFiles, | ||
outDir: './src/lib/abi/', | ||
outDir: `${ABI_PATH}`, | ||
target: 'ethers-v5', | ||
}) | ||
|
||
|
@@ -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') | ||
} | ||
|
There was a problem hiding this comment.
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.