Skip to content

Commit

Permalink
fix: run yarn build if build/types are missing (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
glmaljkovich authored Oct 14, 2021
1 parent 6962037 commit e5583e1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import path from 'path'
import fs from 'fs'
import * as dotenv from 'dotenv'
import { execSync } from 'child_process'

import 'hardhat/types/runtime'
import { HardhatUserConfig } from 'hardhat/types'
Expand All @@ -25,7 +26,7 @@ import 'solidity-coverage'

const SKIP_LOAD = process.env.SKIP_LOAD === 'true'

if (!SKIP_LOAD) {
function loadTasks() {
require('./tasks/gre.ts')
;['contracts', 'misc', 'deployment', 'actions'].forEach((folder) => {
const tasksPath = path.join(__dirname, 'tasks', folder)
Expand All @@ -37,6 +38,13 @@ if (!SKIP_LOAD) {
})
}

if (fs.existsSync(path.join(__dirname, 'build', 'types'))) {
loadTasks()
} else if (!SKIP_LOAD) {
execSync('yarn build', { stdio: 'inherit' })
loadTasks()
}

// Networks

interface NetworkConfig {
Expand Down

0 comments on commit e5583e1

Please sign in to comment.