Skip to content

Commit ee4ee19

Browse files
authored
Merge pull request #327 from maxnorm/docs/install-compose
Docs/install compose
2 parents a435056 + e9322ef commit ee4ee19

6 files changed

Lines changed: 74 additions & 109 deletions

File tree

.changeset/breezy-rings-glow.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@perfect-abstractions/compose-cli": patch
3+
"@perfect-abstractions/compose": patch
4+
"compose-documentation": patch
5+
---
6+
7+
add installation commands to docs & readme

README.md

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,30 @@ We build high-quality smart contracts by <a href="https://compose.diamonds/docs/
3131

3232
## Quick Start
3333

34+
## Create a new project with Compose CLI
35+
3436
```bash
35-
# Clone the repository
36-
git clone https://github.com/Perfect-Abstractions/Compose.git
37-
cd Compose
37+
npx @perfect-abstractions/compose-cli init
38+
```
39+
40+
## Add Compose to an existing project (Manual Installation)
3841

39-
# Install dependencies
40-
forge install
42+
### Foundry
4143

42-
# Build the project
43-
forge build
44+
```bash
45+
forge install Perfect-Abstractions/Compose@tag=compose@0.0.3
46+
```
4447

45-
# Run tests
46-
forge test
48+
### Hardhat / NPM
4749

48-
# For test documentation, see test/README.md
50+
```bash
51+
npm install @perfect-abstractions/compose
4952
```
53+
54+
Packages: [`@perfect-abstractions/compose`](https://www.npmjs.com/package/@perfect-abstractions/compose) · [`@perfect-abstractions/compose-cli`](https://www.npmjs.com/package/@perfect-abstractions/compose-cli). More detail: [Installation](https://compose.diamonds/docs/getting-started/installation).
55+
56+
57+
5058
## Documentation
5159

5260
Please see our [documentation website](https://compose.diamonds/docs/) for full documentation.

cli/README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
# Compose CLI
22

3-
`@perfect-abstractions/compose-cli` scaffolds diamond-based projects using the Compose Library.
4-
Supports both Foundry and Hardhat.
3+
Creates new diamond-based projects using the Compose Library.
4+
Supports both [Foundry](https://book.getfoundry.sh/) and [Hardhat](https://hardhat.org/) frameworks.
55

6-
## Install (Soon)
6+
## Create a new project with Compose CLI
77

88
```bash
9-
npm install -g @perfect-abstractions/compose-cli
9+
npx @perfect-abstractions/compose-cli init
1010
```
1111

12-
Requires Node.js >= 20.
13-
1412
## Usage
1513

1614
```bash
@@ -58,11 +56,6 @@ compose init --name my-hardhat-mocha-ethers \
5856

5957
`compose templates` prints this information in a friendly format.
6058

61-
## Notes on `@perfect-abstractions/compose`
62-
63-
Hardhat scaffolds inject `@perfect-abstractions/compose` as the dependency name. The current package isn't published yet.
64-
65-
6659
## Development
6760

6861
From the `cli` directory:

website/docs/contribution/how-to-contribute.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 2
2+
sidebar_position: 1
33
title: How to Contribute
44
description: Learn how to contribute to Compose
55
---

website/docs/getting-started/installation.md

Lines changed: 34 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -2,110 +2,67 @@
22
sidebar_position: 1
33
---
44

5-
# Installation
6-
7-
Get up and running with Compose in just a few minutes.
5+
import DocSubtitle from '@site/src/components/docs/DocSubtitle';
86

9-
## Prerequisites
7+
# Installation
108

11-
Before you begin, make sure you have the following installed:
9+
<DocSubtitle>Get up and running with Compose in just a few minutes.</DocSubtitle>
1210

13-
- **[Foundry](https://book.getfoundry.sh/getting-started/installation)** - Fast, portable Ethereum development framework
14-
- **Git** - For cloning repositories
15-
- **Node.js 20+** - (Optional) For running tests and scripts
11+
## Packages
1612

17-
## Quick Start
13+
Compose is published as two npm packages:
1814

19-
### Option 1: Clone the Repository (Contributors)
15+
- **[`@perfect-abstractions/compose`](https://www.npmjs.com/package/@perfect-abstractions/compose)**: Solidity library
16+
- **[`@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
2017

21-
If you're contributing to Compose:
18+
## Prerequisites
2219

23-
```bash
24-
# Clone the repository
25-
git clone https://github.com/Perfect-Abstractions/Compose.git
26-
cd Compose
20+
- **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
2723

28-
# Install dependencies
29-
forge install
24+
## Create a new project with Compose CLI
3025

31-
# Build the project
32-
forge build
26+
The fastest path is to run the CLI with `npx` (no global install):
3327

34-
# Run tests
35-
forge test
28+
```bash
29+
npx @perfect-abstractions/compose-cli init
3630
```
3731

38-
### Option 2: Install as Dependency (Coming Soon)
32+
### Manual Installation
3933

40-
In the future, you'll be able to install Compose as a Foundry dependency:
34+
To install the CLI globally:
4135

4236
```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
4539
```
4640

47-
## Project Structure
41+
## Add Compose to an existing project (Manual Installation)
4842

49-
After installation, you'll find the following structure:
43+
### Foundry
5044

51-
```
52-
Compose/
53-
├── src/ # Source contracts
54-
│ ├── facets/ # Facet implementations
55-
│ ├── libraries/ # Library helpers
56-
│ └── interfaces/ # Standard interfaces
57-
├── test/ # Test files
58-
├── script/ # Deployment scripts
59-
├── lib/ # Dependencies
60-
└── foundry.toml # Foundry configuration
45+
```bash
46+
forge install Perfect-Abstractions/Compose@tag=compose@0.0.3
6147
```
6248

63-
## Configuration
64-
65-
### Foundry Setup
66-
67-
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/
9852
```
9953

100-
## Verify Installation
10154

102-
Run the tests to verify everything is working:
55+
### Hardhat / NPM
10356

10457
```bash
105-
forge test -vvv
58+
npm install @perfect-abstractions/compose
10659
```
10760

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+
```
10966

11067
<!-- ## What's Next?
11168
@@ -124,6 +81,6 @@ Having trouble with installation?
12481
- Open an **[issue on GitHub](https://github.com/Perfect-Abstractions/Compose/issues)**
12582

12683
:::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.
12885
:::
12986

website/sidebars.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@ const sidebars = {
1919
'intro',
2020
{
2121
type: 'category',
22-
label: 'Foundations',
23-
collapsed: false,
24-
link: {
25-
type: 'doc',
26-
id: 'foundations/index',
27-
},
22+
label: 'Getting Started',
23+
collapsed: true,
2824
items: [
2925
{
3026
type: 'autogenerated',
31-
dirName: 'foundations',
27+
dirName: 'getting-started',
3228
},
3329
],
3430
},
3531
{
3632
type: 'category',
37-
label: 'Getting Started',
38-
collapsed: true,
33+
label: 'Foundations',
34+
collapsed: false,
35+
link: {
36+
type: 'doc',
37+
id: 'foundations/index',
38+
},
3939
items: [
4040
{
4141
type: 'autogenerated',
42-
dirName: 'getting-started',
42+
dirName: 'foundations',
4343
},
4444
],
4545
},

0 commit comments

Comments
 (0)