【问题标题】:How do you install a repo by branchName and have it build when it installs?如何通过 branchName 安装 repo 并在安装时构建它?
【发布时间】:2019-09-15 20:02:29
【问题描述】:

我在企业存储库中工作,需要按分支名称而不是版本来安装存储库。 我能够通过以下方式做到这一点:

npm install git+ssh://git@gitlab.mydomain.com:user/repo.git#yourBranchName

这也适用于https url from git 安装后,虽然看起来 build 和 dist 目录不包括在内。 如何通过 branchName 安装 repo 并在安装时仍然构建它?

One approach I've tried is building the repo and then removing the dist 
and lib directories form the .gitignore. This works but requires committing those directories 
to github. 

有没有更好的办法?

【问题讨论】:

    标签: git npm enterprise


    【解决方案1】:

    解决此问题的一个好方法是将准备脚本添加到 package.json。

    "scripts": {
        "prepare": "builder run build"
    }
    

    我们使用 builder,效果很好。 我想在本地构建的任何命令都适用于这个准备脚本,因为这对我有用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-02-21
      • 1970-01-01
      • 2014-08-03
      • 2019-03-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多