From f01ecf72feb5e4d4a98a2fefbf14da37c048bef9 Mon Sep 17 00:00:00 2001 From: crusader Date: Wed, 5 Sep 2018 17:18:33 +0900 Subject: [PATCH] sqlite added --- _database.sqlite | Bin 0 -> 6144 bytes package.json | 7 +++++-- src/electron/main.ts | 14 +++++++++++++- yarn.lock | 23 +++++++++++++++++++++-- 4 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 _database.sqlite diff --git a/_database.sqlite b/_database.sqlite new file mode 100644 index 0000000000000000000000000000000000000000..79a5b2472bbe7543ca90e68a1b61470e65a2fe99 GIT binary patch literal 6144 zcmeH~PixyS6u>3RcIQCYpJH?v8M-Z@rZ9FagSy2l-dwj$ZD>x3w`e0Qv8nB_<+y%^ zeV=`gU3)Anx1RT;IE6TnU3SX!%#&n2KgsWhgq|)hf>FuYr!1c&C3}r@gfTi~3?XDz zN}$$24Nx6)DR|k~P@8BUUp2{7MDQ)re&Sp0hj=!4DAT_t@O@w3p_JmAgEILr=5fLE zLKenx*K;F}Meb4HG1$31HVqqKv?7Zury4@ao@Aa4)M`wNr-ltv| zu{iWEV$Wf3M|n|($%M1Wy8^Gu(_ukU_16b=nERQpP1WfbCVfLO8l^-2t+*b;0_`W$ zGL!Fp`Jeq)vNF$!N%!_}PexXKTJY;BPe1b7tG*I#&Dc)iza8-G0R1_&ZG5vBQ%oaN zTk#%}v9x{1Qziihv@p1q61VX$E>u@#S>FXES~>P5G?#1RDrWf+)#HUu4gVDpGNl zi!)w{BA^ItJpqGYtZ9T;R+HQ#Ozsf5gF=ZSpa^U$0ZStk%WIQ3=^L`CJ>>s$GT+v~ zRa}a|RukBTw7x}gz_T>ThuKk{eN9DXZ`bpG^cXG$HpTCflpkl=c-CqNFyj7y4~c*h QML-ew4+t#se+X3n1GhxezW@LL literal 0 HcmV?d00001 diff --git a/package.json b/package.json index a0a8433..a3d58fe 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/electron/main.ts b/src/electron/main.ts index 5331900..8686898 100644 --- a/src/electron/main.ts +++ b/src/electron/main.ts @@ -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'); diff --git a/yarn.lock b/yarn.lock index 524f427..9d55192 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"