• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

robgraeber/heroku-buildpack-nodejs-bower-gulp: A modified version of Heroku' ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

robgraeber/heroku-buildpack-nodejs-bower-gulp

开源软件地址(OpenSource Url):

https://github.com/robgraeber/heroku-buildpack-nodejs-bower-gulp

开源编程语言(OpenSource Language):

Shell 100.0%

开源软件介绍(OpenSource Introduction):

Heroku Buildpack for Node.js, Bower, and Gulp

Usage

  • Create a new app using heroku create --buildpack=https://github.com/robgraeber/heroku-buildpack-nodejs-bower-gulp.git. To be safe, you should fork this and use your fork's URL.
  • Add a Gulp task that builds your app. By default, the buildpack will call gulp build.
  • To specify your own task: Run heroku config:set GULP_TASK=build (Or any other name).
  • Add a bower.json/.bowerrc file that will be used with bower install. Packages not in bower.jsonare pruned each build.
  • And additionally, the buildpack has a few extra entry points. It will look for entry points in the following order:
  • Procfile: e.g. web: node server.js.
  • npm start script.
  • server.js file.
  • app.js file.

Note: It will only use bower/gulp if bower.json or gulpfile.js is found. Otherwise it's usable the same as other Node.js buildpacks, except with extra entry points.

Things That Will Happen

When the buildpack runs it will do many things similarly to the standard Heroku buildpack. In addition it will do the following things, in roughly this order.

  • If bower.json is found
    • Extract the directory key from .bowerrc if that is present
    • Run npm install bower to install bower locally
    • Run bower install to install bower_components.
    • Cache bower_components or whichever alternate directory was specified in .bowerrc
  • If gulpfile.js is found
    • Run npm install gulp to install gulp locally during the build
    • Run gulp build to build the app
  • If Procfile is not found
    • Looks for a npm start script
    • Then for a server.js file
    • And then for an app.js file

The bower component caching is very similar to the node_modules caching done for npm. The cache is restored before each build and bower prune is run to remove anything no longer needed before doing the bower install. This is the same way the standard buildpack handles caching.

Bonus: Also installs the latest npm + 'nasm' which is a dependency for imageMin.

Some Useful Aliases

I also like to create some useful aliases that help me deploy in 1-line. (Add the following to your .bash_profile):

heroku-push() {
  git push heroku master $1 $2 $3
  heroku open
}
heroku-delete() {
  heroku apps:destroy -a $1 --confirm $1
}
heroku-auto-create() {
  heroku create $1 $2 $3 --buildpack=https://github.com/robgraeber/heroku-buildpack-nodejs-bower-gulp.git
  heroku-push
}
alias heroku-create='heroku create --stack cedar-14 --buildpack=https://github.com/robgraeber/heroku-buildpack-nodejs-bower-gulp.git'
alias heroku-portal='open https://dashboard.heroku.com/apps'
alias heroku-set='heroku config:set'
alias heroku-rebuild='heroku repo:rebuild'
alias heroku-logs='heroku logs --tail'

Example: Type "heroku-auto-create myAppNameHere" to auto deploy in 1 line.

Credits

Forked from heroku-buildpack-nodejs-gulp.

Which was forked from heroku-buildpack-nodejs.

Heavily based on heroku-buildpack-nodejs-grunt.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap