Skip to content

Commit 9f7b793

Browse files
committed
fix: hardhat artifacts path detection
1 parent b1b8226 commit 9f7b793

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/commands/contract-size.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -130,13 +130,12 @@ function getContractSizes(fileName) {
130130
const foundryJsonPath = path.join(workspaceRoot, foundryOutDir, `${path.basename(fileName)}`, `${contractName}.json`);
131131
let hardhatJsonPath = null;
132132
if (hardhatOutDir) {
133-
const relativePath = path.relative(path.join(workspaceRoot, 'contracts'), fileName);
133+
const relativePath = path.relative(workspaceRoot, fileName);
134134
hardhatJsonPath = path.join(hardhatOutDir, relativePath, `${contractName}.json`);
135135
}
136136

137137
const jsonPaths = [foundryJsonPath, hardhatJsonPath].filter(Boolean);
138-
139-
for (const jsonPath of jsonPaths) {
138+
for (const jsonPath of jsonPaths) {
140139
try {
141140
if (fs.existsSync(jsonPath)) {
142141
const jsonContent = JSON.parse(fs.readFileSync(jsonPath, 'utf8'));

0 commit comments

Comments
 (0)