Support for package.json in Azure Mobile Services

If you have Source Control preview feature enabled then you can install custom npm modules in the service folder of your repository and use them in your scripts today. While this works, it is a bit inconvenient to actually commit your packages in repository since they are not maintained by you.

One of the features requested on our feedback site was support for automatic installation of packages specified in package.json. We're glad to announce that we've made that possible. Starting with version 0.1.6.2830 of Azure Mobile Service, you'll get a default package.json file in your repository that you can add your packages to and we'll install them automatically for you next time you commit changes to your repository. The default package.json that we generate looks like as follows

 

 {
 "name": "yourappname",
 "version": "1.0.0",
 "description": "yourappname - hosted on Windows Azure Mobile Services",
 "main": "server.js",
 "engines": {
 "node": ">= 0.8.19"
 },
 "dependencies": {},
 "devDependencies": {},
 "scripts": {},
 "author": "unknown",
 "licenses": [],
 "keywords": []
 }
 

You can specify packages in dependencies section of this file. You can also have npm edit this file for you by using the save swtich on install i.e. 

 npm install packagename --save

Be sure to also ignore the node_modules folder in your git repository since you don't want to checkin the modules any more. You can get more details about the structure of package.json file on following resources:

* package.json

* Package.json: an interactive guide

Comments

  • Anonymous
    January 20, 2014
    Awesome guys! Thanks for that!