# node + git 实现自建公用仓库 **Repository Path**: JustTwo/private-npm-warehouse ## Basic Information - **Project Name**: node + git 实现自建公用仓库 - **Description**: 私有的NPM仓库 - **Primary Language**: JavaScript - **License**: AGPL-3.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-02 - **Last Updated**: 2022-10-18 ## Categories & Tags **Categories**: Uncategorized **Tags**: 私有的NPM仓库 ## README # node + git 实现自建公用仓库 ##### 多端可复用解决方案 ##### 方法和组件都可以通过node+git的方式实现复用 ##### git用作储存仓库,npm包管理器下载git仓库储存的方法和组件 # 使用步骤 ##### 1.创建一个空的仓库 ##### 2.将仓库clone下来 ##### 3.npm init 仓库 放入自己的组件并且暴露出来 ##### 4.推送仓库并打tag版本 已便仓库更新后可以在引用的地方更新 ##### 5.在需要引用的项目中 package.json 添加仓库地址 username 名字 password 密码 v1.0.1 tag版本号 ``` "dependencies": { "my_production": "git+https:username:password@//git.xxx.com/xxx/my_production.git#v1.0.1", } ``` ##### 6.在需要引用的地方import {} from 'my_production';