Production

This commit is contained in:
portree_kid 2020-03-05 13:05:32 +01:00
parent 0bee135572
commit d101d57a5c
18 changed files with 46 additions and 25 deletions

View File

@ -1,4 +0,0 @@
{
"type": "FeatureCollection",
"features": []
}

File diff suppressed because one or more lines are too long

View File

View File

@ -27,6 +27,15 @@
"directories": { "directories": {
"output": "build" "output": "build"
}, },
"asar": "true",
"extraResources": [
{
"from": "src/renderer/utils",
"to": "workers",
"filter": [
"**/*"
]
}],
"files": [ "files": [
"dist/electron/**/*" "dist/electron/**/*"
], ],

View File

@ -29,7 +29,11 @@ function createWindow () {
width: 1000 width: 1000
}) })
mainWindow.loadURL(winURL) mainWindow.loadURL(winURL)
mainWindow.webContents.openDevTools()
mainWindow.onerror = function (message, source, lineno, colno, error) {
console.error(error)
}
mainWindow.on('closed', () => { mainWindow.on('closed', () => {
mainWindow = null mainWindow = null
}) })

View File

@ -102,7 +102,7 @@
const winURL = process.env.NODE_ENV === 'development' const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/src/renderer/utils/check.js` ? `http://localhost:9080/src/renderer/utils/check.js`
: `file://${__dirname}/check.js` : `file://${__dirname}/check.js`
console.log('make a worker: ', path.resolve(__dirname, 'check.js')) console.log('make a check worker: ', path.resolve(__dirname, 'check.js'))
const worker = new Worker(winURL) const worker = new Worker(winURL)
console.log(fileUrl('src/renderer/utils/check.js')) console.log(fileUrl('src/renderer/utils/check.js'))

View File

