Skip to content

Commit c94743c

Browse files
authored
Merge pull request #5774 from NomicFoundation/galargh/hardhat-init
feat: implement alpha of hardhat --init for v3
2 parents 7f6eb44 + 6175ccb commit c94743c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+1396
-391
lines changed

.github/workflows/v-next-ci.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ jobs:
5656
[
5757
".",
5858
"packages/",
59-
"v-next/example-project"
59+
"v-next/example-project",
60+
"v-next/hardhat/templates/"
6061
]
6162
COMMON_FILTERS: |
6263
[

pnpm-lock.yaml

+36
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pnpm-workspace.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
packages:
22
- "packages/*"
33
- "v-next/*"
4+
- "v-next/hardhat/templates/*"

v-next/hardhat-errors/src/descriptors.ts

+17-19
Original file line numberDiff line numberDiff line change
@@ -155,22 +155,8 @@ Please double check whether you have multiple versions of the same plugin instal
155155
websiteTitle: "Hardhat project already created",
156156
websiteDescription: `Cannot create a new Hardhat project, the current folder is already associated with a project.`,
157157
},
158-
NOT_INSIDE_PROJECT_ON_WINDOWS: {
159-
number: 11,
160-
messageTemplate: `You are not inside a project and Hardhat failed to initialize a new one.
161-
162-
If you were trying to create a new project, please try again using Windows Subsystem for Linux (WSL) or PowerShell.
163-
`,
164-
websiteTitle:
165-
"You are not inside a Hardhat project and Hardhat failed to initialize a new one",
166-
websiteDescription: `You are trying to run Hardhat outside of a Hardhat project, and we couldn't initialize one.
167-
168-
If you were trying to create a new project, please try again using Windows Subsystem for Linux (WSL) or PowerShell.
169-
170-
You can learn how to use Hardhat by reading the [Getting Started guide](/hardhat-runner/docs/getting-started).`,
171-
},
172158
NOT_IN_INTERACTIVE_SHELL: {
173-
number: 12,
159+
number: 11,
174160
messageTemplate:
175161
"You are trying to initialize a project but you are not in an interactive shell.",
176162
websiteTitle: "Not inside an interactive shell",
@@ -179,7 +165,7 @@ You can learn how to use Hardhat by reading the [Getting Started guide](/hardhat
179165
Please re-run the command inside an interactive shell.`,
180166
},
181167
UNSUPPORTED_OPERATION: {
182-
number: 13,
168+
number: 12,
183169
messageTemplate: "{operation} is not supported in Hardhat.",
184170
websiteTitle: "Unsupported operation",
185171
websiteDescription: `You are trying to perform an unsupported operation.
@@ -189,7 +175,7 @@ Unless you are creating a task or plugin, this is probably a bug.
189175
Please [report it](https://github.com/nomiclabs/hardhat/issues/new) to help us improve Hardhat.`,
190176
},
191177
ONLY_ESM_SUPPORTED: {
192-
number: 14,
178+
number: 13,
193179
messageTemplate: `Hardhat only supports ESM projects. Please be sure to specify "'type': 'module'" in your package.json`,
194180
websiteTitle: "Only ESM projects are supported",
195181
websiteDescription: `You are trying to initialize a new Hardhat project, but your package.json does not have the property "type" set to "module".
@@ -199,20 +185,32 @@ Currently, Hardhat only supports ESM projects.
199185
Please add the property "type" with the value "module" in your package.json to ensure that your project is recognized as an ESM project.`,
200186
},
201187
GLOBAL_OPTION_ALREADY_DEFINED: {
202-
number: 15,
188+
number: 14,
203189
messageTemplate:
204190
"Plugin {plugin} is trying to define the global option {globalOption} but it is already defined by plugin {definedByPlugin}",
205191
websiteTitle: "Global option already defined",
206192
websiteDescription:
207193
"The global option is already defined by another plugin. Please ensure that global options are uniquely named to avoid conflicts.",
208194
},
209195
INVALID_CONFIG: {
210-
number: 16,
196+
number: 15,
211197
messageTemplate: `Invalid config:
212198
{errors}`,
213199
websiteTitle: "Invalid config",
214200
websiteDescription: `The configuration you provided is invalid. Please check the documentation to learn how to configure Hardhat correctly.`,
215201
},
202+
TEMPLATE_NOT_FOUND: {
203+
number: 16,
204+
messageTemplate: `Template {template} not found`,
205+
websiteTitle: "Template not found",
206+
websiteDescription: `The template you provided is not found. Please check the documentation to learn which templates are available.`,
207+
},
208+
WORKSPACE_NOT_FOUND: {
209+
number: 17,
210+
messageTemplate: `Workspace {workspace} not found`,
211+
websiteTitle: "Workspace not found",
212+
websiteDescription: `The workspace you provided does not exist. Please ensure that the workspace exists and try again.`,
213+
},
216214
},
217215
INTERNAL: {
218216
ASSERTION_ERROR: {

v-next/hardhat-utils/src/package.ts

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { getFilePath } from "./internal/package.js";
1515
export interface PackageJson {
1616
name: string;
1717
version: string;
18+
description?: string;
1819
type?: "commonjs" | "module";
1920
engines?: {
2021
node: string;

v-next/hardhat/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@
5353
"files": [
5454
"dist/src/",
5555
"src/",
56+
"templates/",
5657
"CHANGELOG.md",
5758
"LICENSE",
5859
"README.md"
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
export const HARDHAT_NAME = "Hardhat";
2-
export const HARDHAT_PACKAGE_NAME = "hardhat";

0 commit comments

Comments
 (0)