Command Line Build

Hi there,

Lastest Cocos Creator is supposed to have command line build. But I can’t figure out how to use it.

I tried these:

CocosCreator.exe -h
CocosCreator.exe -help
CocosCreator.exe --help
CocosCreator.exe -b MYPROJECT_PATH
CocosCreator.exe --build MYPROJECT_PATH

Everytime it just start the editor in hooked mode, if I give a project path it open it.

I could not find any documentation about CLI support.

2 Likes

I am also very interested into building from CLI for my Contininuous Delivery integration.
Any chance to have linux support for this feature ?

1 Like

+1 on this.

There is some info in GitHub source: https://github.com/cocos-creator/creator-docs/blob/master/source/zh/publish/publish-in-command-line.md

Altough I don’t understand chinese, it can be read with the help of translator. Basically it says:

CocosCreator.exe --path projectPath --build

Yes this now go farther then crash with a specify [dest] option, but I have not bean able to provide it…

Try adding dest after --build like this:
CocosCreator.exe --path projectPath --build 'platform=web-mobile;dest=buildPath'

I’m using this syntax (on Mac) but it is producing an error of:
Error: Compile error: Invalid project path: /path/to/my/project

Yes, big thanks!!!

Worked with that without your quote:

CocosCreator.exe --path PROJECT_PATH --build platform=web-desktop;dest=BUILD_PATH

I’m running this command right inside my project folder

/Applications/CocosCreator.app/Contents/MacOS/CocosCreator --path . --build "platform=web-mobile;dest=./build"

but I keep getting

Build Failed: Error: Compile error: Invalid project path:

What am I doing wrong?

I am not sure but the error will happend if you execute the build command in your cocos project directory.
So we should execute the build command in other directory like parent directory of cocos project directory.

like this:

/Applications/CocosCreator.app/Contents/MacOS/CocosCreator --path ./cocos --build "platform=web-mobile;dest=./build"

1 Like

@nshmura This is the type of thing that should really be an extra sentence in the documentation. :unamused: Or better yet, fixed.

@crauss @TheChuckster
Today, I tried Cocos 1.4, and found this issue was fixed!
Below command will successfuly completed.

/Applications/CocosCreator.app/Contents/MacOS/CocosCreator --path . --build “platform=web-mobile;dest=./build”

1 Like

Great!!! I’m really impressed how quickly these are getting fixed! Good job @slackmoehrle and team! :beers:

2 Likes