Skip to content

Commit

Permalink
Merge branch 'v-next' into robust-compiler-downloader
Browse files Browse the repository at this point in the history
  • Loading branch information
galargh authored Jan 3, 2025
2 parents c48a049 + 3af0a3f commit a6fab0e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion v-next/hardhat/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ printNodeJsVersionWarningIfNecessary();
// eslint-disable-next-line no-restricted-syntax -- Allow top-level await here
const { main } = await import("./internal/cli/main.js");

main(process.argv.slice(2), { registerTsx: true }).catch(() => {
function isTsxRequired(): boolean {
const tsNativeRuntimes = ["Deno"];
// environments that support typescript natively don't need tsx
if (tsNativeRuntimes.some((env) => env in globalThis)) {
return false;
}
return true;
}

main(process.argv.slice(2), { registerTsx: isTsxRequired() }).catch(() => {
process.exitCode = 1;
});
4 changes: 2 additions & 2 deletions v-next/hardhat/src/internal/cli/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { printVersionMessage } from "./version.js";

export interface MainOptions {
print?: (message: string) => void;
registerTsx?: true;
registerTsx?: boolean;
rethrowErrors?: true;
}

Expand Down Expand Up @@ -98,7 +98,7 @@ export async function main(
return;
}

if (options.registerTsx) {
if (options.registerTsx === true) {
register();
}

Expand Down

0 comments on commit a6fab0e

Please sign in to comment.