ee-bin 1.8.0 → 1.8.2
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/lib/utils.js +54 -1
- package/package.json +1 -1
- package/tools/incrUpdater.js +1 -1
package/lib/utils.js
CHANGED
|
@@ -7,6 +7,7 @@ const is = require('is-type-of');
|
|
|
7
7
|
const { loadTsConfig } = require('config-file-ts');
|
|
8
8
|
const JsonLib = require('json5');
|
|
9
9
|
const mkdirp = require('mkdirp');
|
|
10
|
+
const OS = require('os');
|
|
10
11
|
|
|
11
12
|
const _basePath = process.cwd();
|
|
12
13
|
|
|
@@ -108,10 +109,30 @@ function compareVersion(v1, v2) {
|
|
|
108
109
|
return 0
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
function isWindows(
|
|
112
|
+
function isWindows() {
|
|
112
113
|
return process.platform === 'win32'
|
|
113
114
|
}
|
|
114
115
|
|
|
116
|
+
function isOSX() {
|
|
117
|
+
return process.platform === 'darwin'
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function isMacOS() {
|
|
121
|
+
return isOSX()
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
function isLinux() {
|
|
125
|
+
return process.platform === 'linux'
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
function isx86() {
|
|
129
|
+
return process.arch === 'ia32'
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function isx64() {
|
|
133
|
+
return process.arch === 'x64'
|
|
134
|
+
}
|
|
135
|
+
|
|
115
136
|
/**
|
|
116
137
|
* Delete a file or folder
|
|
117
138
|
*/
|
|
@@ -160,6 +181,32 @@ function writeJsonSync (filepath, str, options) {
|
|
|
160
181
|
fs.writeFileSync(filepath, str);
|
|
161
182
|
};
|
|
162
183
|
|
|
184
|
+
function getPlatform(delimiter = "_", isDiffArch = false) {
|
|
185
|
+
let os = "";
|
|
186
|
+
if (isWindows()) {
|
|
187
|
+
os = "windows";
|
|
188
|
+
if (isDiffArch) {
|
|
189
|
+
const arch = isx64() ? "64" : "32";
|
|
190
|
+
os += delimiter + arch;
|
|
191
|
+
}
|
|
192
|
+
} else if (isMacOS()) {
|
|
193
|
+
let isAppleSilicon = false;
|
|
194
|
+
const cpus = OS.cpus();
|
|
195
|
+
for (let cpu of cpus) {
|
|
196
|
+
if (cpu.model.includes('Apple')) {
|
|
197
|
+
isAppleSilicon = true;
|
|
198
|
+
break;
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const core = isAppleSilicon? "apple" : "intel";
|
|
202
|
+
os = "macos" + delimiter + core;
|
|
203
|
+
} else if (isLinux()) {
|
|
204
|
+
os = "linux";
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return os;
|
|
208
|
+
}
|
|
209
|
+
|
|
163
210
|
module.exports = {
|
|
164
211
|
loadConfig,
|
|
165
212
|
checkConfig,
|
|
@@ -167,6 +214,12 @@ module.exports = {
|
|
|
167
214
|
getElectronProgram,
|
|
168
215
|
compareVersion,
|
|
169
216
|
isWindows,
|
|
217
|
+
isOSX,
|
|
218
|
+
isMacOS,
|
|
219
|
+
isLinux,
|
|
220
|
+
isx86,
|
|
221
|
+
isx64,
|
|
222
|
+
getPlatform,
|
|
170
223
|
rm,
|
|
171
224
|
getPackage,
|
|
172
225
|
readJsonSync,
|
package/package.json
CHANGED
package/tools/incrUpdater.js
CHANGED
|
@@ -85,7 +85,7 @@ module.exports = {
|
|
|
85
85
|
// 添加 asar 文件
|
|
86
86
|
zip.addLocalFile(asarFilePath);
|
|
87
87
|
// 添加 extraResources
|
|
88
|
-
if (cfg.extraResources.length > 0) {
|
|
88
|
+
if (cfg.extraResources && cfg.extraResources.length > 0) {
|
|
89
89
|
for (const extraRes of cfg.extraResources) {
|
|
90
90
|
const extraResPath = path.normalize(path.join(homeDir, extraRes));
|
|
91
91
|
if (fs.existsSync(extraResPath)) {
|