【问题标题】:yarn publish fails because dist folder is added to gitignoreyarn publish 失败,因为 dist 文件夹被添加到 gitignore
【发布时间】:2019-12-04 13:17:37
【问题描述】:

Yarn 想在发布节点模块时添加一个 git 标签。但是,此文件夹已添加到 gitignore。

 yarn publish dist

Output:
    The following paths are ignored by one of your .gitignore files:
    dist/package.json
    Use -f if you really want to add them.
    info Visit https://yarnpkg.com/en/docs/cli/publish for documentation about this command.

如何将 dist 保留在 gitignore 中,但要让 yarn 能够将 dist 文件夹添加到 git 提交中?

我试过了:

-.npmignore 没有 dist 文件夹(-->被纱线忽略)

-将文件数组添加到 package.json

-还有其他建议吗?

【问题讨论】:

  • 我不清楚yarn publish 和 Git 提交之间的关系。如前所述,将dist/ 添加到 Git 提交实际上是您的目标吗?
  • 每当你运行发布命令时,Yarn publish 也会推送 git 标签
  • 有趣;感谢@Vincent 的澄清!
  • 不是真的,因为这个问题是关于要发布哪些来源并且没有澄清纱线自动进行 git 标记

标签: git npm yarnpkg


【解决方案1】:

我对此的解决方案(我想更多的是一种解决方法)是使用--no-git-tag-version 选项调用yarn publish,例如

yarn publish dist/ --no-git-tag-version

【讨论】:

  • 这也有效。我最终将发布步骤一分为二。 1) 构建 gzip 存档的纱线包和 2) 纱线发布该存档。比 git 标记也被跳过了
猜你喜欢
  • 2021-01-27
  • 1970-01-01
  • 2019-11-23
  • 1970-01-01
  • 2013-09-03
  • 1970-01-01
  • 2018-05-25
  • 2014-03-24
  • 2020-04-21
相关资源
最近更新 更多