Better NPM Support in Windows Azure Mobile Services with package.json

A while ago, I blogged about Git Source Control Integration in Windows Azure Mobile Services which lets the developers use Git for working with Mobile Services scripts. The source control integration lets you easily work as a team for working on Mobile Services scripts. This options lets Node.js developers more flexibility and control on the Windows Azure Mobile Services scripts, as you can install npm modules for your Windows Azure Mobile Services. But, this source control integration, had lack of support for package.json so that we had been inconvenient, while working with version controls. In fact, Node.js developers ignore node_modules from source controls and will be installed npm modules using npm install command which will identify dependencies from package.json and will automatically install npm modules.

Windows Azure Mobile Services now provides better support for npm with the help of for package.json file in Windows Azure Mobile Services scripts. You will get a  package.json file while you clone a repository for Windows Azure Mobile Services scripts, where you can add dependencies for your npm modules you have installed in the services folder of Mobile Services scripts. While you commit (git push) your changes back to Windows Azure mobile Services production environment, it will automatically install the npm modules specified in the package.json file.

The information below shows the default package.json generated by Windows Azure Mobile Services for my sample Mobile Services project.

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

In the package.json below shows that we have added a npm module Socket.io in the dependencies section:

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

The new support for package.json in Windows Azure Mobile Services lets the Mobile Services developers more flexibility and control for working with Windows Azure Mobile Service.

 

You can follow me on Twitter @shijucv

Published Tuesday, January 21, 2014 5:46 AM by shiju

Comments

No Comments

Leave a Comment

(required) 
(required) 
(optional)
(required)