Angular打包本身的类库,本质上是npm范畴内的职责,因此实际上就是npm publish进行发布。html
npm publish 发布到npm仓库,固然也有官方仓库和私有仓库两种。npm
说说私有仓库:post
Nexus搭建npm私有仓库。编码
Nexus须要启用npm的realm: htm
登陆私有仓库blog
登陆私有仓库后,.npmrc文件内容大概是这样:ip
registry=http://localhost:8880/repository/npm-all/get
//localhost:8880/repository/npm-all/:username=dyit
//localhost:8880/repository/npm-all/:password=ZHkxMzI0RFk=登录
//localhost:8880/repository/npm-local/:username=dy
//localhost:8880/repository/npm-local/:password=ZHkxMzI0RFk=
.npmrc文件中能够写入若干npm的配置项,与publish十分相关的就是登陆到私有仓库。 以//开头的行,为相应仓库登陆是须要的参数,上面使用了username和password两个参数,其中password是须要用Base64编码的。配置文件中能够针对多个仓库进行参数配置,这点很重要,能够将全部可能被发布到的仓库的登陆信息写在这里,供实际发布时使用,即:
npm publish --registry=http://localhost:8880/repository/npm-local/
完成上述三点,既能够将类库包npm publish进私有仓库了。