Skip to content
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

chore: add compression option #341

Closed
wants to merge 6 commits into from
Closed
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
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ Even though you can pass most of these options through the command-line interfac
{
"dest": "dist/installers/",
"icon": "resources/Icon.png",
"compression": "gzip",
"categories": [
"Utility"
],
Expand Down Expand Up @@ -326,7 +327,7 @@ Type: `String`
Default: `package.homepage || package.author.url`

URL of the homepage for the package, used in the [`Homepage` field of the `control` specification](https://www.debian.org/doc/debian-policy/#homepage).

on error value, default is: `'xz'`
#### options.bin
Type: `String`
Default: `package.name || "electron"`
Expand Down Expand Up @@ -430,6 +431,13 @@ Default: [`resources/desktop.ejs`](https://github.com/electron-userland/electron
The absolute path to a custom template for the generated [FreeDesktop.org desktop
entry](http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html) file.

#### options.compression
Type: `String`
Default: `undefined`

Set the compression type used by dpkg-deb when building .deb package
Allowed values: `'xz', 'gzip', 'bzip2', 'lzma', 'zstd', 'none'`

### Installed Package

The package installs the Electron application into `/usr/lib`, since there are
Expand Down
13 changes: 13 additions & 0 deletions src/installer.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,11 @@
this.options.logger(`Creating package at ${this.stagingDir}`)

const command = ['--build', this.stagingDir]

if(this.options.compression) {

Check failure on line 116 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (10.x, ubuntu-latest)

Expected space(s) after "if"

Check failure on line 116 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (12.x, ubuntu-latest)

Expected space(s) after "if"

Check failure on line 116 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

Expected space(s) after "if"
command.unshift(`-Z${this.options.compression}`)

Check failure on line 117 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (10.x, ubuntu-latest)

Expected indentation of 6 spaces but found 7

Check failure on line 117 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (12.x, ubuntu-latest)

Expected indentation of 6 spaces but found 7

Check failure on line 117 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

Expected indentation of 6 spaces but found 7
}

if (process.platform === 'darwin') {
command.unshift('--root-owner-group')
}
Expand Down Expand Up @@ -141,6 +146,8 @@

maintainer: this.getMaintainer(pkg.author),

compression: undefined,

icon: path.resolve(__dirname, '../resources/icon.png'),
lintianOverrides: []
}, debianDependencies.forElectron(electronVersion))
Expand Down Expand Up @@ -168,6 +175,12 @@
this.options.productDescription = this.normalizeExtendedDescription(this.options.productDescription)
}

// options.compression validation
const compressionTypes = ['xz', 'gzip', 'bzip2', 'lzma', 'zstd', 'none']
if (this.options.compression && !compressionTypes.includes(this.options.compression)) {
throw new Error("Compression option should be one of these values: xz, gzip, bzip2, lzma, zstd or none. Please, verify it")

Check failure on line 181 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (10.x, ubuntu-latest)

Strings must use singlequote

Check failure on line 181 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (12.x, ubuntu-latest)

Strings must use singlequote

Check failure on line 181 in src/installer.js

View workflow job for this annotation

GitHub Actions / build (14.x, ubuntu-latest)

Strings must use singlequote
}

// Create array with unique values from default & user-supplied dependencies
for (const prop of ['depends', 'recommends', 'suggests', 'enhances', 'preDepends']) {
this.options[prop] = common.mergeUserSpecified(this.userSupplied, prop, this.defaults)
Expand Down
Loading