File tree 2 files changed +11
-4
lines changed
2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import { HookManagerImplementation } from "./hook-manager.js";
26
26
import { resolvePluginList } from "./plugins/resolve-plugin-list.js" ;
27
27
import { TaskManagerImplementation } from "./tasks/task-manager.js" ;
28
28
import { UserInterruptionManagerImplementation } from "./user-interruptions.js" ;
29
+ import { getRealPath } from "@ignored/hardhat-vnext-utils/fs" ;
29
30
30
31
export class HardhatRuntimeEnvironmentImplementation
31
32
implements HardhatRuntimeEnvironment
@@ -142,12 +143,17 @@ export class HardhatRuntimeEnvironmentImplementation
142
143
}
143
144
144
145
/**
145
- * Resolves the project root of a Hardhat project.
146
+ * Resolves the project root of a Hardhat project based on the config file or
147
+ * another path within the project. If not provided, it will be resolved from
148
+ * the current working directory.
149
+ *
150
+ * @param absolutePathWithinProject An absolute path within the project, usually
151
+ * the config file.
146
152
*/
147
153
export async function resolveProjectRoot (
148
- projectRoot : string | undefined ,
154
+ absolutePathWithinProject : string | undefined ,
149
155
) : Promise < string > {
150
- return findClosestPackageRoot ( projectRoot ?? process . cwd ( ) ) ;
156
+ return findClosestPackageRoot ( absolutePathWithinProject ?? process . cwd ( ) ) ;
151
157
}
152
158
153
159
async function runUserConfigExtensions (
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ import {
26
26
assertHardhatInvariant ,
27
27
} from "@ignored/hardhat-vnext-errors" ;
28
28
import { isCi } from "@ignored/hardhat-vnext-utils/ci" ;
29
+ import { getRealPath } from "@ignored/hardhat-vnext-utils/fs" ;
29
30
import { kebabToCamelCase } from "@ignored/hardhat-vnext-utils/string" ;
30
31
31
32
import { resolveHardhatConfigPath } from "../../config.js" ;
@@ -70,7 +71,7 @@ export async function main(
70
71
}
71
72
72
73
const projectRoot = await resolveProjectRoot (
73
- builtinGlobalOptions . configPath ,
74
+ await getRealPath ( builtinGlobalOptions . configPath ) ,
74
75
) ;
75
76
76
77
const userConfig = await importUserConfig ( builtinGlobalOptions . configPath ) ;
You can’t perform that action at this time.
0 commit comments