Skip to content

Commit c2da5fc

Browse files
committed
feat: remove hardhat-dependency-compiler from contracts/test
Remove hardhat-dependency-compiler plugin as it's no longer needed. The hardhat-dependency-compiler plugin was a historical workaround that is no longer necessary for the current codebase structure. Changes: - Remove hardhat-dependency-compiler import and configuration from packages/contracts/test/hardhat.config.ts - Remove getContractPaths() and findSolidityFiles() helper functions - Remove hardhat-dependency-compiler dependency from packages/contracts/test/package.json - Clean up hardhat-dependency-compiler directory reference from packages/contracts/package.json clean script - Clean up unused imports (fs)
1 parent e816480 commit c2da5fc

File tree

4 files changed

+1
-74
lines changed

4 files changed

+1
-74
lines changed

packages/contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
],
2929
"scripts": {
3030
"prepack": "pnpm build",
31-
"clean": "rm -rf artifacts/ cache/ types/ abis/ build/ dist/ contracts/hardhat-dependency-compiler/",
31+
"clean": "rm -rf artifacts/ cache/ types/ abis/ build/ dist/",
3232
"build": "pnpm compile",
3333
"compile": "hardhat compile",
3434
"deploy": "pnpm predeploy && pnpm build",

packages/contracts/test/hardhat.config.ts

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -4,75 +4,19 @@ import '@nomiclabs/hardhat-ethers'
44
import '@nomiclabs/hardhat-waffle'
55
import '@typechain/hardhat'
66
import 'dotenv/config'
7-
import 'hardhat-dependency-compiler'
87
import 'hardhat-gas-reporter'
98
import 'solidity-coverage'
109
// Test-specific tasks
1110
import './tasks/migrate/nitro'
1211
import './tasks/test-upgrade'
1312

1413
import { configDir } from '@graphprotocol/contracts'
15-
import fs from 'fs'
1614
import { HardhatUserConfig } from 'hardhat/config'
1715
import path from 'path'
1816

1917
// Default mnemonic for testing
2018
const DEFAULT_TEST_MNEMONIC = 'myth like bonus scare over problem client lizard pioneer submit female collect'
2119

22-
// Recursively find all .sol files in a directory
23-
function findSolidityFiles(dir: string): string[] {
24-
const files: string[] = []
25-
26-
function walkDir(currentDir: string): void {
27-
const entries = fs.readdirSync(currentDir, { withFileTypes: true })
28-
29-
for (const entry of entries) {
30-
const fullPath = path.join(currentDir, entry.name)
31-
32-
if (entry.isDirectory()) {
33-
walkDir(fullPath)
34-
} else if (entry.isFile() && entry.name.endsWith('.sol')) {
35-
files.push(fullPath)
36-
}
37-
}
38-
}
39-
40-
walkDir(dir)
41-
return files
42-
}
43-
44-
// Dynamically find all Solidity files in @graphprotocol/contracts
45-
function getContractPaths(): string[] {
46-
const contractsDir = path.resolve(__dirname, '../contracts')
47-
48-
if (!fs.existsSync(contractsDir)) {
49-
throw new Error(`Contracts directory not found: ${contractsDir}`)
50-
}
51-
52-
const files = findSolidityFiles(contractsDir)
53-
54-
if (files.length === 0) {
55-
throw new Error(`No Solidity files found in: ${contractsDir}`)
56-
}
57-
58-
const contractPaths = files.map((file: string) => {
59-
// Convert absolute path to @graphprotocol/contracts relative path
60-
const relativePath = path.relative(contractsDir, file)
61-
return `@graphprotocol/contracts/contracts/${relativePath}`
62-
})
63-
64-
console.log(`Found ${contractPaths.length} Solidity files for dependency compilation`)
65-
66-
// // Log first few files for debugging
67-
// console.log('Sample files:')
68-
// contractPaths.slice(0, 5).forEach((p: string) => console.log(` ${p}`))
69-
// if (contractPaths.length > 5) {
70-
// console.log(` ... and ${contractPaths.length - 5} more`)
71-
// }
72-
73-
return contractPaths
74-
}
75-
7620
const config: HardhatUserConfig = {
7721
graph: {
7822
addressBook: process.env.ADDRESS_BOOK || 'addresses.json',
@@ -99,9 +43,6 @@ const config: HardhatUserConfig = {
9943
typechain: {
10044
outDir: 'types',
10145
},
102-
dependencyCompiler: {
103-
paths: getContractPaths(),
104-
},
10546
defaultNetwork: 'hardhat',
10647
networks: {
10748
hardhat: {

packages/contracts/test/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
"hardhat": "^2.24.0",
4343
"hardhat-abi-exporter": "^2.11.0",
4444
"hardhat-contract-sizer": "^2.10.0",
45-
"hardhat-dependency-compiler": "^1.2.1",
4645
"hardhat-gas-reporter": "^1.0.8",
4746
"hardhat-secure-accounts": "0.0.6",
4847
"hardhat-storage-layout": "^0.1.7",

pnpm-lock.yaml

Lines changed: 0 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)