Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

createRoarrInititialGlobalState.js 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _detectNode = _interopRequireDefault(require("detect-node"));
  7. var _semverCompare = _interopRequireDefault(require("semver-compare"));
  8. var _package = require("../../package.json");
  9. var _createNodeWriter = _interopRequireDefault(require("./createNodeWriter"));
  10. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  11. function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
  12. function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
  13. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  14. // eslint-disable-next-line flowtype/no-weak-types
  15. const createRoarrInititialGlobalState = currentState => {
  16. const versions = (currentState.versions || []).concat();
  17. versions.sort(_semverCompare.default);
  18. const currentIsLatestVersion = !versions.length || (0, _semverCompare.default)(_package.version, versions[versions.length - 1]) === 1;
  19. if (!versions.includes(_package.version)) {
  20. versions.push(_package.version);
  21. }
  22. versions.sort(_semverCompare.default);
  23. let newState = _objectSpread(_objectSpread({
  24. sequence: 0
  25. }, currentState), {}, {
  26. versions
  27. });
  28. if (_detectNode.default) {
  29. if (currentIsLatestVersion || !newState.write) {
  30. newState = _objectSpread(_objectSpread({}, newState), (0, _createNodeWriter.default)());
  31. }
  32. }
  33. return newState;
  34. };
  35. var _default = createRoarrInititialGlobalState;
  36. exports.default = _default;
  37. //# sourceMappingURL=createRoarrInititialGlobalState.js.map