-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3155 from phated/phated/cjs
feat: Load hardhat.config.cjs to partially support ESM projects
- Loading branch information
Showing
18 changed files
with
291 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/.gitignore
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/cache | ||
/artifacts |
5 changes: 5 additions & 0 deletions
5
...s/hardhat-core/test/fixture-projects/esm-project-with-scripts/assert-hardhat-arguments.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as process from "process"; | ||
|
||
if (hardhatArguments.network !== "custom") { | ||
process.exit(1); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/async-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import * as process from "process"; | ||
|
||
setTimeout(() => { | ||
if (global.config === undefined || global.config.solidity === undefined) { | ||
process.exit(123); | ||
} | ||
}, 100); |
2 changes: 2 additions & 0 deletions
2
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/contracts/a.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
contract A {} | ||
|
5 changes: 5 additions & 0 deletions
5
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/env-var-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as process from "process"; | ||
|
||
if (process.env.TEST_ENV_VAR !== "test") { | ||
process.exit(123); | ||
} |
3 changes: 3 additions & 0 deletions
3
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/failing-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import * as process from "process"; | ||
|
||
process.exit(123); |
8 changes: 8 additions & 0 deletions
8
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/hardhat.config.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = { | ||
solidity: "0.5.15", | ||
networks: { | ||
custom: { | ||
url: "asd", | ||
}, | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
10 changes: 10 additions & 0 deletions
10
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/params-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import * as process from "process"; | ||
|
||
if ( | ||
process.argv.length !== 5 || | ||
process.argv[2] !== "a" || | ||
process.argv[3] !== "b" || | ||
process.argv[4] !== "c" | ||
) { | ||
process.exit(12); | ||
} |
5 changes: 5 additions & 0 deletions
5
packages/hardhat-core/test/fixture-projects/esm-project-with-scripts/successful-script.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import * as process from "process"; | ||
|
||
if (global.config === undefined || global.config.solidity === undefined) { | ||
process.exit(123123); | ||
} |
Empty file.
21 changes: 21 additions & 0 deletions
21
packages/hardhat-core/test/fixture-projects/esm-project/hardhat.config.cjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
task("example2", "example task", async (ret) => 28); | ||
|
||
task("example", "example task", async (__, { run }) => run("example2")); | ||
|
||
module.exports = { | ||
defaultNetwork: "custom", | ||
networks: { | ||
custom: { | ||
url: "http://127.0.0.1:8545", | ||
}, | ||
localhost: { | ||
accounts: [ | ||
"0xa95f9e3e7ae4e4865c5968828fe7c03fffa8a9f3bb52d36d26243f4c868ee166", | ||
], | ||
}, | ||
}, | ||
solidity: "0.5.15", | ||
unknown: { | ||
asd: 123, | ||
}, | ||
}; |
3 changes: 3 additions & 0 deletions
3
packages/hardhat-core/test/fixture-projects/esm-project/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"type": "module" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters