git - yarn 发布失败,因为 dist 文件夹已添加到 gitignore

标签 git npm yarnpkg

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/

相关文章:

javascript - 在 docker 容器中安装 yarn 说缺少依赖

angular - 如何将 yarn 设置为 Angular CLI 的默认 packageManager?我得到 "Cannot read property ' 值为 null”

具有多个分支的 Git pull - 与错误的分支 merge

node.js - 将replaceStream的输出写入新文件

git - 如何从 git repo 中删除一个文件夹?

javascript - 在express js中制作api时出现 "cannot get"错误

node.js - npm ELIFECYCLE 错误退出状态 1

yarnpkg - 避免 Husky 被 monorepo 项目中每个不相关目录的更改触发

git - 无法修复 git 中的 eol 空白问题

git - github 是否支持 git wire 协议(protocol) v2?