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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ee-bin",
3
- "version": "4.1.2",
3
+ "version": "4.1.4",
4
4
  "description": "ee bin",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
- rm(asarZipPath);
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
- for (const extraRes of cfg.extraResources) {
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
- zip.addLocalFile(extraResPath, "extraResources");
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