ee-bin 4.1.2 → 4.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/tools/incrUpdater.js +13 -6
package/package.json
CHANGED
package/tools/incrUpdater.js
CHANGED
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const fs = require('fs');
|
|
5
5
|
const fsPro = require('fs-extra');
|
|
6
|
-
const crypto = require('crypto')
|
|
6
|
+
const crypto = require('crypto');
|
|
7
7
|
const chalk = require('chalk');
|
|
8
8
|
const { loadConfig, getPackage, writeJsonSync } = require('../lib/utils');
|
|
9
|
-
const admZip = require('adm-zip')
|
|
9
|
+
const admZip = require('adm-zip');
|
|
10
|
+
const globby = require('globby');
|
|
11
|
+
|
|
10
12
|
|
|
11
13
|
/**
|
|
12
14
|
* 增量升级
|
|
@@ -83,18 +85,23 @@ class IncrUpdater {
|
|
|
83
85
|
zipName = path.basename(cfg.output.zip, '.zip') + `-${platformForFilename}-${version}.zip`;
|
|
84
86
|
const asarZipPath = path.join(homeDir, cfg.output.directory, zipName);
|
|
85
87
|
if (fs.existsSync(asarZipPath)) {
|
|
86
|
-
|
|
88
|
+
fsPro.removeSync(asarZipPath);
|
|
87
89
|
}
|
|
88
90
|
const zip = new admZip();
|
|
89
91
|
// 添加 asar 文件
|
|
90
92
|
zip.addLocalFile(asarFilePath);
|
|
91
93
|
// 添加 extraResources
|
|
92
94
|
if (cfg.extraResources && cfg.extraResources.length > 0) {
|
|
93
|
-
|
|
95
|
+
const files = globby.sync(cfg.extraResources, { cwd: homeDir });
|
|
96
|
+
for (const extraRes of files) {
|
|
94
97
|
const extraResPath = path.normalize(path.join(homeDir, extraRes));
|
|
95
|
-
if (fs.existsSync(extraResPath)) {
|
|
96
|
-
|
|
98
|
+
if (!fs.existsSync(extraResPath)) {
|
|
99
|
+
continue;
|
|
97
100
|
}
|
|
101
|
+
const extraResDir = path.dirname(extraResPath);
|
|
102
|
+
const index = extraResDir.indexOf('extraResources');
|
|
103
|
+
const zipFileDir = extraResDir.substring(index);
|
|
104
|
+
zip.addLocalFile(extraResPath, zipFileDir);
|
|
98
105
|
}
|
|
99
106
|
}
|
|
100
107
|
|