Skip to content

Remove target section from electron-builder config #853

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 22, 2022
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
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ jobs:
name: Linux_X86-64_app_image
- path: '*macOS_64bit.dmg'
name: macOS_dmg
- path: '*macOS_64bit.zip'
name: macOS_zip
- path: '*Windows_64bit.exe'
name: Windows_X86-64_interactive_installer
- path: '*Windows_64bit.msi'
Expand Down
5 changes: 1 addition & 4 deletions electron/build/template-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,7 @@
"hardenedRuntime": true,
"gatekeeperAssess": false,
"entitlements": "resources/entitlements.mac.plist",
"entitlementsInherit": "resources/entitlements.mac.plist",
"target": [
"dmg"
]
"entitlementsInherit": "resources/entitlements.mac.plist"
},
"linux": {
"target": [
Expand Down
12 changes: 3 additions & 9 deletions electron/packager/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ ${fs.readFileSync(path('..', 'build', 'package.json')).toString()}
'Installing dependencies'
);
exec(
`yarn --network-timeout 1000000 --cwd ${path('..', 'build')} build${
isElectronPublish ? ':publish' : ''
`yarn --network-timeout 1000000 --cwd ${path('..', 'build')} build${isElectronPublish ? ':publish' : ''
}`,
`Building the ${productName} application`
);
Expand Down Expand Up @@ -393,11 +392,7 @@ ${fs.readFileSync(path('..', 'build', 'package.json')).toString()}
for (const fileToCopy of filesToCopy) {
echo(`🚢 >>> Copying ${fileToCopy} to ${targetFolder}.`);
const isZip = await utils.isZip(fileToCopy);
if (isZip) {
await utils.adjustArchiveStructure(fileToCopy, targetFolder);
} else {
cp('-rf', fileToCopy, targetFolder);
}
cp('-rf', fileToCopy, targetFolder);
echo(`👌 >>> Copied ${fileToCopy} to ${targetFolder}.`);
}
}
Expand Down Expand Up @@ -491,8 +486,7 @@ ${fs.readFileSync(path('..', 'build', 'package.json')).toString()}
if (expectedVersion) {
if (!versions.has(expectedVersion)) {
echo(
`Mismatching version configuration. Expected version was: '${expectedVersion}' actual was: '${
Array.from(versions)[0]
`Mismatching version configuration. Expected version was: '${expectedVersion}' actual was: '${Array.from(versions)[0]
}'.`
);
shell.exit(1);
Expand Down
2 changes: 1 addition & 1 deletion electron/packager/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"prepare": "yarn test",
"package": "node index.js",
"test": "mocha \"./test/**/*.test.js\""
"test": "echo 'No test implemented'"
},
"keywords": [],
"author": "Arduino SA",
Expand Down
Binary file removed electron/packager/test/resources/not-a-zip.dmg
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed electron/packager/test/resources/zip-with-symlink.zip
Binary file not shown.
Binary file not shown.
119 changes: 0 additions & 119 deletions electron/packager/test/utils.test.js

This file was deleted.

62 changes: 0 additions & 62 deletions electron/packager/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,67 +50,6 @@ function collectUnusedDependencies(pathToProject = process.cwd()) {
});
}

/**
* `pathToZip` is a `path/to/your/app-name.zip`.
* If the `pathToZip` archive does not have a root directory with name `app-name`, it creates one, and move the content from the
* archive's root to the new root folder. If the archive already has the desired root folder, calling this function is a NOOP.
* If `pathToZip` is not a ZIP, rejects. `targetFolderName` is the destination folder not the new archive location.
*/
function adjustArchiveStructure(pathToZip, targetFolderName, noCleanup) {
return new Promise(async (resolve, reject) => {
if (!(await isZip(pathToZip))) {
reject(new Error(`Expected a ZIP file.`));
return;
}
if (!fs.existsSync(targetFolderName)) {
reject(new Error(`${targetFolderName} does not exist.`));
return;
}
if (!fs.lstatSync(targetFolderName).isDirectory()) {
reject(new Error(`${targetFolderName} is not a directory.`));
return;
}
console.log(`⏱️ >>> Adjusting ZIP structure ${pathToZip}...`);

const root = basename(pathToZip);
const resources = await list(pathToZip);
const hasBaseFolder = resources.find((name) => name === root);
if (hasBaseFolder) {
if (
resources.filter((name) => name.indexOf(path.sep) === -1).length > 1
) {
console.warn(
`${pathToZip} ZIP has the desired root folder ${root}, however the ZIP contains other entries too: ${JSON.stringify(
resources
)}`
);
}
console.log(`👌 <<< The ZIP already has the desired ${root} folder.`);
resolve(pathToZip);
return;
}

const track = temp.track();
try {
const unzipOut = path.join(track.mkdirSync(), root);
fs.mkdirSync(unzipOut);
await unpack(pathToZip, unzipOut);
const adjustedZip = path.join(targetFolderName, path.basename(pathToZip));
await pack(unzipOut, adjustedZip);
console.log(
`👌 <<< Adjusted the ZIP structure. Moved the modified ${basename(
pathToZip
)} to the ${targetFolderName} folder.`
);
resolve(adjustedZip);
} finally {
if (!noCleanup) {
track.cleanupSync();
}
}
});
}

/**
* Returns the `basename` of `pathToFile` without the file extension.
*/
Expand Down Expand Up @@ -213,7 +152,6 @@ function getChannelFile(platform) {

module.exports = {
collectUnusedDependencies,
adjustArchiveStructure,
isZip,
unpack,
isNightly,
Expand Down