创建一个新的 Lerna Package 。

用法

  1. $ lerna create --help
  2. lerna create <name> [loc]
  3. Create a new lerna-managed package
  4. Positionals:
  5. name The package name (including scope), which must be locally unique _and_
  6. publicly available [string] [required]
  7. loc A custom package location, defaulting to the first configured package
  8. location [string]
  9. Command Options:
  10. --access When using a scope, set publishConfig.access value
  11. [choices: "public", "restricted"] [default: public]
  12. --bin Package has an executable. Customize with --bin
  13. <executableName> [default: <name>]
  14. --description Package description [string]
  15. --dependencies A list of package dependencies [array]
  16. --es-module Initialize a transpiled ES Module
  17. --homepage The package homepage, defaulting to a subpath of the root
  18. pkg.homepage [string]
  19. --keywords A list of package keywords [array]
  20. --license The desired package license (SPDX identifier) [default: ISC]
  21. --private Make the new package private, never published
  22. --registry Configure the package's publishConfig.registry [string]
  23. --tag Configure the package's publishConfig.tag [string]
  24. --yes Skip all prompts, accepting default values

参数

参数 描述
name 包名(Package name)
loc 存放 Package 的 Package Location 。该 Package Location 必须事先创建并添加到 lerna.json > packages 选项中,否则默认使用第一个。

选项

注意

  • 默认创建的 Package 为 Public 的,包的 package.json 没有包含 private: true

    示例

  • 创建名为 utilities 的 Package,并将其存放到 pkgs/* 这个 Package Location ```bash $ lerna create utilities pkgs

$ tree pkgs/utilities ├── README.md ├── tests │ └── utilities.test.js ├── lib │ └── utilities.js └── package.json ```