3

这是场景:

我们想要一个用于多个组件的 monorepo,并希望将 lerna 与 yarn 工作区一起使用。

为了确保语义版本控制不会出现问题,最好也对版本号进行代码审查。因此,package.json定义了一个version-bump仅用于增加包版本的脚本。

在测试运行且 CR 正常后,我们希望部署机器人为我们将包发布到我们的自定义注册表。为此,最好使用lerna publish --skip-git,这样 lerna 只会发布更改的包。

这里的问题是,它lerna publish不仅会发布包,还会再次要求它们的版本增量。很高兴知道在不增加版本的情况下发布的选项或解决方法。

我们当前的解决方法是使用lerna exec npm publish,但这会尝试再次发布已经发布的包。我们也不能使用lerna exec yarn publish,因为在这种情况下yarn要求版本增量。

设置如下所示:

lerna.json:

{
  "lerna": "2.5.1",
  "version": "independent",
  "npmClient": "yarn",
  "useWorkspaces": true,
  "packages": [
    "packages/*"
  ]
}

包.json

{
  "name": "…",
  "version": "0.0.0",
  "description": "…",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "…"
  },
  "workspaces": [
    "packages/*"
  ],
  "private": true,
  "scripts": {
    "version-bump": "./node_modules/lerna/bin/lerna.js publish --skip-npm",
    "test": "echo well tested"
  },
  "devDependencies": {
    "lerna": "^2.5.1"
  }
}
4

2 回答 2

5

对于需要此功能的任何人,看起来他们正在为 v3.0 开发它:

单独的“版本”和“发布”命令 - https://github.com/lerna/lerna/issues/961

于 2018-06-06T10:21:34.830 回答
2

我在同一条船上。该功能不存在。理想情况下,Lerna 会有一个参数,你可以通过它来跳过版本号。你最好在 Github 上的项目中发出一些声音:https ://github.com/lerna/lerna/issues

于 2017-11-29T17:51:36.397 回答