Commit 43bb4f20 authored by 神楽坂玲奈's avatar 神楽坂玲奈

aot,更新

parent e3443dfb
import {MyCardNgFactory} from "../aot/app/mycard.module.ngfactory";
import {getTranslationProviders} from "./i18n-providers";
import {enableProdMode} from "@angular/core";
import {platformBrowser} from "@angular/platform-browser";
enableProdMode();
getTranslationProviders().then(providers => {
const options = {providers};
platformBrowser().bootstrapModuleFactory(MyCardNgFactory);
});
import {platformBrowserDynamic} from "@angular/platform-browser-dynamic";
import {getTranslationProviders} from "./i18n-providers";
import {MyCard} from "./mycard.module";
//enableProdMode();
getTranslationProviders().then(providers => {
const options = {providers};
platformBrowserDynamic().bootstrapModule(MyCard, options);
......
......@@ -94,9 +94,13 @@ autoUpdater.on('update-downloaded', (event) => {
console.log('autoUpdater', 'update-downloaded', event);
updateWindow = new BrowserWindow({
width: 640,
height: 480,
height: 360,
});
updateWindow.loadURL(`file://${__dirname}/update.html`);
updateWindow.webContents.on('new-window', function (e, url) {
e.preventDefault();
shell.openExternal(url);
});
updateWindow.on('closed', function () {
updateWindow = null
});
......@@ -174,8 +178,8 @@ function createTray() {
// {label: '切换账号', type: 'normal', click: (menuItem, browserWindow, event)=>{}},
{
label: '显示主界面', type: 'normal', click: () => {
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
}
mainWindow.isVisible() ? mainWindow.hide() : mainWindow.show();
}
},
{
label: '退出', type: 'normal', click: app.quit
......
......@@ -11,6 +11,7 @@
"start": "tsc && electron .",
"pack": "tsc && build --dir",
"dist": "tsc && build",
"build:aot": "ngc -p tsconfig-aot.json && rollup -c rollup-config.js",
"tsc": "tsc",
"i18n": "ng-xi18n && sed -i.bak 's/source-language=\"en\"/source-language=\"zh-CN\"/' messages.xlf"
},
......@@ -45,13 +46,17 @@
"devDependencies": {
"@angular/compiler-cli": "latest",
"@angular/platform-server": "latest",
"@types/electron": "latest",
"@types/ini": "latest",
"@types/node": "latest",
"electron": "latest",
"electron-builder": "latest",
"electron-rebuild": "latest",
"typescript": "latest",
"@types/node": "latest",
"@types/electron": "latest",
"@types/ini": "latest"
"rollup": "latest",
"rollup-plugin-commonjs": "latest",
"rollup-plugin-node-resolve": "latest",
"rollup-plugin-uglify": "latest",
"typescript": "latest"
},
"build": {
"productName": "MyCard",
......
import rollup from 'rollup'
import nodeResolve from 'rollup-plugin-node-resolve'
import commonjs from 'rollup-plugin-commonjs';
import uglify from 'rollup-plugin-uglify'
//paths are relative to the execution path
export default {
entry: 'app/main-aot.js',
dest: 'aot/dist/build.js', // output a single application bundle
sourceMap: true,
sourceMapFile: 'aot/dist/build.js.map',
format: 'iife',
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: ['node_modules/rxjs/**']
}),
uglify()
]
}
{
"compilerOptions": {
"target": "es6",
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"es2017",
"dom"
],
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"strictNullChecks": true,
"skipLibCheck": true
},
"files": [
"app/mycard.module.ts",
"app/main.ts"
],
"angularCompilerOptions": {
"genDir": "aot",
"skipMetadataEmit" : true
}
}
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>更新</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<!--<meta name="description" content="">-->
<!--<meta name="author" content="">-->
<!--<link rel="icon" href="../../favicon.ico">-->
<title>更新消息</title>
<!-- Bootstrap core CSS -->
<link href="node_modules/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<style>
h1{
margin-top: 10px;
margin-bottom: 20px;
text-align: center;
}
#actions {
margin-top: 20px;
text-align: center;
}
</style>
</head>
<body>
有新版本,点击更新
<button id="update">更新</button>
如果自动更新失败,请至 https://mycard.moe 手动下载最新版本
<div class="container">
<h1>MyCard 更新下载完毕</h1>
<p>点击【现在安装更新】,会立即关闭 MyCard 平台及正在运行中的游戏,并安装更新。</p>
<p>点击【下次启动时安装更新】,会在 MyCard 平台退出之后进行更新。</p>
<p>你也可以随时点击平台上的更新按钮安装哦!</p>
<p>如果自动更新失败,请至 <a href="https://mycard.moe" target="_blank">https://mycard.moe</a> 手动下载最新版本"</p>
<p id="actions">
<button id="update" type="button" class="btn btn-secondary">下次启动时安装更新 _(:3 」∠)_</button>
<button id="close" type="button" class="btn btn-primary">(。・`ω´・) 现在安装更新</button>
</p>
</div><!-- /.container -->
<script>
const {ipcRenderer} = require('electron');
document.getElementById('update').addEventListener('click', ()=> {
document.getElementById('update').addEventListener('click', () => {
ipcRenderer.send('update');
})
});
document.getElementById('close').addEventListener('click', () => {
window.close()
});
</script>
</body>
</html>
\ No newline at end of file
</html>
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