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.flow 914B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // @flow
  2. import environmentIsNode from 'detect-node';
  3. import cmp from 'semver-compare';
  4. import {
  5. version,
  6. } from '../../package.json';
  7. import type {
  8. RoarrGlobalStateType,
  9. } from '../types';
  10. import createNodeWriter from './createNodeWriter';
  11. // eslint-disable-next-line flowtype/no-weak-types
  12. export default (currentState: Object): RoarrGlobalStateType => {
  13. const versions = (currentState.versions || []).concat();
  14. versions.sort(cmp);
  15. const currentIsLatestVersion = !versions.length || cmp(version, versions[versions.length - 1]) === 1;
  16. if (!versions.includes(version)) {
  17. versions.push(version);
  18. }
  19. versions.sort(cmp);
  20. let newState = {
  21. sequence: 0,
  22. ...currentState,
  23. versions,
  24. };
  25. if (environmentIsNode) {
  26. if (currentIsLatestVersion || !newState.write) {
  27. newState = {
  28. ...newState,
  29. ...createNodeWriter(),
  30. };
  31. }
  32. }
  33. return newState;
  34. };