cocos_build
Build Cocos Creator projects headlessly for platforms like web, mobile, and desktop, with options for source maps, cache busting, and post-build patching to preserve customizations.
Instructions
Headlessly build the project via CocosCreator --build.
Common platforms: web-mobile, web-desktop, wechatgame, ios, android, mac, windows
Convenience booleans for the most-tweaked release flags:
source_maps: emit .map files for stack-trace symbolication
md5_cache: append md5 hashes to asset filenames (cache busting)
skip_compress_texture: skip texture compression (faster iteration)
inline_enum: inline enum members to integer literals (smaller JS)
mangle_properties: minify property names (breaks reflection APIs)
Pass None on any boolean to let Cocos's own default apply. For flags
without an explicit param, use build_options={"flagName": value}
— explicit params still win on conflict.
After a successful build, automatically applies any patches
registered via cocos_register_post_build_patch to the output
directory — so edits to files Cocos regenerates (style.css,
project.config.json, etc.) survive every rebuild. Set
apply_patches=False to skip that step.
Returns {exit_code, success, duration_sec, log_tail, build_dir, artifacts, plus error_code/hint on failure, post_build_patches dict when patches ran}. First build is slow (~1-2 min); subsequent builds with clean_temp=False are much faster.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_path | Yes | ||
| platform | No | web-mobile | |
| debug | No | ||
| creator_version | No | ||
| clean_temp | No | ||
| source_maps | No | ||
| md5_cache | No | ||
| skip_compress_texture | No | ||
| inline_enum | No | ||
| mangle_properties | No | ||
| build_options | No | ||
| apply_patches | No |