yarn import
依据原npm安装后的`node_modules`目录生成一份`yarn.lock`文件
yarn import
This command assists the migration of projects currently relying on npm-shrinkwrap.json
, minimizing the differences between the lockfile and the existing dependency tree as best as it can.
Motivation
许多项目目前使用 npm shrinkwrap
或将 node_modules
签入它们的源代码控制,因为它们的依赖关系树很脆弱。 这些项目无法轻易迁移到 Yarn,因为 yarn install
可能产生有很大差异的逻辑依赖关系树。 不是所有树都可以用 Yarn 的 yarn.lock
表示, 并且部分有效的树会在安装后自动按重复剔除。 These nuances and others present a significant barrier to manual migration.
yarn import
旨在使用在 node_modules
内找到的版本根据普通的 require.resolve()
决议规则生成一个 yarn.lock
文件以缓解这一重大问题。 In cases where the Yarn resolution mechanism can’t satisfy the existing dependency tree identically, alerts will be made so that you may manually review the changes. The existing node_modules
tree will be checked for validity beforehand, and the resultant lockfile should be yarn install
able without any surprises (failed compatibility, unresolvable dependencies, auto-dedupes, etc.)
$ yarn import
yarn import vx.x.x
success Folder in sync.
warning Using version "2.2.4" of "lru-cache" instead of "2.7.3" for "ngstorage > grunt > minimatch"
warning Using version "2.0.6" of "readable-stream" instead of "2.2.9" for "ngstorage > karma > chokidar > readdirp"
[...]
success Saved lockfile.
✨ Done in 11.96s.