0.1.993 • Published 8 years ago
ym-modules v0.1.993
CNPM PRIVATE PACKAGE USAGE
INSTALLATION --OPTIONAL
npm install -g cnpm
use taobao registry
npm install -g cnpm --registry=https://registry.npm.taobao.org
if you don't want use cnpm to instead npm, you can use npm to replace cnpm in the following content.
SET REGISTRY
cnpm set registry=http://code.tlifang.com:7001
PUBLISH
if you want to publish your package to the private registry, you should do something first:
- sign up an account for npmjs.org first;
- note your account email and username;
- give xuezi your email and username;
- xuezi configure your email&username to the code Server;
now, login your npm account use cnpm;
cnpm login
> Username: your username
> Password: your Password
> Email: your email
Logged in as username on http://code.tlifang.com:7001/
SCOPE
The server has configure scopes for private package space. package can only publish to those scope spaces
@scope1, @scope2, @scope3, ...
configure name param in your package.json for example @scope=@ym
{
"name": "@ym/module_name",
"version": "1.0.0",
"description": "description",
"main": "index.js",
"scripts": {
"test": "-dev"
},
"keywords": [],
"author": "xuezi",
"license": "ISC",
"dependencies": {
},
"homepage": "",
"repository": {
"type": "",
"url": ""
},
"engines": {
"node": ">=4.0.0"
}
}
Name specification:
"name": "@ym/module_name"
now , you can publish your package
cd your_package_dir
cnpm publish
- WARNING
everytime before publish package, you should re configure version param in your package.json
INSTALL PRIVATE PACKAGE
cnpm install @ym/module_name [--save]
REQUIRE PRIVATE PACKAGE
var module = require('@ym/module_name');