npm-registry-couchapp中文文档|npm-registry-couchapp js中文教程|解析

npm npmdoc 2年前 (2022-01-01) 486次浏览

npm-registry-couchapp中文文档|npm-registry-couchapp js中文教程|解析

安装命令:npm i npm-registry-couchapp

npm-registry-couchapp

构建状态

弃用通知:随着npm规模的扩大,registry架构逐渐向复杂的分布式架构迁移,npm-registry-couchapp只是其中的一小部分。FOSS 是 npm 的重要组成部分,随着时间的推移,我们计划公开更多 API,并更好地记录现有 API

npm-registry-couchapp 仍然是我们功能的核心部分,但所有新的注册表功能现在都添加到现在构成 npm 的微服务中。出于这个原因,我们不会接受任何拉取请求,也不会对这个代码库进行任何更改。

对于 npmjs.com 网站的问题,请在npm/www 存储上打开一个问题
有关注册表服务的问题(例如,包下载速度缓慢或无法发布包),请参阅
npm/registry 存储库。

The npm Registry CouchApp 的设计文档

安装

您需要 CouchDB 1.4.0 或更高版本。1.5.0 或更高版本最好。

安装 CouchDB 后,创建一个新数据库:

curl -X PUT http://localhost:5984/registry

您需要在您的 local.ini

[couch_httpd_auth]
public_fields = appdotnet, avatar, avatarMedium, avatarLarge, date, email, fields, freenode, fullname, github, homepage, name, roles, twitter, type, _id, _rev
users_db_public = true
 
[httpd]
secure_rewrites = false
 
[couchdb]
delayed_commits = false

如果你还没有克隆存储库,然后 cd 进入它:

git clone git://github.com/npm/npm-registry-couchapp
cd npm-registry-couchapp

现在安装这些东西:

npm install

将 ddoc 同步到 _design/scratch

npm start \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

接下来,确保加载了视图:

npm run load \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

最后,将 ddoc 从复制_design/scratch_design/app

npm run copy \
  --npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

当然,您可以通过在 ~/.npmrc 文件中设置它来避免命令行标志:

_npm-registry-couchapp:couch=http://admin:password@localhost:5984/registry

_防止任何其他包从他们的环境中看到的设置(使用密码)时,对于那些其他包NPM运行的脚本。

复制注册表

要复制没有附件的注册表,您可以将 CouchDB 复制器指向https://skimdb.npmjs.com/registry请注意,公共包的附件仍将从公共位置加载,但您发布到私有注册表中的任何内容都将保持私有。

使用附件复制注册表,请考虑使用
npm-fullfat-registryfullfatdb CouchDB 实例已
弃用

使用带有 npm 客户端的注册表

通过到目前为止的设置,您可以将 npm 客户端放在注册表中,将其放入 ~/.npmrc 文件中:

registry = http://localhost:5984/registry/_design/app/_rewrite

您还可以设置 npm 注册表配置属性,如:

npm config set \
  registry=http://localhost:5984/registry/_design/app/_rewrite

或者您可以在每次调用时简单地覆盖注册表配置:

npm \
  --registry=http://localhost:5984/registry/_design/app/_rewrite \
  install <package>

可选:主机顶部 url

为了更时髦,添加一个 vhost 配置:

[vhosts]
registry.mydomain.com:5984 = /registry/_design/app/_rewrite

哪里registry.mydomain.com是你正在运行的东西的主机名,5984是CouchDB的运行的端口。如果您在端口 80 上运行,则完全省略该端口。

然后,例如,您可以像这样引用存储库:

npm config set registry http://registry.mydomain.com:5984
项目贡献人员列表:


极客公园 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:npm-registry-couchapp中文文档|npm-registry-couchapp js中文教程|解析
喜欢 (0)
.excerpt .focus {display:none}