The package manager for JetCrab - npm/yarn equivalent for the JetCrab ecosystem
CPM (Crab Package Manager) is the package manager for JetCrab projects. Like npm and yarn for Node.js, CPM manages dependencies, scripts, and project lifecycle for JavaScript and Rust projects in the JetCrab stack.
CPM aims for parity with npm/yarn for the JetCrab ecosystem:
| npm/yarn | CPM |
|---|---|
| npm init | cpm init |
| npm install | cpm install |
| npm install pkg | cpm add pkg |
| npm run script | cpm run script |
| yarn add / remove | cpm add / remove |
Plus: native Rust/WASM support via Cargo integration.
# Install CPM
cargo install cpm
# Or build from source
git clone https://github.com/JetCrabCollab/cpm.git
cd cpm
cargo build --release# Build Docker image
docker build -t cpm:latest .
# Run CPM commands
docker run --rm cpm:latest --help
docker run --rm -v $(pwd):/workspace -w /workspace cpm:latest init my-project -yDownload from Releases (coming soon)
CPM requires the following tools to be installed:
- Rust & Cargo: Install Rust
- Node.js & npm: Install Node.js
- JetCrab Runtime:
cargo install jetcrab(optional, for development)
# Initialize a JavaScript project
cpm init my-project -y
# Add Rust to existing JS project
cpm add-rust
# Check Rust status
cpm rust-status
# Remove Rust from project
cpm remove-rustInitialize a new JavaScript project with npm.
cpm init my-app -yAdd a package (delegates to npm install). Use -D for devDependencies.
cpm add lodash
cpm add -D eslintRemove a package (delegates to npm uninstall).
cpm remove lodashInstall dependencies for the current project (npm + cargo).
cpm installUpdate lockfiles (package-lock.json, Cargo.lock).
cpm lockList workspace packages.
cpm workspaceBuild the project (cargo + wasm-pack if available).
cpm buildStart development server (JetCrab first, then Node.js). Use --watch for hot reload with nodemon.
cpm dev
cpm dev --watchRun tests for the current project (npm + cargo).
cpm testExecute packages using npx.
cpm npx create-react-app my-app
cpm npx eslint --initAdd Rust to an existing JavaScript project.
cpm add-rust -yRemove Rust from a project.
cpm remove-rust -yCheck Rust status in the current project.
cpm rust-statusPublish package to npm registry (delegates to npm publish).
cpm publishmy-project/
βββ package.json
βββ index.js
βββ README.md
my-project/
βββ package.json
βββ Cargo.toml
βββ src/
β βββ lib.rs
βββ pkg/ # Generated WASM
βββ index.js
βββ README.md
CPM is designed to be simple and lightweight:
- JavaScript Projects: Uses
npmfor package management - Rust Integration: Uses
cargofor Rust dependencies - WASM Compilation: Uses
wasm-packfor WebAssembly - Development: Uses
jetcrabornodefor running projects - Package Execution: Uses
npxfor running packages - Intelligent Detection: Automatically detects project type and uses appropriate tools
- Cross-Platform: Works on Windows, macOS, and Linux
cpm init my-js-app -y
cd my-js-app
cpm add lodash # Add dependencies
cpm install # Install all dependencies
cpm dev # Runs with jetcrab or node
cpm test # Run tests
cpm build # Build projectcpm add-rust -y
cpm install # Install both JS and Rust dependencies
cpm build # Compiles Rust to WASM
cpm dev # Runs hybrid project
cpm test # Run both JS and Rust testscpm npx create-react-app my-react-app
cpm npx eslint --init
cpm npx jest --initcpm rust-status
# Output:
# π Project Structure:
# package.json: β
# Cargo.toml: β
# src/ directory: β
# src/lib.rs: β
# pkg/ directory: β
#
# π¦ Rust is fully integrated!- β You want a simple package manager
- β You work with JavaScript projects
- β You need Rust performance occasionally
- β You want to avoid complex tooling
- β You need advanced package management features
- β You work exclusively with Rust
- β You need custom registries or caching
# Your existing npm project works with CPM
cpm init . -y # Adds CPM scripts to package.json# Cargo projects can be integrated with CPM
cpm add-rust -y # Adds JavaScript supportWe welcome contributions! Please see our Contributing Guide for details.
git clone https://github.com/JetCrabCollab/cpm.git
cd cpm
cargo build
cargo testThis project is licensed under the MIT License - see the LICENSE file for details.
- npm - JavaScript package manager
- Cargo - Rust package manager
- wasm-pack - WebAssembly packaging
- JetCrab - JavaScript runtime
- Documentation: docs.jetcrab.dev/cpm
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Part of the JetCrab ecosystem - jetcrab.dev