hardhat
Version:
Hardhat is an extensible developer tool that helps smart contract developers increase productivity by reliably bringing together the tools they want.
17 lines • 787 B
JavaScript
import { pathToFileURL } from "node:url";
import { HardhatError } from "@nomicfoundation/hardhat-errors";
import { exists } from "@nomicfoundation/hardhat-utils/fs";
import { resolveFromRoot } from "@nomicfoundation/hardhat-utils/path";
const runScriptWithHardhat = async ({ script, noCompile }, hre) => {
const normalizedPath = resolveFromRoot(process.cwd(), script);
if (!(await exists(normalizedPath))) {
throw new HardhatError(HardhatError.ERRORS.CORE.BUILTIN_TASKS.RUN_FILE_NOT_FOUND, { script });
}
if (!noCompile) {
await hre.tasks.getTask("build").run({ quiet: true, noTests: true });
console.log();
}
await import(pathToFileURL(normalizedPath).href);
};
export default runScriptWithHardhat;
//# sourceMappingURL=task-action.js.map