@ -19,11 +19,13 @@
components: {}, components: {},
props: [], props: [],
created () { created () {
console.log(LMap) console.log(LMap)
console.log(LMarker) console.log(LMarker)
console.log(L) console.log(L)
console.log(LEdit) console.log(LEdit)
console.log(L2) console.log(L2)
console.log('Created Editlayer')
// console.log(LSymbol) // console.log(LSymbol)
}, },
mounted () { mounted () {

View File

@ -66,7 +66,7 @@
this.scanning = true this.scanning = true
const winURL = process.env.NODE_ENV === 'development' const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/src/renderer/utils/worker.js` ? `http://localhost:9080/src/renderer/utils/worker.js`
: `file://${__dirname}/worker.js` : `file://${process.resourcesPath}/workers/worker.js`
console.log('make a worker: ', path.resolve(__dirname, 'worker.js')) console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
const worker = new Worker(winURL) const worker = new Worker(winURL)
@ -112,7 +112,7 @@
this.scanning = true this.scanning = true
const winURL = process.env.NODE_ENV === 'development' const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/src/renderer/utils/worker.js` ? `http://localhost:9080/src/renderer/utils/worker.js`
: `file://${__dirname}/worker.js` : `file://${process.resourcesPath}/workers/worker.js`
console.log('make a worker: ', path.resolve(__dirname, 'worker.js')) console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
const worker = new Worker(winURL) const worker = new Worker(winURL)
@ -160,7 +160,7 @@
this.scanning = true this.scanning = true
const winURL = process.env.NODE_ENV === 'development' const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/src/renderer/utils/worker.js` ? `http://localhost:9080/src/renderer/utils/worker.js`
: `file://${__dirname}/worker.js` : `file://${process.resourcesPath}/workers/worker.js`
console.log('make a worker: ', path.resolve(__dirname, 'worker.js')) console.log('make a worker: ', path.resolve(__dirname, 'worker.js'))
const worker = new Worker(winURL) const worker = new Worker(winURL)

View File

@ -1,6 +1,6 @@
/* eslint-disable */ /* eslint-disable */
const DB_NAME = 'flightgear'; const DB_NAME = 'flightgear';
const DB_VERSION = 2; const DB_VERSION = 3;
let DB; let DB;
export default { export default {
@ -19,6 +19,7 @@ export default {
request.onsuccess = e => { request.onsuccess = e => {
DB = e.target.result; DB = e.target.result;
console.log('OPENED DB', DB);
resolve(DB); resolve(DB);
}; };

View File

@ -12,5 +12,5 @@ const debug = process.env.NODE_ENV !== 'production'
export default new Vuex.Store({ export default new Vuex.Store({
modules, modules,
strict: debug, strict: debug,
plugins: debug ? [createLogger(), createPersistedState({paths: ['Settings']})] : [] // set logger only for development plugins: debug ? [createLogger(), createPersistedState({paths: ['Settings']})] : [createPersistedState({paths: ['Settings']})] // set logger only for development
}) })

View File

@ -33,17 +33,25 @@ const actions = {
await idb.deleteAirport(airport); await idb.deleteAirport(airport);
}, },
async getAirports(context) { async getAirports(context) {
try {
context.commit(RESET_AIRPORTS); context.commit(RESET_AIRPORTS);
let airports = await idb.getAirports(); let airports = await idb.getAirports();
context.commit(SET_AIRPORTS, airports context.commit(SET_AIRPORTS, airports
.filter(point => typeof point.geometry.coordinates !== "undefined" ) .filter(point => typeof point.geometry.coordinates !== "undefined" )
.filter(point => point.properties.flights > 0 )); .filter(point => point.properties.flights > 0 ));
} catch (error) {
console.error(error);
}
}, },
async getAirportsUnfiltered(context) { async getAirportsUnfiltered(context) {
try {
context.commit(RESET_AIRPORTS); context.commit(RESET_AIRPORTS);
let airports = await idb.getAirports(); let airports = await idb.getAirports();
context.commit(SET_UNFILTERED_AIRPORTS, airports context.commit(SET_UNFILTERED_AIRPORTS, airports
.filter(point => typeof point.geometry.coordinates !== "undefined" )); .filter(point => typeof point.geometry.coordinates !== "undefined" ));
} catch (error) {
console.error(error);
}
}, },
async saveAirport(context, airport) { async saveAirport(context, airport) {
await idb.saveAirport(airport); await idb.saveAirport(airport);

View File

@ -8,6 +8,7 @@ const modules = {}
files.keys().forEach(key => { files.keys().forEach(key => {
if (key === './index.js') return if (key === './index.js') return
console.log('Vuex Module : ' + key.replace(/(\.\/|\.js)/g, ''))
modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default modules[key.replace(/(\.\/|\.js)/g, '')] = files(key).default
}) })

View File

@ -8,7 +8,7 @@ async function initDB() {
if (features == null) { if (features == null) {
console.log("Loading DB"); console.log("Loading DB");
console.log(this.indexedDB); console.log(this.indexedDB);
var request = this.indexedDB.open("flightgear", 2); var request = this.indexedDB.open("flightgear", 3);
request.onerror = function (event) { request.onerror = function (event) {
reject(event); reject(event);
}; };
@ -26,7 +26,7 @@ async function initDB() {
var objectStore = db.createObjectStore("airports", { keyPath: "properties.icao" }); var objectStore = db.createObjectStore("airports", { keyPath: "properties.icao" });
} }
if (event.oldVersion < 2) { if (event.oldVersion < 2) {
// Version 1 is the first version of the database. // Version 2 is the first version of the database.
var objectStore = event.target.transaction.objectStore("airports"); var objectStore = event.target.transaction.objectStore("airports");
var indexNames = objectStore.indexNames; var indexNames = objectStore.indexNames;
var desiredKeyPathForMyIndex = "properties.icao"; var desiredKeyPathForMyIndex = "properties.icao";

View File

@ -64,6 +64,7 @@ async function scanGroundnetFiles(p, features) {
}).catch(reason => { }).catch(reason => {
logger('info', "Crashed"); logger('info', "Crashed");
logger('info', reason); logger('info', reason);
this.postMessage('DONE');
}); });
//walkDir(p, f => { readGroundnet(f, features) }); //walkDir(p, f => { readGroundnet(f, features) });

View File

@ -1,7 +1,7 @@
/* eslint-disable */ /* eslint-disable */
const winURL = process.env.NODE_ENV === 'development' const winURL = process.env.NODE_ENV === 'development'
? `http://localhost:9080/src/renderer/utils/` ? `http://localhost:9080/src/renderer/utils/`
: `file://D:/GIT/flightgear-airports/src/renderer/utils/` : `file://${process.resourcesPath}/workers/`
var scanner = importScripts(`${winURL}scan.js`); var scanner = importScripts(`${winURL}scan.js`);
var apt = importScripts(`${winURL}apt.js`); var apt = importScripts(`${winURL}apt.js`);
@ -9,7 +9,7 @@ var path = require('path');
const fs = require('fs'); const fs = require('fs');
const homedir = require('os').homedir(); const homedir = require('os').homedir();
var airports = importScripts(`${winURL}airports.js`); var airports = importScripts(`${winURL}airports.js`);
importScripts('../txml/tXml.min.js'); importScripts(`${winURL}txml/tXml.min.js`);
importScripts('logger.js'); importScripts('logger.js');