Commit 02e127b3 authored by Kelvin Fichter's avatar Kelvin Fichter

fix: remove fs-promises import for node 12 compat

parent 7dc40ad9
/* eslint @typescript-eslint/no-var-requires: "off" */ /* eslint @typescript-eslint/no-var-requires: "off" */
import { access, mkdir } from 'fs/promises'
import fetch from 'node-fetch' import fetch from 'node-fetch'
import path from 'path' import path from 'path'
import fs, { mkdirSync } from 'fs' import fs from 'fs'
import solc from 'solc' import solc from 'solc'
import { ethers } from 'ethers' import { ethers } from 'ethers'
import { clone } from '@eth-optimism/core-utils' import { clone } from '@eth-optimism/core-utils'
...@@ -66,7 +65,7 @@ export const downloadSolc = async (version: string, ovm?: boolean) => { ...@@ -66,7 +65,7 @@ export const downloadSolc = async (version: string, ovm?: boolean) => {
try { try {
// Check to see if we already have the file // Check to see if we already have the file
await access(file, fs.constants.F_OK) fs.accessSync(file, fs.constants.F_OK)
} catch (e) { } catch (e) {
console.error(`Downloading ${version} ${ovm ? 'ovm' : 'solidity'}`) console.error(`Downloading ${version} ${ovm ? 'ovm' : 'solidity'}`)
// If we don't have the file, download it // If we don't have the file, download it
...@@ -81,7 +80,7 @@ export const downloadSolc = async (version: string, ovm?: boolean) => { ...@@ -81,7 +80,7 @@ export const downloadSolc = async (version: string, ovm?: boolean) => {
*/ */
export const downloadAllSolcVersions = async () => { export const downloadAllSolcVersions = async () => {
try { try {
await mkdir(LOCAL_SOLC_DIR) fs.mkdirSync(LOCAL_SOLC_DIR)
} catch (e) { } catch (e) {
// directory already exists // directory already exists
} }
...@@ -213,14 +212,14 @@ export const compile = (opts: { ...@@ -213,14 +212,14 @@ export const compile = (opts: {
ovm: boolean ovm: boolean
}): any => { }): any => {
try { try {
mkdirSync(EVM_SOLC_CACHE_DIR, { fs.mkdirSync(EVM_SOLC_CACHE_DIR, {
recursive: true, recursive: true,
}) })
} catch (e) { } catch (e) {
// directory already exists // directory already exists
} }
try { try {
mkdirSync(OVM_SOLC_CACHE_DIR, { fs.mkdirSync(OVM_SOLC_CACHE_DIR, {
recursive: true, recursive: true,
}) })
} catch (e) { } catch (e) {
......
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