Skip to content

Commit 6175ccb

Browse files
committed
chore: default to a relative path when asking for a workspace
1 parent d28ddef commit 6175ccb

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

v-next/hardhat/src/internal/cli/init/init.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
readJsonFile,
1414
writeJsonFile,
1515
} from "@ignored/hardhat-vnext-utils/fs";
16+
import { resolveFromRoot } from "@ignored/hardhat-vnext-utils/path";
1617
import chalk from "chalk";
1718

1819
import { findClosestHardhatConfig } from "../../config-loading.js";
@@ -169,7 +170,7 @@ export async function getWorkspace(workspace?: string): Promise<string> {
169170
workspace = await promptForWorkspace();
170171
}
171172

172-
workspace = path.resolve(workspace);
173+
workspace = resolveFromRoot(process.cwd(), workspace);
173174

174175
if (!(await exists(workspace)) || !(await isDirectory(workspace))) {
175176
throw new HardhatError(HardhatError.ERRORS.GENERAL.WORKSPACE_NOT_FOUND, {

v-next/hardhat/src/internal/cli/init/prompt.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ export async function promptForWorkspace(): Promise<string> {
1111
{
1212
name: "workspace",
1313
type: "input",
14-
message: "Where would you like to initialize the project?",
15-
initial: process.cwd(),
14+
message: `Where would you like to initialize the project?\n\nPlease provide either a path relative to ${process.cwd()} or an absolute path:`,
15+
initial: ".",
1616
},
1717
]);
1818

0 commit comments

Comments
 (0)