Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ module.exports = {
"imports": "always-multiline",
"exports": "always-multiline",
"functions": "ignore"
}],
"import/no-extraneous-dependencies": [2, {
"devDependencies": true
}]
},
"env": {
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ node_modules
/coverage

# production
/build
build
dist

# misc
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@
"test": "lerna run test",
"start:react": "cd packages/react-app && yarn start",
"start:electron": "cd packages/electron-app && yarn start",
"start": "concurrently \"yarn run start:react\" \"wait-on http://localhost:3000 && yarn run start:electron\"",
"start": "NODE_ENV=development concurrently \"yarn run start:react\" \"wait-on http://localhost:3000 && yarn run start:electron\"",
"pack": "lerna run --scope neuron pack",
"dist": "lerna run --scope neuron dist",
"precommit": "lint-staged"
},
"lint-staged": {
Expand Down
19 changes: 17 additions & 2 deletions packages/electron-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,34 @@
"email": "dev@nervos.org",
"url": "https://github.com/nervosnetwork/neuron"
},
"main": "./dist/main.js",
"license": "MIT",
"scripts": {
"build": "tsc",
"watch": "tsc -w",
"lint": "tslint -p .",
"start": "yarn run build && electron ./dist/main.js"
"start": "yarn run build && electron .",
"pack": "electron-builder --dir",
"dist": "electron-builder"
},
"build": {
"appId": "nervos_dev",
"mac": {
"category": "blockchain_wallet"
},
"files": [
"./dist/**/*",
"node_modules"
],
"asar": true
},
"dependencies": {
"electron": "^4.0.1",
"neuron-react-app": "0.1.0"
},
"devDependencies": {
"@types/electron": "^1.6.10",
"electron": "^4.0.1",
"electron-builder": "^20.38.5",
"tslint": "^5.12.1"
}
}
10 changes: 10 additions & 0 deletions packages/electron-app/src/enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/* eslint-disable no-unused-vars */
export enum PAGE {
DEV = 'http://localhost:3000',
PROD = 'file://../node_modules/neuron-react-app/build/index.html',
}
/* eslint-enable no-unused-vars */

export default {
PAGE,
}
8 changes: 7 additions & 1 deletion packages/electron-app/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
// Modules to control application life and create native browser window
import { app, BrowserWindow } from 'electron'
import { PAGE } from './enum'

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
let mainWindow: Electron.BrowserWindow | null
const { NODE_ENV } = process.env

function createWindow() {
// Create the browser window.
mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon: `${__dirname}/../AppIcon.icns`,
webPreferences: {
devTools: NODE_ENV === 'development',
},
})

mainWindow.loadURL('http://localhost:3000')
mainWindow.loadURL(NODE_ENV === 'development' ? PAGE.DEV : PAGE.PROD)
mainWindow.webContents.openDevTools()

// Open the DevTools.
// mainWindow.webContents.openDevTools()
Expand Down
1 change: 1 addition & 0 deletions packages/react-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"email": "dev@nervos.org",
"url": "https://github.com/nervosnetwork/neuron"
},
"homepage": "./",
"license": "MIT",
"scripts": {
"start": "BROWSER=none react-app-rewired start",
Expand Down
Loading