Open tiodot opened 6 years ago
最近将之前项目使用的组件包从gitlab上迁移到npm私服上面去,为了兼容jello打包方式,同时开发了一个jello从npm安装模块插件fis-comman-install-npm。记录一下使用的api:
api: http://registry.npm.taobao.org/xxxx eg: http://registry.npm.taobao.org/fis-command-install-npm 相关信息:
http://registry.npm.taobao.org/xxxx
http://registry.npm.taobao.org/fis-command-install-npm
{ "_id":"fis-command-install-npm", "_rev":"12306583", "name":"fis-command-install-npm", "description":"fis install command.", "dist-tags":{ "latest":"0.0.6" }, "maintainers":[], "time":Object{...}, "users":Object{...}, "author":Object{...}, "repository":Object{...}, "versions":Object{...}, "readme":"# fis-command-install-npm 从npm中安装fis组件包 ## Usage Usage: install-npm <name> [options] Options: -h, --help output usage information --save save component(s) dependencies into `components.json` file. -r, --repos <url> repository url ", "_attachments":{ }, "homepage":"http://fis.baidu.com/", "bugs":{ "url":"https://github.com/tiodot/fis-command-install/issues" } }
这个所以npm包的所以包版本信息,和readme中的内容。
api: http://registry.npm.taobao.org/xxxx/version eg: http://registry.npm.taobao.org/fis-command-install-npm/0.0.1 返回示例:
http://registry.npm.taobao.org/xxxx/version
http://registry.npm.taobao.org/fis-command-install-npm/0.0.1
{ "name":"fis-command-install-npm", "description":"fis install command.", "version":"0.0.1", "author":Object{...}, "homepage":"http://fis.baidu.com/", "keywords":Array[1], "repository":Object{...}, "engines":Object{...}, "main":"install.js", "scripts":Object{...}, "dependencies":{ "bluebird":"^2.3.11", "findup":"^0.1.5", "fis-scaffold-kernel":"~0.2.0", "progress":"^1.1.8", "request":"^2.48.0", "semver":"^4.1.0", "tar":"^2.2.1" }, "devDependencies":Object{...}, "gitHead":"601c08d91325eee20ce5db8f965c6baf5ebc61d4", "bugs":Object{...}, "_id":"fis-command-install-npm@0.0.1", "_npmVersion":"5.3.0", "_nodeVersion":"6.10.3", "_npmUser":Object{...}, "dist":{ "shasum":"2bebae0c4da5a9c37ad3820fb4fcc4173a0530d5", "size":13949, "noattachment":false, "tarball":"http://registry.npm.taobao.org/fis-command-install-npm/download/fis-command-install-npm-0.0.1.tgz" }, "maintainers":Array[1], "_npmOperationalInternal":Object{...}, "directories":Object{...}, "publish_time":1513069026797, "_hasShrinkwrap":false, "_cnpm_publish_time":1513069026797, "dist-tags":Object{...} }
这个就是的对应版本的pacakge.json内容了。
api: http://registry.npm.taobao.org/-/package/xxxx/dist-tags eg: http://registry.npm.taobao.org/-/package/fis-command-install-npm/dist-tags 返回示例:
http://registry.npm.taobao.org/-/package/xxxx/dist-tags
http://registry.npm.taobao.org/-/package/fis-command-install-npm/dist-tags
{"latest":"0.0.6"}
api: http://registry.npm.taobao.org/xxx/download/xxx-version.tgz eg: http://registry.npm.taobao.org/fis-command-install-npm/download/fis-command-install-npm-0.0.1.tgz 当然还有其他api可以参考cnpmjs.org/routers/registry.js
http://registry.npm.taobao.org/xxx/download/xxx-version.tgz
http://registry.npm.taobao.org/fis-command-install-npm/download/fis-command-install-npm-0.0.1.tgz
最近将之前项目使用的组件包从gitlab上迁移到npm私服上面去,为了兼容jello打包方式,同时开发了一个jello从npm安装模块插件fis-comman-install-npm。记录一下使用的api:
1.获取npm包信息
api:
http://registry.npm.taobao.org/xxxx
eg:http://registry.npm.taobao.org/fis-command-install-npm
相关信息:这个所以npm包的所以包版本信息,和readme中的内容。
2. 获取npm包某一个版本信息
api:
http://registry.npm.taobao.org/xxxx/version
eg:http://registry.npm.taobao.org/fis-command-install-npm/0.0.1
返回示例:这个就是的对应版本的pacakge.json内容了。
3.获取npm包的tags
api:
http://registry.npm.taobao.org/-/package/xxxx/dist-tags
eg:http://registry.npm.taobao.org/-/package/fis-command-install-npm/dist-tags
返回示例:4.下载npm包地址
api:
http://registry.npm.taobao.org/xxx/download/xxx-version.tgz
eg:http://registry.npm.taobao.org/fis-command-install-npm/download/fis-command-install-npm-0.0.1.tgz
当然还有其他api可以参考cnpmjs.org/routers/registry.js参考