Commit 391115cb authored by 神楽坂玲奈's avatar 神楽坂玲奈

electron

parent 3e238ff4
// Modules to control application life and create native browser window
const { app, BrowserWindow } = require('electron')
const path = require('path')
function createWindow () {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
// and load the index.html of the app.
mainWindow.loadFile('dist/ci/index.html')
// Open the DevTools.
// mainWindow.webContents.openDevTools()
}
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// 部分 API 在 ready 事件触发后才能使用。
app.whenReady().then(() => {
createWindow()
app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', function () {
if (process.platform !== 'darwin') app.quit()
})
// In this file you can include the rest of your app's specific main process
// code. 也可以拆分成几个文件,然后用 require 导入。
This diff is collapsed.
......@@ -4,12 +4,41 @@
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:angular": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
"test": "ng test",
"build:electron-pack": "electron-builder --dir",
"build:electron-dist": "electron-builder",
"postinstall": "electron-builder install-app-deps",
"build": "npm run build:angular && npm run build:electron-dist"
},
"description": "测试",
"author": "zh99998 <zh99998@gmail.com>",
"main": "main.js",
"build": {
"appId": "your.id",
"mac": {
"category": "your.app.category.type"
},
"files": [
"package.json",
"main.js",
"dist/ci",
"!**/node_modules/*/{CHANGELOG.md,README.md,README,readme.md,readme}",
"!**/node_modules/*/{test,__tests__,tests,powered-test,example,examples}",
"!**/node_modules/*.d.ts",
"!**/node_modules/.bin",
"!**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj}",
"!.editorconfig",
"!**/._*",
"!**/{.DS_Store,.git,.hg,.svn,CVS,RCS,SCCS,.gitignore,.gitattributes}",
"!**/{__pycache__,thumbs.db,.flowconfig,.idea,.vs,.nyc_output}",
"!**/{appveyor.yml,.travis.yml,circle.yml}",
"!**/{npm-debug.log,yarn.lock,.yarn-integrity,.yarn-metadata.json}"
]
},
"private": true,
"dependencies": {
"devDependencies": {
"@angular/animations": "~12.0.4",
"@angular/common": "~12.0.4",
"@angular/compiler": "~12.0.4",
......@@ -18,16 +47,16 @@
"@angular/platform-browser": "~12.0.4",
"@angular/platform-browser-dynamic": "~12.0.4",
"@angular/router": "~12.0.4",
"electron": "^13.1.2",
"rxjs": "~6.6.0",
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"zone.js": "~0.11.4",
"@angular-devkit/build-angular": "~12.0.4",
"@angular/cli": "~12.0.4",
"@angular/compiler-cli": "~12.0.4",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"electron-builder": "^22.11.7",
"jasmine-core": "~3.7.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment