NPM 7.0.0 的工作区是否不再需要 Lerna? [英] Is Lerna needed anymore with NPM 7.0.0's workspaces?

查看:87
本文介绍了NPM 7.0.0 的工作区是否不再需要 Lerna?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

NPM 7.0.0 工作区是否不再需要 Lerna?

Is Lerna needed anymore with NPM 7.0.0 workspaces?

我对这个新的 npm 功能没有真正的经验.

I dont really have experience with this new npm feature.

Npm/rfcs 写道:

首先,还有一种选择是离开问题集为了用户空间解决,已经有非常流行的项目 Lerna提供其中一些功能.

First and foremost there’s the alternative of leaving the problem set for userland to solve, there’s already the very popular project Lerna that provides some of these features.

还可以选择仅支持安装(或bootstrap,正如 Lerna 所命名的)这个提议的方面,遵循较少的功能丰富的方法,但仍然可以实现基本目标改善管理多个子包的用户体验但是从这个研究阶段收集的所有反馈中RFC,这种替代方案对社区来说不太理想维护人员参与.

Also available is the alternative of supporting only the install (or bootstrap as Lerna names it) aspect of this proposal, following a less feature-rich approach but one that would still enable the basic goal of improving the user experience of managing multiple child packages but from all the feedback collected during the research phase of this RFC, this alternative is much less desirable to the community of maintainers involved.

很高兴每一个回答和解释:)

Glad for every answer and explanation :)

推荐答案

NPM 7 已发布,它支持工作区.他们还将在即将发布的版本中继续开发此域,

NPM 7 is out and it supports workspaces. they will also continue to develop this domain in the upcoming releases,

话虽如此,lerna 具有比 npm7yarn 工作区更多的高级功能,此外,yarn 声明他们永远不会尝试替换像 lerna 这样的工具,而是打算实现处理工作区的核心逻辑,例如安装子包依赖项和包符号链接.我希望 npm 也能做到这一点.

With that said, lerna comes with many more high level features than npm7 or yarn workspaces, furthermore, yarn declared that they will never try to replace tools like lerna, rather they intend to implement the core logic of handling workspaces like installing children packages dependencies and packages symlink. I expect npm to do the same.

一个很好的例子是命令:lerna changed,它为您提供自上次标记发布以来已更改的包列表,这对 CI/CD 非常有帮助.欢迎您探索 lerna 提供的额外命令.

One great example is the command: lerna changed which gives you the list of packages that have changed since the last tagged release, this could be extremely helpful for CI/CD. you are welcome to explore the extra commands provided by lerna.

到目前为止,npm7 支持的唯一与工作区相关的命令实际上是 npm i/npm ci,这不是新的,但它确实会处理嵌套的包和符号链接.

The only command as of today supported by npm7 related to workspaces is actually npm i / npm ci which is not new, but it does take care of nested packages and symlink.

如果您想移动到使用 npm7 的 monorepo,所以在没有 lerna 的情况下工作绝对是一个选择,你可能需要做更多与 lerna 相比,在 CI/CD 方面工作,并自行添加一些开发脚本,这些脚本会影响嵌套的包.此外,IMO lerna 更适合开发库而不是应用程序.

I've written an article that goes deeper into the configuration in case you want to move to a monorepo with npm7, so working without lerna is definitely an option, you will probably need to do more work on the CI/CD side compared to lerna and add some dev scripts by your self that will affect the nested packages. Also IMO lerna fits more to develop libs rather than apps.

这篇关于NPM 7.0.0 的工作区是否不再需要 Lerna?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