Private npm registry and web for Enterprise https://cnpmjs.org
What can you do with
What is this?
Private npm registry and web for Enterprise, base on koa, MySQL and Simple Store Service.
Our goal is to provide a low cost maintenance and easy to use solution for private npm.
cnpmjs.org
What can you do with - Build a private npm for your own enterprise. (alibaba is using
cnpmjs.org
now) - Build a mirror NPM. (we use it to build a mirror in China: cnpmjs.org)
- Build a completely independent NPM registry to store whatever you like.
Features
- Support "scoped" packages: npm/npm#5239
- Support CORS
- Simple to deploy: only need
mysql
and a simple store system. You can get the source code throughnpm
orgit
. - Low cost and easy maintenance:
package.json
info store in MySQL, MariaDB, SQLite or PostgreSQL databases, tarball(tgz file) store in CDN or other store systems. - Automatic synchronization: automatic synchronization from any registry specified, support two sync modes:
- Sync all modules from a specified registry, like npm registry.
- Only sync the modules that exists in your own registry.
- Manual synchronization: automatic synchronization may has little delay, but you can syn immediately by manually.
- Customized client: we provide a client cnpm to extend
npm
with more features(sync
command, gzip support). And it easy to wrap for your own registry which build withcnpmjs.org
. - Compatible with NPM client: you can use the origin NPM client with
cnpmjs.org
, only need to change the registry in config. Even include manual synchronization (throughinstall
command). - Version badge: base on shields.io
- Support http_proxy: if you're behind firewall, need to request through http proxy
Getting Start
- Deploy a private npm registry in 5 minutes
- @dead-horse: What is cnpm?
- install and deploy cnpmjs.org through npm: examples
- Mirror NPM in China: cnpmjs.org
- cnpm client: cnpm,
npm install -g cnpm
- How to deploy cnpmjs.org
- Sync packages through
http_proxy
- wiki
Develop on your local machine
Dependencies
- node >= 4.3.1
- Databases: only required one type
Clone codes and run test
# clone from git
$ git clone https://github.com/cnpm/cnpmjs.org.git
# install dependencies
$ make install
# test
$ make test
# coverage
$ make test-cov
# update dependencies
$ make autod
# start server with development mode
$ make dev
Dockerized cnpmjs.org Installation Guide
Cnpmjs.org shipped with a simple but pragmatic Docker Compose configuration.With the configuration, you can set up a MySQL backed cnpmjs.org instance by executing just one command on Docker installed environment.
Preparation
- Install Docker
- Install Docker Compose (Docker for Mac, Docker for Windows include Docker Compose, so most Mac and Windows users do not need to install Docker Compose separately)
- (Optional) Speed up Docker images downloading by setting up Docker images download accelerator
Dockerized cnpmjs.org control command
Make sure your current working directory is the root of this GitHub repository.
Run dockerized cnpmjs.org
$docker-compose up
This command will build a Docker image using the current code of repository. Then set up a dockerized MySQL instance with data initialized. After Docker container running, you can access your cnpmjs.org web portal at http://127.0.0.1:7002 and npm register at http://127.0.0.1:7001.
Run cnpmjs.org in the backend
$docker-compose up -d
Rebuild cnpmjs.org Docker image
$docker-compose build
Remove current dockerized cnpmjs.org instance
The current configuration set 2 named Docker Volume for your persistent data. If you haven't change the repository directory name, them will be "cnpmjsorg_cnpm-files-volume" & "cnpmjsorg_cnpm-db-volume".
Be Careful, the following commands will remove them.
$docker-compose rm
$docker volume rm cnpmjsorg_cnpm-files-volume
$docker volume rm cnpmjsorg_cnpm-db-volume
You can get more information about your data volumes using the below commands:
$docker volume ls // list all of your Docker volume
$docker volume inspect cnpmjsorg_cnpm-files-volume
$docker volume inspect cnpmjsorg_cnpm-db-volume
How to contribute
- Clone the project
- Checkout a new branch
- Add new features or fix bugs in the new branch
- Make a pull request and we will review it ASAP
Tips: make sure your code is following the node-style-guide.
Sponsors
from https://github.com/cnpm/cnpmjs.org
--------
--------
Usage
use our npm client cnpm(More suitable with cnpmjs.org and gzip support), you can get our client through npm:
$ npm install -g cnpm --registry=https://registry.npm.taobao.org
Or you can alias NPM to use it:
alias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/mirrors/node \
--userconfig=$HOME/.cnpmrc"
#Or alias it in .bashrc or .zshrc
$ echo '\n#alias for cnpm\nalias cnpm="npm --registry=https://registry.npm.taobao.org \
--cache=$HOME/.npm/.cache/cnpm \
--disturl=https://npm.taobao.org/mirrors/node \
--userconfig=$HOME/.cnpmrc"' >> ~/.zshrc && source ~/.zshrc
install
Install package from r.cnpmjs.org. When installing a package or version does not exist, it will try to install from the official registry(registry.npmjs.org), and sync this package to cnpm in the backend.
$ cnpm install [name]
sync
Only
cnpm
cli has this command. Meaning sync package from source npm.$ cnpm sync connect
sync package on web: sync/connect
$ open http://registry.npm.taobao.org/sync/connect
publish / unpublish
Only
admin
user can publish / unpublish package to private registry.$ cnpm publish [name]
$ cnpm unpublish [name]
Other commands
Support all the other npm commands. e.g.:
$ cnpm info cnpm
TODO list
@see Github Issues
Histories
Release History.
npmjs.org, cnpmjs.org and npm.taobao.org relation
from https://cnpmjs.org/
No comments:
Post a Comment