Commit 1dacf164 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #1795 from ethereum-optimism/develop

Develop -> Master PR
parents 5a8f2bf2 21514e2b
---
'@eth-optimism/batch-submitter': patch
'@eth-optimism/core-utils': patch
'@eth-optimism/message-relayer': patch
'@eth-optimism/regenesis-surgery': patch
'@eth-optimism/replica-healthcheck': patch
---
Fix package JSON issues
......@@ -6,7 +6,7 @@
"main": "dist/index",
"types": "dist/index",
"files": [
"dist/index"
"dist/*"
],
"scripts": {
"start": "node ./exec/run-batch-submitter.js",
......
......@@ -22,7 +22,7 @@
"build:contracts": "hardhat compile --show-stack-traces",
"build:dump": "ts-node bin/take-dump.ts",
"autogen:markdown": "node scripts/generate-markdown.js",
"autogen:artifacts": "node scripts/generate-artifacts.js && node scripts/generate-deployed-artifacts.js",
"autogen:artifacts": "ts-node scripts/generate-artifacts.ts && ts-node scripts/generate-deployed-artifacts.ts",
"test": "yarn test:contracts",
"test:contracts": "hardhat test --show-stack-traces",
"test:coverage": "NODE_OPTIONS=--max_old_space_size=8192 hardhat coverage && istanbul check-coverage --statements 88 --branches 76 --functions 84 --lines 88",
......
#!/usr/bin/env node
const path = require('path')
const glob = require('glob')
const fs = require('fs')
;(async () => {
console.log(`writing contract artifacts typescript file`)
const getContractJsonFiles = (artifactsFolder) => {
return glob.sync(`${artifactsFolder}/**/*.json`).filter((match) => {
return !match.endsWith('.dbg.json')
})
}
const evmArtifactPaths = getContractJsonFiles(
path.resolve(__dirname, `../artifacts/contracts`)
)
const content = `
/* eslint-disable @typescript-eslint/no-var-requires, no-empty */
/*
THIS FILE IS AUTOMATICALLY GENERATED.
DO NOT EDIT.
*/
${evmArtifactPaths
.map((artifactPath) => {
const artifact = require(artifactPath)
const relPath = path.relative(__dirname, artifactPath)
return `
let ${artifact.contractName}
try {
${artifact.contractName} = require('${relPath}')
} catch {}
`
})
.join('\n')}
export const getContractArtifact = (name: string): any => {
return {
${evmArtifactPaths
.map((artifactPath) => {
const artifact = require(artifactPath)
return `${artifact.contractName}: ${artifact.contractName}`
})
.join(',\n')}
}[name]
}
`
fs.writeFileSync(`./src/contract-artifacts.ts`, content)
})().catch(console.error)
import path from 'path'
import glob from 'glob'
import fs from 'fs'
/**
* Script for automatically generating a file which has a series of `require` statements for
* importing JSON contract artifacts. We do this to preserve browser compatibility.
*/
const main = async () => {
const contractArtifactsFolder = path.resolve(
__dirname,
`../artifacts/contracts`
)
const artifactPaths = glob
.sync(`${contractArtifactsFolder}/**/*.json`)
.filter((match) => {
// Filter out the debug outputs.
return !match.endsWith('.dbg.json')
})
const content = `
/* eslint-disable @typescript-eslint/no-var-requires, no-empty */
/*
THIS FILE IS AUTOMATICALLY GENERATED.
DO NOT EDIT.
*/
${artifactPaths
.map((artifactPath) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const artifact = require(artifactPath)
const relPath = path.relative(__dirname, artifactPath)
return `
let ${artifact.contractName}
try {
${artifact.contractName} = require('${relPath}')
} catch {}
`
})
.join('\n')}
export const getContractArtifact = (name: string): any => {
return {
${artifactPaths
.map((artifactPath) => {
// eslint-disable-next-line @typescript-eslint/no-var-requires
const artifact = require(artifactPath)
return `${artifact.contractName}`
})
.join(',\n')}
}[name]
}
`
fs.writeFileSync(
path.resolve(__dirname, `../src/contract-artifacts.ts`),
content
)
}
main()
#!/usr/bin/env node
const path = require('path')
const glob = require('glob')
const fs = require('fs')
;(async () => {
console.log(`writing deployed contract artifacts typescript file`)
import path from 'path'
import glob from 'glob'
import fs from 'fs'
/**
* Script for automatically generating a TypeScript file for retrieving deploy artifact JSON files.
* We do this to make sure that this package remains browser compatible.
*/
const main = async () => {
let content = `
/* eslint-disable */
/*
......@@ -51,14 +52,12 @@ const fs = require('fs')
content += `
export const getDeployedContractArtifact = (name: string, network: string): any => {
return {
${artifactNames
.map((artifactName) => {
return `${artifactName}: ${artifactName}`
})
.join(',\n')}
${artifactNames.join(',\n')}
}[(network + '__' + name).replace(/-/g, '_')]
}
`
fs.writeFileSync(`./src/contract-deployed-artifacts.ts`, content)
})().catch(console.error)
}
main()
......@@ -5,7 +5,7 @@
"main": "dist/index",
"types": "dist/index",
"files": [
"dist/index"
"dist/*"
],
"scripts": {
"all": "yarn clean && yarn build && yarn test && yarn lint:fix && yarn lint",
......
......@@ -5,7 +5,7 @@
"main": "dist/index",
"types": "dist/index",
"files": [
"dist/index"
"dist/*"
],
"bin": {
"withdraw": "./src/exec/withdraw.ts"
......
......@@ -6,7 +6,7 @@
"main": "dist/index",
"types": "dist/index",
"files": [
"dist/index"
"dist/*"
],
"scripts": {
"clean": "rimraf ./dist ./tsconfig.build.tsbuildinfo",
......
......@@ -6,7 +6,7 @@
"main": "dist/index",
"types": "dist/index",
"files": [
"dist/index"
"dist/*"
],
"scripts": {
"clean": "rimraf ./dist ./tsconfig.build.tsbuildinfo",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment