command.js 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. "use strict";
  2. /**
  3. * @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
  4. */
  5. exports.command = "create <name> [loc]";
  6. exports.describe = "Create a new lerna-managed package";
  7. exports.builder = (yargs) => {
  8. yargs
  9. .positional("name", {
  10. describe: "The package name (including scope), which must be locally unique _and_ publicly available",
  11. type: "string",
  12. })
  13. .positional("loc", {
  14. describe: "A custom package location, defaulting to the first configured package location",
  15. type: "string",
  16. })
  17. .options({
  18. access: {
  19. group: "Command Options:",
  20. defaultDescription: "public",
  21. describe: "When using a scope, set publishConfig.access value",
  22. choices: ["public", "restricted"],
  23. },
  24. bin: {
  25. group: "Command Options:",
  26. defaultDescription: "<name>",
  27. describe: "Package has an executable. Customize with --bin <executableName>",
  28. },
  29. description: {
  30. group: "Command Options:",
  31. describe: "Package description",
  32. type: "string",
  33. },
  34. dependencies: {
  35. group: "Command Options:",
  36. describe: "A list of package dependencies",
  37. type: "array",
  38. },
  39. "es-module": {
  40. group: "Command Options:",
  41. describe: "Initialize a transpiled ES Module",
  42. type: "boolean",
  43. },
  44. homepage: {
  45. group: "Command Options:",
  46. describe: "The package homepage, defaulting to a subpath of the root pkg.homepage",
  47. type: "string",
  48. },
  49. keywords: {
  50. group: "Command Options:",
  51. describe: "A list of package keywords",
  52. type: "array",
  53. },
  54. license: {
  55. group: "Command Options:",
  56. defaultDescription: "ISC",
  57. describe: "The desired package license (SPDX identifier)",
  58. type: "string",
  59. },
  60. private: {
  61. group: "Command Options:",
  62. describe: "Make the new package private, never published to any external registry",
  63. type: "boolean",
  64. },
  65. registry: {
  66. group: "Command Options:",
  67. describe: "Configure the package's publishConfig.registry",
  68. type: "string",
  69. },
  70. tag: {
  71. group: "Command Options:",
  72. describe: "Configure the package's publishConfig.tag",
  73. type: "string",
  74. },
  75. y: {
  76. group: "Command Options:",
  77. describe: "Skip all prompts, accepting default values",
  78. alias: "yes",
  79. type: "boolean",
  80. },
  81. });
  82. return yargs;
  83. };
  84. exports.handler = function handler(argv) {
  85. return require(".")(argv);
  86. };