sqlite added

This commit is contained in:
crusader 2018-09-05 17:18:33 +09:00
parent 4c04ca5132
commit f01ecf72fe
4 changed files with 39 additions and 5 deletions

BIN
_database.sqlite Normal file

Binary file not shown.

View File

@ -11,12 +11,14 @@
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"wait-on:build:main:dev": "wait-on http-get://localhost:4200/ && yarn build:main:dev"
"wait-on:build:main:dev": "wait-on http-get://localhost:4200/ && yarn build:main:dev",
"postinstall": "electron-builder install-app-deps"
},
"private": true,
"dependencies": {
"electron-devtools-installer": "^2.2.4",
"rxjs": "^6.2.2"
"rxjs": "^6.2.2",
"sqlite3": "^4.0.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.7.0",
@ -44,6 +46,7 @@
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^8.10.4",
"@types/sqlite3": "^3.1.3",
"awesome-typescript-loader": "^5.2.0",
"codelyzer": "~4.2.1",
"core-js": "^2.5.4",

View File

@ -1,5 +1,6 @@
import { app, Menu, ipcMain, BrowserWindow, shell } from 'electron';
import * as Fs from 'fs';
import * as fse from 'fs-extra';
import * as path from 'path';
import { shellNeedsPatching, updateEnvironmentForProcess } from '@overflow/core/shell';
import { parseAppURL } from '@overflow/core/parse-app-url';
@ -20,6 +21,8 @@ import { MenuEvent } from '../commons/type';
import { findMenuItemByID } from './menu/find-menu-item';
import { IMenuItemState } from '../commons/model/menu-update';
import * as sqlite3 from 'sqlite3';
enableSourceMaps();
let mainWindow: AppWindow | null = null;
@ -178,6 +181,15 @@ app.on('ready', () => {
return;
}
const dbPath = path.join(__dirname, '..', '..', '_database.sqlite');
const db = new sqlite3.Database(dbPath, sqlite3.OPEN_READONLY, (err: Error) => {
if (err) {
console.error(err.message);
}
console.log('Connected to the database.');
});
readyTime = now() - launchTime;
// setAsDefaultProtocolClient('x-github-client');

View File

@ -247,6 +247,10 @@
semver "^5.3.0"
semver-intersect "^1.1.2"
"@types/events@*":
version "1.2.0"
resolved "https://nexus.loafle.net/repository/npm-all/@types/events/-/events-1.2.0.tgz#81a6731ce4df43619e5c8c945383b3e62a89ea86"
"@types/fs-extra@^5.0.4":
version "5.0.4"
resolved "https://nexus.loafle.net/repository/npm-all/@types/fs-extra/-/fs-extra-5.0.4.tgz#b971134d162cc0497d221adde3dbb67502225599"
@ -291,6 +295,13 @@
version "2.53.43"
resolved "https://nexus.loafle.net/repository/npm-all/@types/selenium-webdriver/-/selenium-webdriver-2.53.43.tgz#2de3d718819bc20165754c4a59afb7e9833f6707"
"@types/sqlite3@^3.1.3":
version "3.1.3"
resolved "https://nexus.loafle.net/repository/npm-all/@types/sqlite3/-/sqlite3-3.1.3.tgz#580d547203b8ad6e11aa6a6769c8ca5d7e197d13"
dependencies:
"@types/events" "*"
"@types/node" "*"
"@webassemblyjs/ast@1.4.3":
version "1.4.3"
resolved "https://nexus.loafle.net/repository/npm-all/@webassemblyjs/ast/-/ast-1.4.3.tgz#3b3f6fced944d8660273347533e6d4d315b5934a"
@ -4615,7 +4626,7 @@ mute-stream@0.0.7:
version "0.0.7"
resolved "https://nexus.loafle.net/repository/npm-all/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab"
nan@^2.10.0, nan@^2.9.2:
nan@^2.10.0, nan@^2.9.2, nan@~2.10.0:
version "2.10.0"
resolved "https://nexus.loafle.net/repository/npm-all/nan/-/nan-2.10.0.tgz#96d0cd610ebd58d4b4de9cc0c6828cda99c7548f"
@ -4720,7 +4731,7 @@ node-libs-browser@^2.0.0:
util "^0.10.3"
vm-browserify "0.0.4"
node-pre-gyp@^0.10.0:
node-pre-gyp@^0.10.0, node-pre-gyp@^0.10.3:
version "0.10.3"
resolved "https://nexus.loafle.net/repository/npm-all/node-pre-gyp/-/node-pre-gyp-0.10.3.tgz#3070040716afdc778747b61b6887bf78880b80fc"
dependencies:
@ -6433,6 +6444,14 @@ sprintf-js@~1.0.2:
version "1.0.3"
resolved "https://nexus.loafle.net/repository/npm-all/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
sqlite3@^4.0.2:
version "4.0.2"
resolved "https://nexus.loafle.net/repository/npm-all/sqlite3/-/sqlite3-4.0.2.tgz#1bbeb68b03ead5d499e42a3a1b140064791c5a64"
dependencies:
nan "~2.10.0"
node-pre-gyp "^0.10.3"
request "^2.87.0"
sshpk@^1.7.0:
version "1.14.2"
resolved "https://nexus.loafle.net/repository/npm-all/sshpk/-/sshpk-1.14.2.tgz#c6fc61648a3d9c4e764fd3fcdf4ea105e492ba98"