build
This commit is contained in:
16
b2f.js
Normal file
16
b2f.js
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import fs from "node:fs";
|
||||||
|
|
||||||
|
const args = process.argv.slice(2);
|
||||||
|
|
||||||
|
if (args.length !== 1) {
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (args[0]) {
|
||||||
|
case "b2f": //backend to frontend
|
||||||
|
fs.renameSync("./backend/dist/core.exe", "./front/src-tauri/binaries/core-x86_64-pc-windows-msvc.exe") //后端文件复制
|
||||||
|
break;
|
||||||
|
case "b2r": //build to root
|
||||||
|
fs.renameSync("./front/src-tauri/target/release/bundle/nsis/DeEarthX-V3_0.1.0_x64-setup.exe","./DeEarthX-V3_x64-setup.exe")
|
||||||
|
break;
|
||||||
|
}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "tsc&&node dist/main.js",
|
"test": "tsc&&node dist/main.js",
|
||||||
"rollup": "rollup -c rollup.config.js",
|
"rollup": "rollup -c rollup.config.js",
|
||||||
"nexe": "nexe -i ./dist/bundle.js --build -t x86-22.13.0 --output ./dist/core-x86_64-pc-windows-msvc.exe",
|
"nexe": "nexe -i ./dist/bundle.js --build -t x86-22.13.0 --output ./dist/core.exe",
|
||||||
"build": "npm run rollup && npm run nexe"
|
"build": "npm run rollup && npm run nexe"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -22,39 +22,52 @@ export class Dex {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Main(buffer: Buffer, dser: boolean) {
|
public async Main(buffer: Buffer, dser: boolean) {
|
||||||
|
try{
|
||||||
const first = Date.now();
|
const first = Date.now();
|
||||||
const info = await this._getinfo(buffer);
|
const info = await this._getinfo(buffer).catch((e)=>{
|
||||||
|
throw new Error(e)
|
||||||
|
});
|
||||||
const plat = what_platform(info);
|
const plat = what_platform(info);
|
||||||
const mpname = this.in.name;
|
const mpname = this.in.name;
|
||||||
const unpath = `./instance/${mpname}`;
|
const unpath = `./instance/${mpname}`;
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
this._unzip(buffer, mpname),
|
this._unzip(buffer, mpname),
|
||||||
await platform(plat).downloadfile(this.in, unpath, this.ws),
|
await platform(plat).downloadfile(this.in, unpath, this.ws),
|
||||||
]); // 解压和下载
|
]).catch((e) => {
|
||||||
|
throw new Error(e)
|
||||||
|
}); // 解压和下载
|
||||||
this.ws.send(
|
this.ws.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
status: "changed",
|
status: "changed",
|
||||||
result: undefined,
|
result: undefined,
|
||||||
})
|
})
|
||||||
); //改变状态
|
); //改变状态
|
||||||
await new DeEarth(`${unpath}/mods`, `./.rubbish/${mpname}`).Main();
|
await new DeEarth(`${unpath}/mods`, `./.rubbish/${mpname}`).Main().catch((e) => {
|
||||||
|
throw new Error(e)
|
||||||
|
});
|
||||||
this.ws.send(
|
this.ws.send(
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
status: "changed",
|
status: "changed",
|
||||||
result: undefined,
|
result: undefined,
|
||||||
})
|
})
|
||||||
); //改变状态(DeEarth筛选模组完毕)
|
); //改变状态(DeEarth筛选模组完毕)
|
||||||
const mlinfo = await platform(plat).getinfo(this.in);
|
const mlinfo = await platform(plat).getinfo(this.in).catch((e)=>{
|
||||||
|
throw new Error(e)
|
||||||
|
});
|
||||||
if (dser) {
|
if (dser) {
|
||||||
await mlsetup(
|
await mlsetup(
|
||||||
mlinfo.loader,
|
mlinfo.loader,
|
||||||
mlinfo.minecraft,
|
mlinfo.minecraft,
|
||||||
mlinfo.loader_version,
|
mlinfo.loader_version,
|
||||||
unpath
|
unpath
|
||||||
); //安装服务端
|
).catch((e) => {
|
||||||
|
throw new Error(e)
|
||||||
|
}); //安装服务端
|
||||||
}
|
}
|
||||||
if (!dser) {
|
if (!dser) {
|
||||||
dinstall(mlinfo.loader, mlinfo.minecraft, mlinfo.loader_version, unpath);
|
dinstall(mlinfo.loader, mlinfo.minecraft, mlinfo.loader_version, unpath).catch((e) => {
|
||||||
|
throw new Error(e)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
const latest = Date.now();
|
const latest = Date.now();
|
||||||
this.ws.send(
|
this.ws.send(
|
||||||
@@ -64,9 +77,20 @@ export class Dex {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
if (config.oaf) {
|
if (config.oaf) {
|
||||||
await execPromise(`start ${p.join("./instance")}`);
|
await execPromise(`start ${p.join("./instance")}`).catch((e) => {
|
||||||
|
throw new Error(e)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
//await this._unzip(buffer);
|
//await this._unzip(buffer);
|
||||||
|
}catch(e){
|
||||||
|
const err = e as Error
|
||||||
|
this.ws.send(
|
||||||
|
JSON.stringify({
|
||||||
|
status: "error",
|
||||||
|
result: err.message,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _getinfo(buffer: Buffer) {
|
private async _getinfo(buffer: Buffer) {
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" setup>
|
<script lang="ts" setup>
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { InboxOutlined } from '@ant-design/icons-vue';
|
import { InboxOutlined } from '@ant-design/icons-vue';
|
||||||
import { message, StepsProps } from 'ant-design-vue';
|
import { message, notification, StepsProps } from 'ant-design-vue';
|
||||||
import type { UploadFile, UploadChangeParam } from 'ant-design-vue';
|
import type { UploadFile, UploadChangeParam } from 'ant-design-vue';
|
||||||
import {sendNotification,} from '@tauri-apps/plugin-notification';
|
import {sendNotification,} from '@tauri-apps/plugin-notification';
|
||||||
import { SelectProps } from 'ant-design-vue/es/vc-select';
|
import { SelectProps } from 'ant-design-vue/es/vc-select';
|
||||||
@@ -130,6 +130,12 @@ function prews(){
|
|||||||
reactFL()
|
reactFL()
|
||||||
},8*1000)
|
},8*1000)
|
||||||
}
|
}
|
||||||
|
if (_data.status === "error"){
|
||||||
|
notification.error({
|
||||||
|
message: "DeEarth.X.Core 遇到了一个致命错误!",
|
||||||
|
description:_data.result
|
||||||
|
})
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,8 +12,10 @@
|
|||||||
"main": "./.build/build.js",
|
"main": "./.build/build.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"backend":"cd ./backend && npm run build",
|
"backend":"cd ./backend && npm run build",
|
||||||
"upx":".\\.build\\upx.exe .\\backend\\dist\\Dex-v3-core.exe",
|
"upx":".\\.build\\upx.exe .\\backend\\dist\\core.exe",
|
||||||
"tauri":"cd ./front && npm run tauri build",
|
"tauri":"cd ./front && npm run tauri build",
|
||||||
"build":"npm run tauri && npm run backend && npm run upx"
|
"back2front":"node b2f.js b2f",
|
||||||
|
"build2root":"node b2f.js b2r",
|
||||||
|
"build":"npm run backend && npm run upx && npm run back2front && npm run tauri && npm run build2root"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user