NpmInstallation

Isao Yagi edited this page Jun 13, 2013 · 11 revisions
Clone this wiki locally

Install mojito-cli globally using npm with

% npm install --global mojito-cli

This makes the mojito command available from the command line.

Details of installation are in the npm install docs. Users must have the path displayed with this command in their $PATH:

npm prefix --global

Declaring Mojito as a Dependency

Your mojito application should declare it's dependencies in it's package.json file, as described here. For Mojito apps, that means putting something like the following in your package.json:

"dependencies": {
	"mojito": "~0.5.7"
}

... where "mojito", the npm package name, is a key of the dependencies object. It's value is a version number or range.

Mojito-Cli Commands and CI

In continuous integration (CI) workflows, it might be useful to declare mojito-cli as a devDependency in your package.json:

"devDependencies": {
	"mojito-cli": "~0.0.5"
}

This way commands like jslint, test, and docs can be made available to your CI scripts along with your application and it's other dependencies.

Note, this requires mojito@0.7.0 or later. Earlier Mojito versions prevented mojito-cli from being installed locally at the same time as mojito.

However, in both cases, your CI scripts can invoke the cli commands the same way. For example:

node_modules/.bin/mojito test app .

Local installation

After declaring your application's dependencies, they can be installed by running npm install in the top level of your application directory.

Tips

  • mojito create app will create an empty Mojito application with a package.json, and do npm install in your newly created application directory.
  • to install Mojito locally and add it as a dependency in your package.json at the same time, try: npm install --save mojito
  • to install the Mojito CLI locally and add it as a devDependency in your package.json at the same time, try: npm install --save-dev mojito-cli