2017-12-14 13:58:07 +01:00
|
|
|
import store from "store";
|
2017-09-10 06:47:46 +02:00
|
|
|
import { remote } from "electron";
|
2017-12-14 13:58:07 +01:00
|
|
|
import path from "path";
|
2017-02-20 19:56:15 +01:00
|
|
|
|
2017-12-06 17:32:21 +01:00
|
|
|
const env = process.env.NODE_ENV || "production";
|
2017-07-19 23:05:08 +02:00
|
|
|
const config = {
|
|
|
|
...require(`./config/${env}`),
|
|
|
|
};
|
2017-06-20 14:08:52 +02:00
|
|
|
const i18n = require("y18n")({
|
2017-12-14 13:58:07 +01:00
|
|
|
directory: path
|
|
|
|
.join(remote.app.getAppPath(), "/../static/locales")
|
|
|
|
.replace(/\\/g, "\\\\"),
|
2017-06-20 14:08:52 +02:00
|
|
|
updateFiles: false,
|
2017-09-07 03:53:42 +02:00
|
|
|
locale: "en",
|
2017-06-06 06:21:55 +02:00
|
|
|
});
|
2017-12-13 22:36:30 +01:00
|
|
|
|
2017-04-07 07:15:22 +02:00
|
|
|
const logs = [];
|
|
|
|
const app = {
|
2017-12-13 22:36:30 +01:00
|
|
|
env,
|
|
|
|
config,
|
|
|
|
store,
|
|
|
|
i18n,
|
|
|
|
logs,
|
|
|
|
log(message) {
|
2017-06-20 14:08:52 +02:00
|
|
|
logs.push(message);
|
|
|
|
},
|
2017-06-06 06:21:55 +02:00
|
|
|
};
|
2016-11-22 21:19:08 +01:00
|
|
|
|
2017-06-01 17:02:02 +02:00
|
|
|
window.__ = i18n.__;
|
|
|
|
window.__n = i18n.__n;
|
|
|
|
|
2017-04-07 07:15:22 +02:00
|
|
|
global.app = app;
|
2017-06-01 17:02:02 +02:00
|
|
|
module.exports = app;
|