From dd5d7b2dfa9071208eb4729c72f88689002bbb35 Mon Sep 17 00:00:00 2001 From: maxnorm Date: Wed, 1 Apr 2026 20:40:36 -0400 Subject: [PATCH 1/4] docs package installation --- .../docs/contribution/how-to-contribute.mdx | 2 +- website/docs/getting-started/installation.md | 111 ++++++------------ website/sidebars.js | 20 ++-- 3 files changed, 45 insertions(+), 88 deletions(-) diff --git a/website/docs/contribution/how-to-contribute.mdx b/website/docs/contribution/how-to-contribute.mdx index 87c6ec7c..1f1c576a 100644 --- a/website/docs/contribution/how-to-contribute.mdx +++ b/website/docs/contribution/how-to-contribute.mdx @@ -1,5 +1,5 @@ --- -sidebar_position: 2 +sidebar_position: 1 title: How to Contribute description: Learn how to contribute to Compose --- diff --git a/website/docs/getting-started/installation.md b/website/docs/getting-started/installation.md index b16802e2..c725b87f 100644 --- a/website/docs/getting-started/installation.md +++ b/website/docs/getting-started/installation.md @@ -2,110 +2,67 @@ sidebar_position: 1 --- -# Installation - -Get up and running with Compose in just a few minutes. +import DocSubtitle from '@site/src/components/docs/DocSubtitle'; -## Prerequisites +# Installation -Before you begin, make sure you have the following installed: +Get up and running with Compose in just a few minutes. -- **[Foundry](https://book.getfoundry.sh/getting-started/installation)** - Fast, portable Ethereum development framework -- **Git** - For cloning repositories -- **Node.js 20+** - (Optional) For running tests and scripts +## Packages -## Quick Start +Compose is published as two npm packages: -### Option 1: Clone the Repository (Contributors) +- **[`@perfect-abstractions/compose`](https://www.npmjs.com/package/@perfect-abstractions/compose)**: Solidity library +- **[`@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 -If you're contributing to Compose: +## Prerequisites -```bash -# Clone the repository -git clone https://github.com/Perfect-Abstractions/Compose.git -cd Compose +- **Node.js >= 20**: required for the CLI and for npm-based Hardhat workflows +- **[Foundry](https://book.getfoundry.sh/getting-started/installation) (Optional)**: required if you use a Foundry scaffold or integrate Solidity with Forge +- **Git**: used by Foundry dependency installs inside generated projects -# Install dependencies -forge install +## Create a new project with Compose CLI -# Build the project -forge build +The fastest path is to run the CLI with `npx` (no global install): -# Run tests -forge test +```bash +npx @perfect-abstractions/compose-cli init ``` -### Option 2: Install as Dependency (Coming Soon) +### Manual Installation -In the future, you'll be able to install Compose as a Foundry dependency: +To install the CLI globally: ```bash -# This will be available when Compose reaches stable release -forge install Perfect-Abstractions/Compose +npm install -g @perfect-abstractions/compose-cli +compose init ``` -## Project Structure +## Add Compose to an existing project (Manual Installation) -After installation, you'll find the following structure: +### Foundry -``` -Compose/ -├── src/ # Source contracts -│ ├── facets/ # Facet implementations -│ ├── libraries/ # Library helpers -│ └── interfaces/ # Standard interfaces -├── test/ # Test files -├── script/ # Deployment scripts -├── lib/ # Dependencies -└── foundry.toml # Foundry configuration +```bash +forge install Perfect-Abstractions/Compose@tag=compose@0.0.2 ``` -## Configuration - -### Foundry Setup - -Compose includes a pre-configured `foundry.toml`. If you're integrating Compose into an existing project, add these settings: - -```toml -[profile.default] -src = "src" -out = "out" -libs = ["lib"] -optimizer = true -optimizer_runs = 20_000 -evm_version = "prague" - -[profile.ci] -src = "src" -out = "out" -libs = ["lib"] -optimizer = true -optimizer_runs = 20_000 -evm_version = "prague" -# Coverage settings -fuzz = { runs = 1000 } -invariant = { runs = 1000 } - -[fmt] -line_length = 120 -tab_width = 4 -bracket_spacing = false -int_types = 'long' -multiline_func_header = 'attributes_first' -quote_style = 'double' -number_underscore = 'preserve' -single_line_statement_blocks = 'preserve' +Create a `remappings.txt` file in the root of your project with the following content: +```txt +@perfect-abstractions/compose/=lib/Compose/src/ ``` -## Verify Installation -Run the tests to verify everything is working: +### Hardhat / NPM ```bash -forge test -vvv +npm install @perfect-abstractions/compose ``` -You should see output indicating all tests pass. +## Import Compose in your project + +```solidity +import {DiamondMod} from "@perfect-abstractions/compose/diamond/DiamondMod.sol"; +```