cocos/cocos-cli
À propos
COCOS CLI
Outils de développementWhat you can do
- 🏗️ Project Management: Create, import, and build Cocos projects
- 📦 Resource Management: Import/export resources, batch processing
- ⚡ Build System: Multi-platform build support
- 🖥️ Simulator Preview: Build and launch the Cocos simulator from the CLI
Progression mesurée des étoiles
- in 24h
- 0
- in 7 days
- +4
- in 15 days
- Historique en cours
- in 1 month
- Historique en cours
Variations nettes sur des périodes qui se chevauchent, pas des totaux quotidiens. Les mesures absentes restent vides. Les étoiles indiquent l’intérêt, pas la qualité.
README.md
Original🎮 COCOS CLI

🚀 A powerful command-line interface tool for Cocos Engine development
✨ Features
- 🏗️ Project Management: Create, import, and build Cocos projects
- 📦 Resource Management: Import/export resources, batch processing
- ⚡ Build System: Multi-platform build support
- 🖥️ Simulator Preview: Build and launch the Cocos simulator from the CLI
- 🎨 Interactive Interface: Wizard-guided operations
📋 Prerequisites
- Node.js 22.17.0
- Git
- Visual Studio with C++ build tools (for Windows)
- Xcode (for macOS)
For native development, please refer to the Native Development Setup Guide for detailed setup instructions.
🛠️ Installation
Clone the repository
git clone <repository-url> cd cocos-cliInstall dependencies
npm install -g node-gyp COCOS_SKIP_POSTINSTALL_PREPARE=true npm installSelect an engine, prepare the CLI and link globally
Put a prepared Engine SDK in
packages/engine, or setenginePathin the CLI root's ignoredconfig.local.json:{ "project": "D:/Demo/cocos/NewProject", "enginePath": "D:/Cocos/code/cocos-cli/packages/engine" }Relative engine paths resolve from the CLI root, regardless of the current working directory. Omit
enginePathto usepackages/engine. Preserve your existingprojectvalue.npm run setup:cli npm linkFor engine source development, explicitly run
npm run fetch:engine(only when source is missing),npm run install:engine, thennpm run setup:devinstead ofsetup:cli. A custom engine is managed separately; skipfetch:enginefor it.
npm install / npm ci preserve the legacy automatic engine/CLI build and tool preparation. The SDK example uses COCOS_SKIP_POSTINSTALL_PREPARE=true to skip root preparation before explicitly setting up the selected engine. setup:cli builds the CLI and downloads development tools using a prepared engine; setup:dev also compiles engine source. npm run init is a compatibility alias for setup:cli. See environment setup for CI and update behavior.
🚀 Quick Start
See Quick Start Guide for detailed usage steps.
Use --engine-path "D:/engines/custom engine" to override the runtime engine. Precedence: command line > engineSdk.path in the project's settings/cocos.config.json > the CLI's local enginePath > packages/engine. Optional project engineSdk.version / revision pin the exact SDK identity. See environment setup.
📚 Commands
# Create project
cocos create --project ./my-project
# Build project
cocos build --project ./my-project --platform web-mobile
# Import project
cocos import --project ./my-project
# Show project information
cocos info --project ./my-project
# Start MCP server
cocos start-mcp-server --project ./my-project --port 9527
# Interactive wizard
cocos wizard
# Display help
cocos --help
For detailed command documentation, see Commands Documentation.
🖥️ Simulator Preview
The simulator is not part of npm run build — npm run release builds it automatically, or you can build it directly:
# Build the native simulator executable + runtime artifacts
npm run build:simulator
# Build only the native executable
npm run build:simulator:native
# Build only the runtime artifacts
npm run build:simulator:runtime
The public API lives in src/lib/simulator/simulator.ts (generated types in packages/cocos-cli-types/simulator.d.ts). See docs/en/simulator.md for an overview.
🧪 Testing
Unit Tests
# Run all unit tests (core)
npm test
# Run asset-db workspace tests
npm run test:asset-db
# Run tests in watch mode
npm run test:watch
# Run tests with coverage report
npm run test:coverage
E2E Tests
# Run E2E tests
npm run test:e2e
# Run E2E tests in debug mode (preserves test projects)
npm run test:e2e:debug
# Check E2E test coverage
npm run check:e2e-coverage
# Generate E2E coverage HTML report
npm run check:e2e-coverage:report
Run All Tests
# Run all tests (unit + E2E)
npm run test:all
For more testing details, see:
📖 Documentation
🤝 Contributing
We welcome contributions! Please see our Contributing Guide to get started.
The guide covers:
- Development workflow and building the project
- Running and writing tests
- Code style and formatting
- Debugging techniques
- Submitting pull requests
📄 License
MIT License - see the LICENSE file for details.
Explorer des projets similaires
Chargement…