command.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. "use strict";
  2. const { filterOptions } = require("@lerna/filter-options");
  3. /**
  4. * @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
  5. */
  6. exports.command = "bootstrap";
  7. exports.describe = "Link local packages together and install remaining package dependencies";
  8. exports.builder = (yargs) => {
  9. yargs
  10. .example(
  11. "$0 bootstrap -- --no-optional",
  12. "# execute `npm install --no-optional` in bootstrapped packages"
  13. )
  14. .parserConfiguration({
  15. "populate--": true,
  16. })
  17. .options({
  18. hoist: {
  19. group: "Command Options:",
  20. describe: "Install external dependencies matching [glob] to the repo root",
  21. defaultDescription: "'**'",
  22. },
  23. nohoist: {
  24. group: "Command Options:",
  25. describe: "Don't hoist external dependencies matching [glob] to the repo root",
  26. type: "string",
  27. requiresArg: true,
  28. },
  29. mutex: {
  30. hidden: true,
  31. // untyped and hidden on purpose
  32. },
  33. "ignore-prepublish": {
  34. group: "Command Options:",
  35. describe: "Don't run prepublish lifecycle scripts in bootstrapped packages.",
  36. type: "boolean",
  37. },
  38. "ignore-scripts": {
  39. group: "Command Options:",
  40. describe: "Don't run _any_ lifecycle scripts in bootstrapped packages",
  41. type: "boolean",
  42. },
  43. "npm-client": {
  44. group: "Command Options:",
  45. describe: "Executable used to install dependencies (npm, yarn, pnpm, ...)",
  46. type: "string",
  47. requiresArg: true,
  48. },
  49. registry: {
  50. group: "Command Options:",
  51. describe: "Use the specified registry for all npm client operations.",
  52. type: "string",
  53. requiresArg: true,
  54. },
  55. strict: {
  56. group: "Command Options:",
  57. describe: "Don't allow warnings when hoisting as it causes longer bootstrap times and other issues.",
  58. type: "boolean",
  59. },
  60. "use-workspaces": {
  61. group: "Command Options:",
  62. describe: "Enable integration with Yarn workspaces.",
  63. type: "boolean",
  64. },
  65. "force-local": {
  66. group: "Command Options:",
  67. describe: "Force local sibling links regardless of version range match",
  68. type: "boolean",
  69. },
  70. contents: {
  71. group: "Command Options:",
  72. describe: "Subdirectory to use as the source of any links. Must apply to ALL packages.",
  73. type: "string",
  74. defaultDescription: ".",
  75. },
  76. });
  77. return filterOptions(yargs);
  78. };
  79. exports.handler = function handler(argv) {
  80. return require(".")(argv);
  81. };