@vscode/gulp-electron 1.37.1 → 1.38.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vscode/gulp-electron",
3
- "version": "1.37.1",
3
+ "version": "1.38.2",
4
4
  "description": "gulp plugin for packaging Electron into VS Code",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -29,7 +29,7 @@
29
29
  "homepage": "https://github.com/microsoft/vscode-gulp-electron",
30
30
  "dependencies": {
31
31
  "@electron/get": "^4.0.1",
32
- "@octokit/rest": "^18.0.14",
32
+ "@octokit/rest": "^22.0.0",
33
33
  "event-stream": "3.3.4",
34
34
  "gulp-filter": "^5.1.0",
35
35
  "gulp-rename": "1.2.2",
package/src/darwin.js CHANGED
@@ -226,11 +226,9 @@ function patchHelperInfoPlist(opts) {
226
226
  var input = es.through();
227
227
  var output = input.pipe(
228
228
  es.map(function (f, cb) {
229
- if (
230
- !/Contents\/Frameworks\/Electron\ Helper( \w+)?\.app\/Contents\/Info.plist$/i.test(
231
- f.relative
232
- )
233
- ) {
229
+ const match = /Contents\/Frameworks\/Electron\ Helper( \(\w+\))?\.app\/Contents\/Info.plist$/i.exec(
230
+ f.relative);
231
+ if (!match) {
234
232
  return cb(null, f);
235
233
  }
236
234
 
@@ -246,24 +244,14 @@ function patchHelperInfoPlist(opts) {
246
244
 
247
245
  f.contents.on("end", function () {
248
246
  var infoPlist = plist.parse(contents.toString("utf8"));
249
- var match = /\.helper\.([^.]+)$/.exec(
250
- infoPlist["CFBundleIdentifier"] || ""
251
- );
252
- var suffix = match ? match[1] : "";
247
+ var suffix = match[1] ?? "";
253
248
 
254
249
  if (opts.darwinBundleIdentifier) {
255
250
  infoPlist["CFBundleIdentifier"] =
256
251
  opts.darwinBundleIdentifier + ".helper";
257
-
258
- if (suffix) {
259
- infoPlist["CFBundleIdentifier"] += "." + suffix;
260
- }
261
252
  }
262
253
 
263
- infoPlist["CFBundleName"] = opts.productName + " Helper";
264
- if (suffix) {
265
- infoPlist["CFBundleName"] += " " + suffix;
266
- }
254
+ infoPlist["CFBundleName"] = `${opts.productName} Helper${suffix}`;
267
255
 
268
256
  if (infoPlist["CFBundleDisplayName"]) {
269
257
  infoPlist["CFBundleDisplayName"] = infoPlist["CFBundleName"];
package/src/win32.js CHANGED
@@ -51,7 +51,13 @@ function getSignTool() {
51
51
  }
52
52
 
53
53
  exports.getAppPath = function (opts) {
54
- return "resources/app";
54
+ if (opts.createVersionedResources) {
55
+ if (!opts.productVersionString) {
56
+ throw new Error("productVersionString must be defined.");
57
+ }
58
+ return path.join(opts.productVersionString, "resources", "app");
59
+ }
60
+ return path.join("resources", "app");
55
61
  };
56
62
 
57
63
  function patchExecutable(opts) {
@@ -77,6 +83,15 @@ function patchExecutable(opts) {
77
83
  "product-version": opts.productVersion,
78
84
  };
79
85
 
86
+ if (opts.createVersionedResources) {
87
+ if (!opts.productVersionString) {
88
+ throw new Error("productVersionString must be defined.");
89
+ }
90
+ patch["resource-string"] = {
91
+ 2: opts.productVersionString
92
+ };
93
+ }
94
+
80
95
  if (opts.winIcon) {
81
96
  patch.icon = opts.winIcon;
82
97
  }
@@ -140,13 +155,37 @@ function renameApp(opts) {
140
155
  });
141
156
  }
142
157
 
158
+ function moveFilesExceptExecutable(opts) {
159
+ const versionFolder = opts.productVersionString;
160
+ if (!versionFolder) {
161
+ throw new Error("productVersionString must be defined.");
162
+ }
163
+ return es.mapSync(function (f) {
164
+ // Skip if the file is the renamed executable
165
+ if (
166
+ f.relative === `${opts.productName}.exe`
167
+ ) {
168
+ return f;
169
+ }
170
+
171
+ // Move other files to version subfolder
172
+ if (f.path && f.base) {
173
+ const relativePath = path.relative(f.base, f.path);
174
+ f.path = path.join(f.base, versionFolder, relativePath);
175
+ }
176
+
177
+ return f;
178
+ });
179
+ }
180
+
143
181
  exports.patch = function (opts) {
144
182
  var pass = es.through();
145
183
 
146
184
  var src = pass
147
185
  .pipe(opts.keepDefaultApp ? es.through() : removeDefaultApp())
148
186
  .pipe(patchExecutable(opts))
149
- .pipe(renameApp(opts));
187
+ .pipe(renameApp(opts))
188
+ .pipe(opts.createVersionedResources ? moveFilesExceptExecutable(opts) : es.through());
150
189
 
151
190
  return es.duplex(pass, src);
152
191
  };