Skip to content

Commit

Permalink
Merge pull request #85 from paul-roman/hotfix/folders-creation-first-…
Browse files Browse the repository at this point in the history
…launch

hotfix: isProduction helper now use ELECTRON_ENV variable
  • Loading branch information
Paul Roman authored Oct 4, 2018
2 parents 8ad570a + ae3b958 commit 14d4c02
Show file tree
Hide file tree
Showing 101 changed files with 6,288 additions and 6,534 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vitrine",
"version": "0.9.3",
"version": "0.9.4",
"description": "Centralize all of your games within a simple interface.",
"main": "public/server.js",
"productName": "Vitrine",
Expand Down Expand Up @@ -29,7 +29,6 @@
"discord-rich-presence": "^0.0.6",
"download-file": "^0.1.5",
"electron-updater": "^2.21.3",
"foreach-end": "1.1.0",
"fs-extra": "6.0.0",
"gamepad-listener": "0.4.0",
"glob": "^7.1.2",
Expand All @@ -48,6 +47,7 @@
"rimraf": "^2.6.2",
"semantic-ui-react": "0.80.0",
"steam-web": "0.7.0",
"steam-web-promise": "^0.8.0",
"uuid": "^3.2.1",
"winreg": "^1.2.4"
},
Expand Down Expand Up @@ -102,7 +102,7 @@
"node-windows": "^0.1.14"
},
"scripts": {
"start": "electron .",
"start": "cross-env ELECTRON_ENV=dev electron .",
"build:app": "parallel-webpack --progress --config=webpack/base.config.js",
"build:prod": "cross-env NODE_ENV=prod parallel-webpack --progress --config=webpack/base.config.js",
"build:server": "parallel-webpack --progress --config=webpack/server.config.js",
Expand Down
20 changes: 10 additions & 10 deletions scripts/build_modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ const { cd, exec, grep, mkdir, mv, rm } = require('shelljs');

const electronUrl = 'https://atom.io/download/electron';
const electronVersion = grep('"electron":', 'package.json')
.sed(/[ ]+"electron": "[\^]?(.*)"[,]?/, '$1')
.replace(/\n/, '');
.sed(/[ ]+"electron": "[\^]?(.*)"[,]?/, '$1')
.replace(/\n/, '');

mkdir('-p', 'modules');
cd('sources/modules');

readdir(resolve()).then((modules) => {
for (const module of modules.filter((module) => statSync(module).isDirectory())) {
cd(module);
exec(`${resolve('../../../node_modules/.bin/node-gyp')} rebuild --target=${electronVersion} --arch=x64 --dist-url=${electronUrl}`);
mv(`build/Release/${module}.node`, '../../../modules');
rm('-r', 'build');
cd('-');
console.log(`${module} build completed.`);
}
for (const module of modules.filter((module) => statSync(module).isDirectory())) {
cd(module);
exec(`${resolve('../../../node_modules/.bin/node-gyp')} rebuild --target=${electronVersion} --arch=x64 --dist-url=${electronUrl}`);
mv(`build/Release/${module}.node`, '../../../modules');
rm('-r', 'build');
cd('-');
console.log(`${module} build completed.`);
}
});
186 changes: 93 additions & 93 deletions sources/client/app/AppState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,113 +5,113 @@ import { PlayableGame, SortParameter } from '../../models/PlayableGame';
import { PotentialGame } from '../../models/PotentialGame';
import { reduxLog } from './helpers';
import {
gamesSortParameter,
gameToEdit,
launchedGame,
playableGames,
potentialGames,
potentialGameToAdd,
refreshingGames,
selectedGame
gamesSortParameter,
gameToEdit,
launchedGame,
playableGames,
potentialGames,
potentialGameToAdd,
refreshingGames,
selectedGame
} from './reducers/games';
import {
gameAddModalVisible,
igdbResearchModalVisible,
potentialGamesAddModalVisible,
settingsModalVisible,
timePlayedEditionModalVisible
gameAddModalVisible,
igdbResearchModalVisible,
potentialGamesAddModalVisible,
settingsModalVisible,
timePlayedEditionModalVisible
} from './reducers/modals';
import { internetConnection, modulesConfig, settings } from './reducers/settings';

export interface AppState {
settings: any;
modulesConfig: any;
internetConnection: boolean;
potentialGames: GamesCollection<PotentialGame>;
playableGames: GamesCollection<PlayableGame>;
selectedGame: PlayableGame;
launchedGame: PlayableGame;
refreshingGames: boolean;
potentialGameToAdd: PotentialGame;
gameToEdit: PlayableGame;
gamesSortParameter: SortParameter;
gameAddModalVisible: boolean;
igdbResearchModalVisible: boolean;
timePlayedEditionModalVisible: boolean;
potentialGamesAddModalVisible: boolean;
settingsModalVisible: boolean;
settings: any;
modulesConfig: any;
internetConnection: boolean;
potentialGames: GamesCollection<PotentialGame>;
playableGames: GamesCollection<PlayableGame>;
selectedGame: PlayableGame;
launchedGame: PlayableGame;
refreshingGames: boolean;
potentialGameToAdd: PotentialGame;
gameToEdit: PlayableGame;
gamesSortParameter: SortParameter;
gameAddModalVisible: boolean;
igdbResearchModalVisible: boolean;
timePlayedEditionModalVisible: boolean;
potentialGamesAddModalVisible: boolean;
settingsModalVisible: boolean;
}

export const vitrineStore: Store<AppState> = createStore(combineReducers({
settings,
modulesConfig,
internetConnection,
potentialGames,
playableGames,
selectedGame,
launchedGame,
refreshingGames,
potentialGameToAdd,
gameToEdit,
gamesSortParameter,
gameAddModalVisible,
igdbResearchModalVisible,
timePlayedEditionModalVisible,
potentialGamesAddModalVisible,
settingsModalVisible
settings,
modulesConfig,
internetConnection,
potentialGames,
playableGames,
selectedGame,
launchedGame,
refreshingGames,
potentialGameToAdd,
gameToEdit,
gamesSortParameter,
gameAddModalVisible,
igdbResearchModalVisible,
timePlayedEditionModalVisible,
potentialGamesAddModalVisible,
settingsModalVisible
}), {
settings: null,
modulesConfig: null,
internetConnection: true,
potentialGames: new GamesCollection<PotentialGame>(),
playableGames: new GamesCollection<PlayableGame>(),
selectedGame: null,
launchedGame: null,
refreshingGames: false,
potentialGameToAdd: null,
gameToEdit: null,
gamesSortParameter: SortParameter.NAME,
gameAddModalVisible: false,
igdbResearchModalVisible: false,
timePlayedEditionModalVisible: false,
potentialGamesAddModalVisible: false,
settingsModalVisible: false
settings: null,
modulesConfig: null,
internetConnection: true,
potentialGames: new GamesCollection<PotentialGame>(),
playableGames: new GamesCollection<PlayableGame>(),
selectedGame: null,
launchedGame: null,
refreshingGames: false,
potentialGameToAdd: null,
gameToEdit: null,
gamesSortParameter: SortParameter.NAME,
gameAddModalVisible: false,
igdbResearchModalVisible: false,
timePlayedEditionModalVisible: false,
potentialGamesAddModalVisible: false,
settingsModalVisible: false
}, applyMiddleware(reduxLog));

export function getSortedGamesFromStore(dispatchedData: any): PlayableGame[] {
const { playableGames, editedGame, gamesSortParameter }: any = dispatchedData;
const sortedGames: GamesCollection<PlayableGame> = new GamesCollection();
const { playableGames, editedGame, gamesSortParameter }: any = dispatchedData;
const sortedGames: GamesCollection<PlayableGame> = new GamesCollection();

if (playableGames && playableGames.length > 1)
sortedGames.addGames(playableGames);
else
sortedGames.addGames(vitrineStore.getState().playableGames.getGames());
if (playableGames && playableGames.length > 1)
sortedGames.addGames(playableGames);
else
sortedGames.addGames(vitrineStore.getState().playableGames.getGames());

if (playableGames && playableGames.length === 1)
sortedGames.addGame(playableGames[0]);
if (editedGame)
sortedGames.editGame(editedGame);
if (playableGames && playableGames.length === 1)
sortedGames.addGame(playableGames[0]);
if (editedGame)
sortedGames.editGame(editedGame);

const sortParameter = gamesSortParameter || vitrineStore.getState().gamesSortParameter;
switch (sortParameter) {
case (SortParameter.NAME): {
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
return (gameA.name > gameB.name) ? (1) : (-1);
});
}
case (SortParameter.TIME_PLAYED): {
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
return (gameA.timePlayed < gameB.timePlayed) ? (1) : (-1);
});
}
default:
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
if (!gameA.details[sortParameter])
return 1;
if (!gameB.details[sortParameter])
return -1;
const result: number = (sortParameter !== SortParameter.RATING && sortParameter !== SortParameter.RELEASE_DATE) ? (1) : (-1);
return (gameA.details[sortParameter] > gameB.details[sortParameter]) ? (result) : (-result);
});
}
const sortParameter = gamesSortParameter || vitrineStore.getState().gamesSortParameter;
switch (sortParameter) {
case (SortParameter.NAME): {
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
return (gameA.name > gameB.name) ? (1) : (-1);
});
}
case (SortParameter.TIME_PLAYED): {
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
return (gameA.timePlayed < gameB.timePlayed) ? (1) : (-1);
});
}
default:
return sortedGames.getGames().sort((gameA: PlayableGame, gameB: PlayableGame): number => {
if (!gameA.details[sortParameter])
return 1;
if (!gameB.details[sortParameter])
return -1;
const result: number = (sortParameter !== SortParameter.RATING && sortParameter !== SortParameter.RELEASE_DATE) ? (1) : (-1);
return (gameA.details[sortParameter] > gameB.details[sortParameter]) ? (result) : (-result);
});
}
}
Loading

0 comments on commit 14d4c02

Please sign in to comment.