[feat] [ee-bin] fix updater

This commit is contained in:
gaoshuaixing
2025-02-28 15:54:42 +08:00
parent a619f4912d
commit 4d5c5f6784
2 changed files with 13 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "ee-bin",
"version": "4.1.3",
"version": "4.1.4",
"description": "ee bin",
"main": "index.js",
"scripts": {

View File

@@ -3,10 +3,12 @@
const path = require('path');
const fs = require('fs');
const fsPro = require('fs-extra');
const crypto = require('crypto')
const crypto = require('crypto');
const chalk = require('chalk');
const { loadConfig, getPackage, writeJsonSync } = require('../lib/utils');
const admZip = require('adm-zip')
const admZip = require('adm-zip');
const globby = require('globby');
/**
* 增量升级
@@ -90,11 +92,16 @@ class IncrUpdater {
zip.addLocalFile(asarFilePath);
// 添加 extraResources
if (cfg.extraResources && cfg.extraResources.length > 0) {
for (const extraRes of cfg.extraResources) {
const files = globby.sync(cfg.extraResources, { cwd: homeDir });
for (const extraRes of files) {
const extraResPath = path.normalize(path.join(homeDir, extraRes));
if (fs.existsSync(extraResPath)) {
zip.addLocalFile(extraResPath, "extraResources");
if (!fs.existsSync(extraResPath)) {
continue;
}
const extraResDir = path.dirname(extraResPath);
const index = extraResDir.indexOf('extraResources');
const zipFileDir = extraResDir.substring(index);
zip.addLocalFile(extraResPath, zipFileDir);
}
}