debug.js 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getInclusionReasons = getInclusionReasons;
  6. var _semver = require("semver");
  7. var _pretty = require("./pretty");
  8. var _utils = require("./utils");
  9. function getInclusionReasons(item, targetVersions, list) {
  10. const minVersions = list[item] || {};
  11. return Object.keys(targetVersions).reduce((result, env) => {
  12. const minVersion = (0, _utils.getLowestImplementedVersion)(minVersions, env);
  13. const targetVersion = targetVersions[env];
  14. if (!minVersion) {
  15. result[env] = (0, _pretty.prettifyVersion)(targetVersion);
  16. } else {
  17. const minIsUnreleased = (0, _utils.isUnreleasedVersion)(minVersion, env);
  18. const targetIsUnreleased = (0, _utils.isUnreleasedVersion)(targetVersion, env);
  19. if (!targetIsUnreleased && (minIsUnreleased || _semver.lt(targetVersion.toString(), (0, _utils.semverify)(minVersion)))) {
  20. result[env] = (0, _pretty.prettifyVersion)(targetVersion);
  21. }
  22. }
  23. return result;
  24. }, {});
  25. }