@efebia/hardhat-compile-monorepo 0.0.2 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +57 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,57 @@
1
+ # @efebia/hardhat-compile-monorepo
2
+
3
+ Hardhat plugin that compiles Solidity contracts from multiple monorepo packages in a single `hardhat compile` run.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @efebia/hardhat-compile-monorepo
9
+ ```
10
+
11
+ ## Usage
12
+
13
+ Import the plugin in your Hardhat config:
14
+
15
+ ```ts
16
+ // hardhat.config.ts
17
+ import '@efebia/hardhat-compile-monorepo';
18
+ import { HardhatUserConfig } from 'hardhat/config';
19
+
20
+ const config: HardhatUserConfig = {
21
+ solidity: '0.8.17',
22
+ compileMonorepo: {
23
+ // Packages whose Solidity files should be included in compilation.
24
+ // Each entry must be resolvable via require() from the Hardhat project root.
25
+ paths: ['@my-org/contracts-core', '@my-org/contracts-utils'],
26
+ },
27
+ };
28
+
29
+ export default config;
30
+ ```
31
+
32
+ Running `npx hardhat compile` will:
33
+ 1. Resolve each package in `paths` and copy stub `.sol` import files into a temporary directory inside `sources`
34
+ 2. Run the standard Hardhat compile task
35
+ 3. Clean up the temporary directory (unless `keep: true`)
36
+
37
+ ## Configuration
38
+
39
+ All options go under the `compileMonorepo` key in `hardhat.config`:
40
+
41
+ | Option | Type | Default | Description |
42
+ |--------|------|---------|-------------|
43
+ | `paths` | `string[]` | `[]` | Packages or `.sol` file paths to include. Must be `require()`-resolvable. |
44
+ | `path` | `string` | `'@efebia/hardhat-compile-monorepo'` | Subdirectory inside `sources` used as the temporary output directory. |
45
+ | `keep` | `boolean` | `false` | Keep the temporary directory after compilation (useful for debugging). |
46
+
47
+ ## How it works
48
+
49
+ For each entry in `paths`:
50
+ - If the entry has no file extension, it is treated as an npm package. The plugin resolves the package, reads its `files` field from `package.json`, and includes all matching `.sol` files.
51
+ - If the entry has a `.sol` extension, it is treated as a direct file import.
52
+
53
+ Stub `.sol` files are generated with a single `import` statement pointing to the original source, then fed to the Hardhat compiler. The temporary directory is tracked with a hidden marker file so the plugin never accidentally deletes user-owned directories.
54
+
55
+ ## License
56
+
57
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@efebia/hardhat-compile-monorepo",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "license": "MIT",
5
5
  "dependencies": {
6
6
  "glob": "^8.0.3",