Skip to content
Runs cocos console commands in the Atom editor.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Cocos build for Atom

Runs cocos2d-x tasks like build, deploy, run, and release in the Atom editor. And captures build and runtime errors.

This package requires atom-build and cocos-console to be installed.

How It Works

A project are consider as a cocos2d-x project if there is a .cocos-project.json at project root. And it takes project_type key in this file for the project type (cpp|lua|js).

For Run simulator without build tasks, it find simulator executable name in:

  • in config.json for lua projects
  • name in manifest.webapp for js projects.

and runs debug build executables create by cocos compile -p mac|win32 as simulator.

Do make sure the above config are correct for your project and cocos compile -p mac|win32 commands works well.


Add Build Targets for Cocos2d-x Projects

Supports run build, deploy, run, and release tasks inside Atom.

Build targets for a Lua project:


Captures Build and Runtime Errors

  • Captures build errors and Lua script runtime errors.
  • Provides error link to source code.

Cpp build errors:

Cpp Errors

Lua runtime errors:

Lua Errors

Support Additional Configure in .cocos-project.json

Additional key for .cocos-project.json:

  • androidABI: Set APP_ABI for Android build, multiple abi can be set like armeabi-v7a:x86. Default armeabi.
  • androidStudio: Set true to build Android Studio project in rather than Default false.
  • iosCodeSignIdentity: iOS code sign identity used to run iOS: Release target. eg. iPhone Distribution: xxx... (XXXXXXXXXX).
  • luaEncrypt: Set false to disable encryption of Lua scripts when run Release targets. Default true.
  • luaEncryptKey: The key used to encrypt Lua scripts when run Release targets. Default 2dxLua.
  • luaEncryptSign: File signature for encrypted Lua script files when run Release targets. Default XXTEA


  1. Install atom-build and this atom-build-cocos package apm install build build-cocos.
  2. To setup cocos path you have two options either:
  • In Atom -> Preferences... -> Packages -> build-cocos -> Settings -> Set the Global cocos console path. eg: /Users/xpol/Workspace/cocos2d-x/tools/cocos2d-console.
  • Have a project local copy of cocos-console in you project in framewroks/cocos2d-x/tools/cocos2d-console.
  1. For Lua project
  • You need master branch of my fork of cocos-console (up vote this pending pull request to make it official) to run simulator and captures the runtime Lua errors.
  • Set Lua package path to have src/?.lua; rather than add src/ to FileUtils' search path, see example main.lua.
  • Make a xpcall to your main function and call os.exit(1) in error handler. see example main.lua.
  1. After that, in Atom open you project root directory which contains .cocos-project.json, run cmd-alt-t / ctrl-alt-t / f7 to displays the available build targets.
  2. Set .cocos-project.json:
  • Set iosCodeSignIdentity if you needs build iOS release ipa.
  • For lua projects, set luaEncrypt luaEncryptKey and luaEncryptSign to enable encryption for Lua scripts.
  • Android projects, set androidStudio if you want build in project in



package.path = 'src/?.lua;src/packages/?.lua'
local fu = cc.FileUtils:getInstance()
fu:addSearchPath("res/") -- only add 'res/' for cocos search path, do not add 'src/'.

local function main()
	-- your code here...

local traceback = __G__TRACKBACK__

function __G__TRACKBACK__(msg)
  os.exit(1) -- exit on error so that the error will be parsed by atom-build.

xpcall(main, __G__TRACKBACK__)


Ideas, bugs and pull requests please go to GitHub xpol/atom-build-cocos.

You can’t perform that action at this time.