If I understand your question well, it seems you want to deploy your application.
Since pm2 0.9 can be deployed using pm2 deploy see README .
In the case of grunt / gulp, I see two options:
You have your node_modules . Using pm2 deploy run the gulp process from the post-deploy section:
"post-deploy" : "node ./node_modules/gulp/bin/gulp.js ./GulpFile.js && pm2 startOrRestart ecosystem.json --env production"
Using a basic script that will run npm install for you, you can use package.json for grunt / gulp:
"scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "node server.js", "postinstall": "./node_modules/bower/bin/bower -q -s -f install && ./node_modules/gulp/bin/gulp.js" },
My gulp usually requires a gazebo to minimize scripts, so I left it for an example only.
You can combine the two parameters so that pm2 deploy installs your npm scripts and have a postinstall script in package.json .
Please note that I am using the relative path to the gulp binary module! This is just to avoid the problem if the global module is not installed.
Now, in my opinion, to deploy the application in production, it is better to just have a git branch, where everything is pre-swallowed so that you only clone this branch, and you are good to go. It also improves deployment time, especially if you run tests using gulp or grunt ...
Hope this is clear enough!
soyuka
source share