Skip to content

Commit 9180bfe

Browse files
committed
feat: add noCompile flag to the console task
1 parent 3533694 commit 9180bfe

File tree

2 files changed

+20
-10
lines changed

2 files changed

+20
-10
lines changed

v-next/hardhat/src/internal/builtin-plugins/console/index.ts

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ const hardhatPlugin: HardhatPlugin = {
1212
description: "Path to a history file",
1313
defaultValue: "console-history.txt",
1414
})
15+
.addFlag({
16+
name: "noCompile",
17+
description: "Don't compile before running this task",
18+
})
1519
.addVariadicArgument({
1620
name: "commands",
1721
description: "Commands to run in the console",

v-next/hardhat/src/internal/builtin-plugins/console/task-action.ts

+16-10
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,30 @@ const log = debug("hardhat:core:tasks:console");
1212
interface ConsoleActionArguments {
1313
commands: string[];
1414
history: string;
15+
noCompile: boolean;
1516
// We accept ReplOptions as an argument to allow tests overriding the IO streams
1617
options?: repl.ReplOptions;
1718
}
1819

1920
const consoleAction: NewTaskActionFunction<ConsoleActionArguments> = async (
20-
{ commands, history, options },
21+
{ commands, history, noCompile, options },
2122
hre,
2223
) => {
23-
return new Promise<REPLServer>(async (resolve) => {
24-
// Resolve the history path if it is not empty
25-
let historyPath: string | undefined;
26-
if (history !== "") {
27-
const globalCacheDir = await getCacheDir();
28-
historyPath = path.isAbsolute(history)
29-
? history
30-
: path.resolve(globalCacheDir, history);
31-
}
24+
// Resolve the history path if it is not empty
25+
let historyPath: string | undefined;
26+
if (history !== "") {
27+
const globalCacheDir = await getCacheDir();
28+
historyPath = path.isAbsolute(history)
29+
? history
30+
: path.resolve(globalCacheDir, history);
31+
}
3232

33+
// If noCompile is false, run the compile task first
34+
if (!noCompile) {
35+
// todo: run compile task
36+
}
37+
38+
return new Promise<REPLServer>(async (resolve) => {
3339
// Start a new REPL server with the default options
3440
const replServer = repl.start(options);
3541

0 commit comments

Comments
 (0)