command.js 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. "use strict";
  2. const listable = require("@lerna/listable");
  3. /**
  4. * @see https://github.com/yargs/yargs/blob/master/docs/advanced.md#providing-a-command-module
  5. */
  6. exports.command = "changed";
  7. exports.aliases = ["updated"];
  8. exports.describe = "List local packages that have changed since the last tagged release";
  9. exports.builder = (yargs) => {
  10. const opts = {
  11. // only the relevant bits from `lerna version`
  12. "conventional-commits": {
  13. // fallback for overzealous --conventional-graduate
  14. hidden: true,
  15. type: "boolean",
  16. },
  17. "conventional-graduate": {
  18. describe: "Detect currently prereleased packages that would change to a non-prerelease version.",
  19. // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array)
  20. },
  21. "force-publish": {
  22. describe: "Always include targeted packages when detecting changed packages, skipping default logic.",
  23. // type must remain ambiguous because it is overloaded (boolean _or_ string _or_ array)
  24. },
  25. "ignore-changes": {
  26. describe: [
  27. "Ignore changes in files matched by glob(s) when detecting changed packages.",
  28. "Pass --no-ignore-changes to completely disable.",
  29. ].join("\n"),
  30. type: "array",
  31. },
  32. "include-merged-tags": {
  33. describe: "Include tags from merged branches when detecting changed packages.",
  34. type: "boolean",
  35. },
  36. };
  37. yargs.options(opts).group(Object.keys(opts), "Command Options:");
  38. return listable.options(yargs, "Output Options:");
  39. };
  40. exports.handler = function handler(argv) {
  41. return require(".")(argv);
  42. };