Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package.json for different environments?

I have a node.js app which I've just deployed to Heroku which depends upon the canvas module. However, that module requires the cairo graphics library and long story short, I need to use a precomipiled version which is included with this fork of canvas.

Normally, my package.json dependencies look like:

  "dependencies" : {
    "canvas"   :  "0.10.0",
    "express" :  "2.5.6",
    "jade" : "0.20.1"
  }

But in order to get my app to work on Heroku, I must pull in the fork from github

  "dependencies" : {
    "canvas"   :  "git://github.com/elspoono/node-canvas-heroku.git#master",
    "express" :  "2.5.6",
    "jade" : "0.20.1"
  }

Is it possible to have a "Heroku-only" version of package.json? Or is there another section in package.json where I can "override" the canvas dependency in dev environments?

like image 622
Jesse Fulton Avatar asked Mar 07 '12 07:03

Jesse Fulton


2 Answers

Never used Heroku but package.json format defines the devDependencies field, see Nodejitsu cheatsheet. Then install with $ npm install -d.

like image 132
kevin Avatar answered Sep 20 '22 05:09

kevin


There's a tool called penv that looks promising. From their site:

Sometimes we need a different package.json properties for our different environments like production, staging and development. (Ex: jitsu deploys)

With penv you can customize your package.json file with properties defined inside an environments.json file.

Actually going to try it out now.

like image 44
Roy Truelove Avatar answered Sep 22 '22 05:09

Roy Truelove