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.
如何在 gitignore 中保留 dist,但让 yarn 能够将 dist 文件夹添加到 git 提交中?
我试过:
-.npmignore 没有 dist 文件夹(-->被 yarn 忽略)
-添加一个文件数组到package.json
-有人有其他建议吗?
最佳答案
我对此的解决方案(我想更多的是解决方法)是使用 --no-git-tag-version
选项调用 yarn publish
,例如
yarn publish dist/ --no-git-tag-version
关于git - yarn 发布失败,因为 dist 文件夹已添加到 gitignore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57215892/