Skip to content

kaelzhang/npmw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npmw

A npm wrapper for programming

Getting Started

You may install this module with this command:

npm install npmw --save

Overview

npm has no support for multi registries yet. npmw is a design wrapper for programming, including some frequent utility methods

Usage

npmw(options).<command>(arguments);
new npmw(options).<command>(arguments);

Options

options.registry

Type: string

Default: 'http://registry.npmjs.org'

NPM registry server. Useful if you use your private npm server.

Notice that, npm doesn't support connecting multiple servers simultaneously.

Methods

You can use all npm.commands method with npmw().<command>(). Besides, there're other useful methods:

.exists(name, version, callback);

callback has two arguments error, data

data

Type: Object

data.exists: boolean whether module <name>@<version> is exists

data.versions: Array.<string> available versions

data.latest: string latest version

data.data: Object original server data

Usage Examples

var npmw = require('npmw');
var npm = npmw({
    registry: 'http://registry.yourserver.local'
});

npm.exists('npmw', '~0.0.0', function(error, data){
	if(!error && data.exists){
		console.log('Module npmw@~0.0.0 exists and the latest version is "' + data.latest + '"');
	}
});

About

NPM wrapper for programming, useful for self-built npm server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published