You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-**[`@perfect-abstractions/compose-cli`](https://www.npmjs.com/package/@perfect-abstractions/compose-cli)**: CLI to create Foundry or Hardhat diamond starter projects that use the library
-**Node.js >= 20**: required for the CLI and for npm-based Hardhat workflows
21
+
-**[Foundry](https://book.getfoundry.sh/getting-started/installation) (Optional)**: required if you use a Foundry scaffold or integrate Solidity with Forge
22
+
-**Git**: used by Foundry dependency installs inside generated projects
27
23
28
-
# Install dependencies
29
-
forge install
24
+
## Create a new project with Compose CLI
30
25
31
-
# Build the project
32
-
forge build
26
+
The fastest path is to run the CLI with `npx` (no global install):
33
27
34
-
# Run tests
35
-
forge test
28
+
```bash
29
+
npx @perfect-abstractions/compose-cli init
36
30
```
37
31
38
-
### Option 2: Install as Dependency (Coming Soon)
32
+
### Manual Installation
39
33
40
-
In the future, you'll be able to install Compose as a Foundry dependency:
34
+
To install the CLI globally:
41
35
42
36
```bash
43
-
# This will be available when Compose reaches stable release
44
-
forge install Perfect-Abstractions/Compose
37
+
npm install -g @perfect-abstractions/compose-cli
38
+
compose init
45
39
```
46
40
47
-
## Project Structure
41
+
## Add Compose to an existing project (Manual Installation)
48
42
49
-
After installation, you'll find the following structure:
Compose includes a pre-configured `foundry.toml`. If you're integrating Compose into an existing project, add these settings:
68
-
69
-
```toml
70
-
[profile.default]
71
-
src = "src"
72
-
out = "out"
73
-
libs = ["lib"]
74
-
optimizer = true
75
-
optimizer_runs = 20_000
76
-
evm_version = "prague"
77
-
78
-
[profile.ci]
79
-
src = "src"
80
-
out = "out"
81
-
libs = ["lib"]
82
-
optimizer = true
83
-
optimizer_runs = 20_000
84
-
evm_version = "prague"
85
-
# Coverage settings
86
-
fuzz = { runs = 1000 }
87
-
invariant = { runs = 1000 }
88
-
89
-
[fmt]
90
-
line_length = 120
91
-
tab_width = 4
92
-
bracket_spacing = false
93
-
int_types = 'long'
94
-
multiline_func_header = 'attributes_first'
95
-
quote_style = 'double'
96
-
number_underscore = 'preserve'
97
-
single_line_statement_blocks = 'preserve'
49
+
Create a `remappings.txt` file in the root of your project with the following content:
50
+
```txt
51
+
@perfect-abstractions/compose/=lib/Compose/src/
98
52
```
99
53
100
-
## Verify Installation
101
54
102
-
Run the tests to verify everything is working:
55
+
### Hardhat / NPM
103
56
104
57
```bash
105
-
forge test -vvv
58
+
npm install @perfect-abstractions/compose
106
59
```
107
60
108
-
You should see output indicating all tests pass.
61
+
## Import Compose in your project
62
+
63
+
```solidity
64
+
import {DiamondMod} from "@perfect-abstractions/compose/diamond/DiamondMod.sol";
65
+
```
109
66
110
67
<!-- ## What's Next?
111
68
@@ -124,6 +81,6 @@ Having trouble with installation?
124
81
- Open an **[issue on GitHub](https://github.com/Perfect-Abstractions/Compose/issues)**
125
82
126
83
:::tip Development Environment
127
-
We recommend using VSCode with the **Solidity** extension by Juan Blanco for the best development experience.
84
+
We recommend using VSCode with the [**Solidity** extension](https://github.com/juanfranblanco/vscode-solidity) by Juan Blanco for the best development experience.
0 commit comments