cocos2d / cocos2d-html5

Cocos2d for Web Browsers. Built using JavaScript.
https://www.cocos.com
3.06k stars 903 forks source link

add support for npm installation of v3.x #2127

Open slawo opened 10 years ago

VisualSJ commented 10 years ago

Hi @slawo

NPM installation is very convenient. But cocos is not nodeJS module.

A little inappropriate...... Do you have any idea?

VisualSJ

slawo commented 10 years ago

Actually I think creating an NPM module for cocos2d-console would be a great idea.

It would help with simplifying the workflow, updates of cocos2dx and other tasks:

npm install -g cocos2d #installs cocos2d(x, console, html5 & node)
#setup of paths for compile tools 
cocos new projectName -l js --no-native #creates a new js project with the newly installed/updated cocos2d-console

Later adding support for node.js would greatly improve the usability of cocos2dx for html5 multiplayer games:

npm install -g cocos2d
cocos new projectName -l node --no-native
cd projectname/runtime/node
npm start #starts the html server and gives access to the project on localhost:3000

If designed right a cocos2d npm package could allow the creation of powerful multiplayer games. It could allow:

This type of module could later evolve to run some code natively if cocos2d-jsb could run with V8. This type of setup would mostly benefit projects which heavilly rely on C++ modules like physics, rendering (for server side generated textures/images/movies)...

slawo commented 10 years ago

The final goal would be the creation of a module which would allow :

What do you think of this?

smshuja commented 8 years ago

I think we can learn from ReactNative how npm is used. While you can use npm to install modules in react-native, they have rnpm too (react native package manager) which helps to link modules against the binary etc.

https://github.com/rnpm/rnpm

Also using webpack with babel would be a good idea.