Lerna 不支持顶层依赖?
Lerna does not support dependencies at the top level?
我正在将我的 monorepo(返回)从 yarn(带工作区)切换到 lerna/npm,因为 yarn 太慢且不稳定。然而,我有了一个惊人的发现。使用以下琐碎的 package.json
:
{
"devDependencies": { "lerna": "^2.11.0" },
"dependencies": { "typescript": "^2.9.1" }
}
和一个空的 lerna.json
(换句话说,根本没有包),然后当我 运行
$ lerna bootstrap
它不会在任何顶级 node_modules
目录中安装任何东西。如果由于某种原因我有一个没有 .bin
子目录的 node_modules
目录,那么 lerna bootstrap
将无法创建或填充 .bin
子目录。
lerna 的设计不是为了实际指定要安装的顶级包(连同它们在 .bin
中的二进制文件)吗?我确实注意到,如果我在没有包裹的 lerna monorepo 上尝试 lerna add
,它会抱怨 "lerna WARN No packages found in scope where tslint can be added."
我在文档中找不到与此相关的任何内容。使用 yarn/workspaces,我可以安装 TypeScript 之类的全局(顶级)版本,以便在我的构建脚本中使用,同时保持对安装版本的控制。
来自 Lerna 文档:
You can add the root as a managed location (in the packages array of lerna.json
) - if that's something you need. This would cause lerna to link root's dependencies to your packages' directories, run postinstall
script along with the others, etc.
我正在将我的 monorepo(返回)从 yarn(带工作区)切换到 lerna/npm,因为 yarn 太慢且不稳定。然而,我有了一个惊人的发现。使用以下琐碎的 package.json
:
{
"devDependencies": { "lerna": "^2.11.0" },
"dependencies": { "typescript": "^2.9.1" }
}
和一个空的 lerna.json
(换句话说,根本没有包),然后当我 运行
$ lerna bootstrap
它不会在任何顶级 node_modules
目录中安装任何东西。如果由于某种原因我有一个没有 .bin
子目录的 node_modules
目录,那么 lerna bootstrap
将无法创建或填充 .bin
子目录。
lerna 的设计不是为了实际指定要安装的顶级包(连同它们在 .bin
中的二进制文件)吗?我确实注意到,如果我在没有包裹的 lerna monorepo 上尝试 lerna add
,它会抱怨 "lerna WARN No packages found in scope where tslint can be added."
我在文档中找不到与此相关的任何内容。使用 yarn/workspaces,我可以安装 TypeScript 之类的全局(顶级)版本,以便在我的构建脚本中使用,同时保持对安装版本的控制。
来自 Lerna 文档:
You can add the root as a managed location (in the packages array of
lerna.json
) - if that's something you need. This would cause lerna to link root's dependencies to your packages' directories, runpostinstall
script along with the others, etc.