词典
构建脚本
¥Build Scripts
指的是软件包安装后立即执行的任务;通常是清单中 scripts
字段中配置的 postinstall
脚本。
¥Refers to tasks executed right after the packages got installed; typically the postinstall
scripts configured in the scripts
field from the manifest.
构建脚本应留给原生依赖,纯 JavaScript 包几乎没有理由使用它们。它们在用户的项目上有 重大副作用,因此请仔细权衡是否真的需要它们。
¥Build scripts should be left to native dependencies, there is virtually no reason for pure JavaScript packages to use them. They have significant side effects on your user's projects, so weight carefully whether you really need them.
另请参阅:生命周期脚本
¥See also: Lifecycle Scripts
依赖
¥Dependency
依赖(在清单的 dependencies
字段中列出)描述了两个包之间的关系。
¥A dependency (listed in the dependencies
field of the manifest) describes a relationship between two packages.
当包 A 具有依赖 B 时,Yarn 保证如果安装成功,A 将能够访问 B。请注意,这是我们对常规依赖做出的唯一承诺:特别是,不能保证包 B 与 应用其他部分使用的版本相同。
¥When a package A has a dependency B, Yarn guarantees that A will be able to access B if the install is successful. Note that this is the only promise we make regarding regular dependencies: in particular, there is no guarantee that package B will be the same version than the one used in other parts of the application.
¥See also: Development Dependency, Peer Dependency
描述符
¥Descriptor
描述符是包名称(例如 lodash
)和包 range(例如 ^1.0.0
)的组合。描述符用于标识一组包,而不是一个唯一的包。
¥A descriptor is a combination of a package name (for example lodash
) and a package range (for example ^1.0.0
). Descriptors are used to identify a set of packages rather than one unique package.
开发依赖
¥Development Dependency
依赖(在清单的 devDependencies
字段中列出)描述了两个包之间的关系。
¥A dependency (listed in the