index.js 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. "use strict";
  2. const os = require("os");
  3. module.exports.globalOptions = globalOptions;
  4. function globalOptions(yargs) {
  5. // the global options applicable to _every_ command
  6. const opts = {
  7. loglevel: {
  8. defaultDescription: "info",
  9. describe: "What level of logs to report.",
  10. type: "string",
  11. },
  12. concurrency: {
  13. defaultDescription: os.cpus().length,
  14. describe: "How many processes to use when lerna parallelizes tasks.",
  15. type: "number",
  16. requiresArg: true,
  17. },
  18. "reject-cycles": {
  19. describe: "Fail if a cycle is detected among dependencies.",
  20. type: "boolean",
  21. },
  22. "no-progress": {
  23. describe: "Disable progress bars. (Always off in CI)",
  24. type: "boolean",
  25. },
  26. progress: {
  27. // proxy for --no-progress
  28. hidden: true,
  29. type: "boolean",
  30. },
  31. "no-sort": {
  32. describe: "Do not sort packages topologically (dependencies before dependents).",
  33. type: "boolean",
  34. },
  35. sort: {
  36. // proxy for --no-sort
  37. hidden: true,
  38. type: "boolean",
  39. },
  40. "max-buffer": {
  41. describe: "Set max-buffer (in bytes) for subcommand execution",
  42. type: "number",
  43. requiresArg: true,
  44. },
  45. };
  46. // group options under "Global Options:" header
  47. const globalKeys = Object.keys(opts).concat(["help", "version"]);
  48. return yargs.options(opts).group(globalKeys, "Global Options:").option("ci", {
  49. hidden: true,
  50. type: "boolean",
  51. });
  52. }