本文介绍了lerna import 总是返回 EDESTDIR的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

限时删除!!

我有一个预先存在的项目,我想将其导入到使用纱线工作区的现有 lerna monorepo 中.

命令:

我已尝试运行以下所有命令.错误仍然顽固地保持不变.另外,petstore 有一个 package.json 文件,是一个 git repo.

lerna import ./petstore --dest="./packages/"lerna 导入 ./petstore --dest="./packages/api/"

错误:

lerna通知cli v3.20.2勒纳错了!EDESTDIR --dest 与包目录不匹配:packages/**

此外,lerna import ../petstore 会导致创建一个 packages/**/petstore,这不是预期的结果.

我希望这包含所有相关代码.我们在 packages/shared 下有支持包,在 packages/api 下有 apis.

lerna.json

{包":[包/**/*"],"npmClient": "纱线",使用工作区":真,私人":真的,版本":0.0.1",勒纳":2.11.0"}

package.json

{"name": "root",开发依赖":{"lerna": "^2.11.0"},工作区":[包/**/*"],}

我看过的资源:

解决方案

Lerna 从 package.json 上的键 workspaces 而不是 lerna 上的 packages 读取包.json.

lerna 使用 /* 读取所有值并将它们视为包目录.它从字面上解释 ** 并且不会将其解析为通配符并展开它.

解决方案是从lerna.json中删除packages:

{"npmClient": "纱线",使用工作区":真,私人":真的,版本":0.0.1",勒纳":2.11.0"}

并更新工作区路径以明确引用包中的任何子目录,如果您的 monorepo 是这样构建的:

{"name": "root",开发依赖":{"lerna": "^2.11.0"},工作区":["包/a/*",包/api/*"],}

要将 pet-store 项目从 mono-repo 外部的目录导入到 monorepo 中的 packages/api:

lerna import ../pet-store --dest="./packages/api/"

I have a pre-existing project that I'd like to import into my existing lerna monorepo that uses yarn workspaces.

Command(s):

lerna import ./petstore --dest="./packages/"
lerna import ./petstore --dest="./packages/api/"

ERROR:

lerna notice cli v3.20.2
lerna ERR! EDESTDIR --dest does not match with the package directories: packages/**

I hope this consists of all the relevant code. We have supporting packages under packages/shared and apis under packages/api.

lerna.json

{
  "packages": [
    "packages/**/*"
  ],
  "npmClient": "yarn",
  "useWorkspaces": true,
  "private": true,
  "version": "0.0.1",
  "lerna": "2.11.0"
}

package.json

{
  "name": "root",
  "devDependencies": {
    "lerna": "^2.11.0"
  },
  "workspaces": [
    "packages/**/*"
  ],
}

Resources I have looked at:

解决方案

Lerna reads the packages from the key workspaces on package.json instead of the packages on lerna.json.

lerna reads all the values with a /* and considers them package directories. It interprets ** literally and does not parse it as a wildcard and expand it.

The solution is to remove packages from lerna.json:

{
  "npmClient": "yarn",
  "useWorkspaces": true,
  "private": true,
  "version": "0.0.1",
  "lerna": "2.11.0"
}

and update the workspaces path to refer to any sub-directories in your packages explicitly if your monorepo is structured that way:

{
  "name": "root",
  "devDependencies": {
    "lerna": "^2.11.0"
  },
  "workspaces": [
    "packages/a/*",
    "packages/api/*"
  ],
}

To import the pet-store project into packages/api in the monorepo from a directory outside the mono-repo:

lerna import ../pet-store --dest="./packages/api/"

这篇关于lerna import 总是返回 EDESTDIR的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

1403页,肝出来的..

09-06 12:45