pretty.js 954 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.prettifyTargets = prettifyTargets;
  6. exports.prettifyVersion = prettifyVersion;
  7. var _semver = require("semver");
  8. var _targets = require("./targets");
  9. function prettifyVersion(version) {
  10. if (typeof version !== "string") {
  11. return version;
  12. }
  13. const {
  14. major,
  15. minor,
  16. patch
  17. } = _semver.parse(version);
  18. const parts = [major];
  19. if (minor || patch) {
  20. parts.push(minor);
  21. }
  22. if (patch) {
  23. parts.push(patch);
  24. }
  25. return parts.join(".");
  26. }
  27. function prettifyTargets(targets) {
  28. return Object.keys(targets).reduce((results, target) => {
  29. let value = targets[target];
  30. const unreleasedLabel =
  31. _targets.unreleasedLabels[target];
  32. if (typeof value === "string" && unreleasedLabel !== value) {
  33. value = prettifyVersion(value);
  34. }
  35. results[target] = value;
  36. return results;
  37. }, {});
  38. }
  39. //# sourceMappingURL=pretty.js.map