Skip to content

Commit e5583e1

Browse files
authored
fix: run yarn build if build/types are missing (#516)
1 parent 6962037 commit e5583e1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

hardhat.config.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import path from 'path'
22
import fs from 'fs'
33
import * as dotenv from 'dotenv'
4+
import { execSync } from 'child_process'
45

56
import 'hardhat/types/runtime'
67
import { HardhatUserConfig } from 'hardhat/types'
@@ -25,7 +26,7 @@ import 'solidity-coverage'
2526

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

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

41+
if (fs.existsSync(path.join(__dirname, 'build', 'types'))) {
42+
loadTasks()
43+
} else if (!SKIP_LOAD) {
44+
execSync('yarn build', { stdio: 'inherit' })
45+
loadTasks()
46+
}
47+
4048
// Networks
4149

4250
interface NetworkConfig {

0 commit comments

Comments
 (0)