electron is added

This commit is contained in:
병준 박 2019-05-01 23:29:55 +09:00
commit 7fb66f3358
7 changed files with 1675 additions and 0 deletions

13
.editorconfig Normal file
View File

@ -0,0 +1,13 @@
# Editor configuration, see https://editorconfig.org
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
max_line_length = off
trim_trailing_whitespace = false

46
.gitignore vendored Normal file
View File

@ -0,0 +1,46 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out
# dependencies
/node_modules
# profiling files
chrome-profiler-events.json
speed-measure-plugin.json
# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace
# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*
# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
# System Files
.DS_Store
Thumbs.db

14
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,14 @@
{
"editor.tabSize": 2,
"editor.insertSpaces": true,
"editor.formatOnSave": true,
"editor.formatOnPaste": true,
"editor.autoClosingBrackets": "languageDefined",
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
"files.trimFinalNewlines": true,
"git.ignoreLimitWarning": true,
"prettier.singleQuote": true,
"debug.node.autoAttach": "on"
}

1518
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

23
package.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "odds-crawler-desktop",
"version": "0.0.1",
"description": "",
"repository": {
"type": "git",
"url": "https://git.loafle.net/odds_crawler/odds-crawler-desktop.git"
},
"author": "",
"license": "ISC",
"scripts": {
"electron": "tsc --p ./ && electron ."
},
"dependencies": {},
"devDependencies": {
"@types/electron": "^1.6.10",
"electron": "^5.0.0",
"ts-node": "^8.1.0",
"tslint": "^5.16.0",
"typescript": "^3.4.5"
},
"main": "dist/main.js"
}

44
src/main.ts Normal file
View File

@ -0,0 +1,44 @@
import { app, BrowserWindow, ipcMain } from 'electron';
import * as path from 'path';
import * as url from 'url';
import * as fs from 'fs';
let win: BrowserWindow;
app.on('ready', createWindow);
app.on('activate', () => {
if (win === null) {
createWindow();
}
});
function createWindow() {
win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: { nodeIntegration: true }
});
win.loadURL(
url.format({
pathname: path.join(
__dirname,
`../../dist/odds-crawler-frontend-app/index.html`
),
protocol: 'file:',
slashes: true
})
);
win.webContents.openDevTools();
win.on('closed', () => {
win = null;
});
}
ipcMain.on('getFiles', (event, arg) => {
const files = fs.readdirSync(__dirname);
win.webContents.send('getFilesResponse', files);
});

17
tsconfig.json Normal file
View File

@ -0,0 +1,17 @@
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist",
"sourceMap": true,
"declaration": false,
"module": "commonjs",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"]
}
}