β οΈ Notice: we are working on making a better bundler on top of Turbopack, see #1872.If you encountered some critical problems when using current Mako, you can report issues at Mako 0.x Feedback in discussions.
Utoo is a modern frontend toolchain that provides a unified command-line interface for frontend development. It comes with built-in package management capabilities and can be extended with additional tools like the bundler.
utoo: Built-in package manager for dependency resolution and installation@utoo/pack: High-performance bundler (requires separate installation)
Install the core tools (ut and utoo) globally:
npm install -g utooInstall the bundler globally if you need build capabilities:
npm install -g @utoo/packYou can track features progress at @utoo/pack features list
- π Fast package management
- π§ Flexible configuration system
- π¦ Smart dependency resolution
- π οΈ Powerful build toolchain
Utoo provides a powerful command mounting system through the ut command. This system allows you to:
- Mount Custom Commands: Map any command to a custom alias
- Configure Global/Local Commands: Set commands at global or project level
- Use Wildcard Commands: Define default behavior for unknown commands
Commands can be configured using the ut config command:
# Set a global command
ut config set install.cmd "utoo install" --global
# Set a local command (project-specific)
ut config set build.cmd "utoo-pack build"
# Set a wildcard command (default behavior)
ut config set *.cmd "utoo" --globalWhen you run a command through ut, it follows this resolution order:
- Check for a specific command configuration
- If not found, check for a wildcard command
- If no wildcard is configured, default to
utoo
For example:
# These commands are equivalent if configured as shown above
ut install
utoo install
# Custom command mapping
ut build
# Executes: utoo-pack build
# Unknown command with wildcard
ut unknown-command
# Executes: utoo unknown-commandCommand configurations are stored in:
- Global config:
~/.utoo/config.toml - Local config:
.utoo.toml(project root)
Example configuration:
[values]
"install.cmd" = "utoo install"
"build.cmd" = "utoo-pack build"
"*.cmd" = "utoo"# Show help and available commands
ut --help
# List all configured commands
ut config list
# Get specific command configuration
ut config get install.cmd
# Set command configuration
ut config set install.cmd "utoo install" --globalUtoo provides a powerful command mounting system that allows you to extend the toolchain with custom commands. This is particularly useful for project-specific scripts and workflows.
Any script defined in your package.json can be executed directly through ut:
{
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"test": "jest"
}
}You can run these scripts using:
# Using the run command
ut run dev
# or shorthand
ut r dev
# Direct command execution
ut dev
ut build
ut testYou can create custom commands by adding them to your project's configuration. These commands can be:
- Shell Scripts: Simple shell commands or scripts
- Node.js Scripts: JavaScript/TypeScript files
- Binary Executables: Any executable in your project
When executing commands, Utoo provides:
- Access to all project dependencies
- Environment variables from your project
- Proper working directory context
- Node.js binary path resolution
Utoo supports various command hooks that can be used to extend command behavior:
preinstall: Run before package installationinstall: Run during package installationpostinstall: Run after package installationprepare: Run before package preparationpreprepare: Run before package preparationpostprepare: Run after package preparation
# Install project dependencies
ut install
# or shorthand
ut i
# Install specific package
ut install <package-name>
# Example: install lodash
ut install lodash
# Install as dev dependency
ut install <package-name> --save-dev
# Install as peer dependency
ut install <package-name> --save-peer
# Install as optional dependency
ut install <package-name> --save-optional
# Global installation
ut install <package-name> -g# Uninstall specific package
ut uninstall <package-name>
# or shorthand
ut un <package-name># Update all dependencies
ut update
# or shorthand
ut u# Rebuild all dependencies
ut rebuild
# or shorthand
ut rb# Clean all cache
ut clean
# Clean specific package cache
ut clean <package-pattern>
# Example: clean all react related packages
ut clean "react*"# Analyze project dependencies
ut deps
# or shorthand
ut d
# Only analyze workspace dependencies
ut deps --workspace-onlyAll commands support the following common options:
--verbose: Show detailed output--registry <url>: Set npm registry URL--legacy-peer-deps: Use legacy peer dependency handling--ignore-scripts: Skip running dependency scripts
# Build project
cargo build --release
# Add binary to PATH
export PATH=$PATH:$(pwd)/target/release# Install project dependencies
utUtoo includes a high-performance bundler that supports various build scenarios:
Install @utoo/pack-cli:
ut install @utoo/pack-cli --save-devThen you can bundle your application or library with utoopack:
{
"scripts": {
"build": "utoo-pack build",
"dev": "utoo-pack dev",
"analyze": "ANALYZE=true utoo-pack build"
}
}You can track features supported of bundler at packages/pack/docs/features-list.md
Currently, utoopack's devServer does not support generating an HTML file for previews. You'll need to create one manually to view the output assets. We plan to add support for this in the future.
Or you can use utoopack with a framework like umi. Note that your umi version must be v4.5.0 or higher (v4.6.0 or newer is recommended).
It's easier to enable:
// .umirc.ts
import { defineConfig } from '@umijs/max';
export default defineConfig({
utoopack: {}
})We provide several example projects to demonstrate different usage scenarios:
examples/with-antd: Ant Design component library integrationexamples/with-sass: Sass style processingexamples/with-less: Less style processingexamples/with-style-loader: Style loader usageexamples/with-library: Library mode buildmore to come ...
# Build local development environment
git submodule update --init
cd packages/pack
ut build:local
# Build by native
cargo run --bin pack-cli -- --mode build --project-dir examples/with-antd --root-dir .
cargo run --bin pack-cli -- --mode dev --watch true --project-dir examples/with-antd --root-dir .
# Build the napi package
cd packages/pack
npm run build:local
cd ../../examples/with-antd
npm run build
npm run dev.
βββ crates/ # Rust core libraries
β βββ cli/ # Command line tools
β βββ core/ # Core functionality
β βββ pack-* # Bundler related modules
β βββ utoo-web # Unified ut package manager and @utoo/pack into browser WebAssembly
βββ packages/ # Package management code
βββ examples/ # Example projects
βββ vendor/ # Third-party dependencies