Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@vscode/gulp-electron",
"version": "1.38.1",
"version": "1.38.2",
"description": "gulp plugin for packaging Electron into VS Code",
"main": "src/index.js",
"scripts": {
Expand Down
22 changes: 5 additions & 17 deletions src/darwin.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,9 @@ function patchHelperInfoPlist(opts) {
var input = es.through();
var output = input.pipe(
es.map(function (f, cb) {
if (
!/Contents\/Frameworks\/Electron\ Helper( \w+)?\.app\/Contents\/Info.plist$/i.test(
f.relative
)
) {
const match = /Contents\/Frameworks\/Electron\ Helper( \(\w+\))?\.app\/Contents\/Info.plist$/i.exec(
f.relative);
if (!match) {
return cb(null, f);
}

Expand All @@ -246,24 +244,14 @@ function patchHelperInfoPlist(opts) {

f.contents.on("end", function () {
var infoPlist = plist.parse(contents.toString("utf8"));
var match = /\.helper\.([^.]+)$/.exec(
infoPlist["CFBundleIdentifier"] || ""
);
var suffix = match ? match[1] : "";
var suffix = match[1] ?? "";

if (opts.darwinBundleIdentifier) {
infoPlist["CFBundleIdentifier"] =
opts.darwinBundleIdentifier + ".helper";

if (suffix) {
infoPlist["CFBundleIdentifier"] += "." + suffix;
}
}

infoPlist["CFBundleName"] = opts.productName + " Helper";
if (suffix) {
infoPlist["CFBundleName"] += " " + suffix;
}
infoPlist["CFBundleName"] = `${opts.productName} Helper${suffix}`;

if (infoPlist["CFBundleDisplayName"]) {
infoPlist["CFBundleDisplayName"] = infoPlist["CFBundleName"];
Expand Down
27 changes: 27 additions & 0 deletions test/package.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,33 @@ describe("electron", function () {
assert.equal(infoPlist["CFBundleName"], "FakeTemplateApp")
assert.equal(infoPlist["CFBundleDisplayName"], "FakeTemplateApp")

// Added helper Info.plist validation
var helperBasePath = path.join(
"FakeTemplateApp.app",
"Contents",
"Frameworks"
);
var helperApps = [
"FakeTemplateApp Helper.app",
"FakeTemplateApp Helper (GPU).app",
"FakeTemplateApp Helper (Renderer).app",
"FakeTemplateApp Helper (Plugin).app"
];
helperApps.forEach(function (appName) {
var helperPlistPath = path.join(helperBasePath, appName, "Contents", "Info.plist");
if (files[helperPlistPath]) {
var helperPlist = plist.parse(files[helperPlistPath].contents.toString("utf8"));
var expectedName = appName.replace(/\.app$/, "");
assert.equal(helperPlist["CFBundleName"], expectedName, "CFBundleName should be updated");
if (helperPlist["CFBundleDisplayName"]) {
assert.equal(helperPlist["CFBundleDisplayName"], expectedName, "CFBundleDisplayName should be updated");
}
if (helperPlist["CFBundleExecutable"]) {
assert.equal(helperPlist["CFBundleExecutable"], expectedName, "CFBundleExecutable should be renamed");
}
}
});

cb();
});
});
Expand Down