Skip to content

Commit 08d92fb

Browse files
authored
Merge branch 'main' into 7048
2 parents 2b11b20 + 0ef4c4c commit 08d92fb

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

.changeset/fast-turkeys-applaud.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
"@nomicfoundation/hardhat-utils": patch
3+
"hardhat": patch
4+
---
5+
6+
Fix npm artifact cleanup on windows ([#7459](https://github.com/NomicFoundation/hardhat/issues/7459))

v-next/hardhat/src/internal/builtin-plugins/solidity/build-system/build-system.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,9 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
833833
const parsed = parseRootPath(rootFilePath);
834834
return isNpmParsedRootPath(parsed)
835835
? parsed.npmPath
836-
: path.relative(this.#options.projectRoot, parsed.fsPath);
836+
: toForwardSlash(
837+
path.relative(this.#options.projectRoot, parsed.fsPath),
838+
);
837839
});
838840

839841
const userSourceNamesSet = new Set(userSourceNames);
@@ -842,7 +844,9 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
842844
artifactsDirectory,
843845
(d) => d.endsWith(".sol"),
844846
)) {
845-
const relativePath = path.relative(artifactsDirectory, file);
847+
const relativePath = toForwardSlash(
848+
path.relative(artifactsDirectory, file),
849+
);
846850

847851
if (!userSourceNamesSet.has(relativePath)) {
848852
await remove(file);
@@ -1132,3 +1136,7 @@ export class SolidityBuildSystemImplementation implements SolidityBuildSystem {
11321136
}
11331137
}
11341138
}
1139+
1140+
function toForwardSlash(str: string): string {
1141+
return str.split(/[\\\/]/).join(path.posix.sep);
1142+
}

0 commit comments

Comments
 (0)