electron-installer-redhat
Advanced tools
Comparing version 1.1.0 to 2.0.0
23
NEWS.md
@@ -1,7 +0,26 @@ | ||
# Changes by Version | ||
# `electron-installer-redhat` - Changes by Version | ||
## [Unreleased] | ||
[Unreleased]: https://github.com/electron-userland/electron-installer-redhat/compare/v1.1.0...master | ||
[Unreleased]: https://github.com/electron-userland/electron-installer-redhat/compare/v2.0.0...master | ||
## [2.0.0] - 2019-06-11 | ||
[2.0.0]: https://github.com/electron-userland/electron-installer-redhat/compare/v1.1.0...v2.0.0 | ||
### Added | ||
* ATSPI dependency for Electron >= 5 (#126) | ||
### Fixed | ||
* Always add revision/release to the RPM filename (#114) | ||
* Include SVG files into the spec file (#125) | ||
### Removed | ||
* Node-style callback support (use [`util.callbackify`](https://nodejs.org/api/util.html#util_util_callbackify_original) | ||
if you need that functionality) | ||
* Node < 8 support (#121) | ||
## [1.1.0] - 2019-05-01 | ||
@@ -8,0 +27,0 @@ |
{ | ||
"name": "electron-installer-redhat", | ||
"description": "Create a Red Hat package for your Electron app.", | ||
"version": "1.1.0", | ||
"version": "2.0.0", | ||
"license": "MIT", | ||
@@ -24,3 +24,3 @@ "author": { | ||
"engines": { | ||
"node": ">= 6.0.0" | ||
"node": ">= 8.0.0" | ||
}, | ||
@@ -38,6 +38,5 @@ "main": "src/installer.js", | ||
"debug": "^4.1.1", | ||
"electron-installer-common": "^0.6.2", | ||
"fs-extra": "^7.0.1", | ||
"electron-installer-common": "^0.7.1", | ||
"fs-extra": "^8.0.1", | ||
"lodash": "^4.17.4", | ||
"nodeify": "^1.0.1", | ||
"word-wrap": "^1.2.3", | ||
@@ -48,14 +47,13 @@ "yargs": "^13.2.2" | ||
"chai": "^4.1.2", | ||
"eslint": "^5.12.0", | ||
"eslint": "^5.16.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-plugin-import": "^2.8.0", | ||
"eslint-plugin-node": "^8.0.1", | ||
"eslint-plugin-promise": "^4.0.1", | ||
"eslint-plugin-import": "^2.17.3", | ||
"eslint-plugin-node": "^9.1.0", | ||
"eslint-plugin-promise": "^4.1.1", | ||
"eslint-plugin-standard": "^4.0.0", | ||
"mocha": "^6.0.0", | ||
"mz": "^2.7.0", | ||
"promise-retry": "^1.1.1", | ||
"sinon": "^7.2.2", | ||
"tmp-promise": "^1.0.4" | ||
"sinon": "^7.3.2", | ||
"tmp-promise": "^2.0.1" | ||
} | ||
} |
@@ -10,3 +10,3 @@ ![Electron Installer for Red Hat](resources/logo.png) | ||
This tool requires Node 6 or greater and `rpmbuild` to build the `.rpm` package. | ||
This tool requires Node 8 or greater and `rpmbuild` to build the `.rpm` package. | ||
@@ -52,3 +52,3 @@ **Note**: If your application uses the [Electron API's `shell.moveItemToTrash` method](https://electronjs.org/docs/api/shell#shellmoveitemtotrashfullpath), RPM 4.13.0 or greater is required, due to the [boolean dependency feature](http://rpm.org/user_doc/boolean_dependencies.html). | ||
│ ├── electron-packager | ||
│ └── electron-prebuilt | ||
│ └── electron | ||
├── package.json | ||
@@ -110,3 +110,3 @@ ├── resources | ||
You'll end up with the package at `dist/installers/app-0.0.1.x86_64.rpm`. | ||
You'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`. | ||
@@ -123,3 +123,3 @@ ### Scripts | ||
```js | ||
```json | ||
{ | ||
@@ -148,3 +148,3 @@ "name": "app", | ||
You'll end up with the package at `dist/installers/app-0.0.1.x86_64.rpm`. | ||
You'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`. | ||
@@ -155,3 +155,3 @@ ### Programmatically | ||
``` | ||
```shell | ||
$ npm install --save-dev electron-installer-redhat | ||
@@ -162,6 +162,6 @@ ``` | ||
```js | ||
var installer = require('electron-installer-redhat') | ||
```javascript | ||
const installer = require('electron-installer-redhat') | ||
var options = { | ||
const options = { | ||
src: 'dist/app-linux-x64/', | ||
@@ -172,16 +172,20 @@ dest: 'dist/installers/', | ||
console.log('Creating package (this may take a while)') | ||
async function main (options) { | ||
console.log('Creating package (this may take a while)') | ||
installer(options, function (err) { | ||
if (err) { | ||
try { | ||
await installer(options) | ||
console.log(`Successfully created package at ${options.dest}`) | ||
} catch (err) { | ||
console.error(err, err.stack) | ||
process.exit(1) | ||
} | ||
console.log('Successfully created package at ' + options.dest) | ||
}) | ||
} | ||
main(options) | ||
``` | ||
You'll end up with the package at `dist/installers/app-0.0.1.x86_64.rpm`. | ||
You'll end up with the package at `dist/installers/app-0.0.1-1.x86_64.rpm`. | ||
_Note: As of 2.0.0, the Node-style callback pattern is no longer available. You can use [`util.callbackify`](https://nodejs.org/api/util.html#util_util_callbackify_original) if this is required for your use case._ | ||
### Options | ||
@@ -191,3 +195,3 @@ | ||
```js | ||
```javascript | ||
{ | ||
@@ -204,3 +208,3 @@ "dest": "dist/installers/", | ||
``` | ||
```shell | ||
$ electron-installer-redhat --src dist/app-linux-x64/ --arch x86_64 --config config.json | ||
@@ -268,3 +272,3 @@ ``` | ||
Type: `String` | ||
Default: `package.revision` | ||
Default: `package.revision || 1` | ||
@@ -271,0 +275,0 @@ Revision number of the package, used in the [`Release` field of the `spec` file](https://docs.fedoraproject.org/en-US/quick-docs/creating-rpm-packages/index.html#con_rpm-spec-file-overview). |
@@ -7,2 +7,3 @@ 'use strict' | ||
const dependencyMap = { | ||
atspi: 'at-spi2-core', | ||
gconf: 'GConf2', | ||
@@ -28,5 +29,5 @@ glib2: 'glib2', | ||
*/ | ||
function rpmSupportsBooleanDependencies (logger) { | ||
return spawn('rpmbuild', ['--version'], logger) | ||
.then(output => rpmVersionSupportsBooleanDependencies(output.trim().split(' ')[2])) | ||
async function rpmSupportsBooleanDependencies (logger) { | ||
const output = await spawn('rpmbuild', ['--version'], logger) | ||
return rpmVersionSupportsBooleanDependencies(output.trim().split(' ')[2]) | ||
} | ||
@@ -61,14 +62,11 @@ | ||
*/ | ||
forElectron: function dependenciesForElectron (electronVersion, logger) { | ||
forElectron: async function dependenciesForElectron (electronVersion, logger) { | ||
const requires = common.getDepends(electronVersion, dependencyMap) | ||
return module.exports.rpmSupportsBooleanDependencies(logger) | ||
.then(supportsBooleanDependencies => { | ||
if (supportsBooleanDependencies) { | ||
const trashRequires = trashRequiresAsBoolean(electronVersion, dependencyMap) | ||
return { requires: requires.concat(trashRequires) } | ||
} else { | ||
console.warn("You are using RPM < 4.13, which does not support boolean dependencies. This is required to express the dependencies needed for the 'shell.moveItemToTrash' API.\nIf you do not use this API, you can safely ignore this warning.\nIf you do use this API, please upgrade to RPM 4.13 or above to have the trash dependencies added to your RPM's requires section.") | ||
return { requires } | ||
} | ||
}) | ||
if (await module.exports.rpmSupportsBooleanDependencies(logger)) { | ||
const trashRequires = trashRequiresAsBoolean(electronVersion, dependencyMap) | ||
return { requires: requires.concat(trashRequires) } | ||
} else { | ||
console.warn("You are using RPM < 4.13, which does not support boolean dependencies. This is required to express the dependencies needed for the 'shell.moveItemToTrash' API.\nIf you do not use this API, you can safely ignore this warning.\nIf you do use this API, please upgrade to RPM 4.13 or above to have the trash dependencies added to your RPM's requires section.") | ||
return { requires } | ||
} | ||
}, | ||
@@ -75,0 +73,0 @@ rpmSupportsBooleanDependencies, |
@@ -7,3 +7,2 @@ 'use strict' | ||
const fs = require('fs-extra') | ||
const nodeify = require('nodeify') | ||
const path = require('path') | ||
@@ -19,3 +18,3 @@ const wrap = require('word-wrap') | ||
const defaultRename = function (dest, src) { | ||
return path.join(dest, '<%= name %>-<%= version %>.<%= arch %>.rpm') | ||
return path.join(dest, '<%= name %>-<%= version %>-<%= revision %>.<%= arch %>.rpm') | ||
} | ||
@@ -54,5 +53,5 @@ | ||
*/ | ||
copyApplication () { | ||
return super.copyApplication() | ||
.then(() => this.updateSandboxHelperPermissions()) | ||
async copyApplication () { | ||
await super.copyApplication() | ||
return this.updateSandboxHelperPermissions() | ||
} | ||
@@ -68,4 +67,3 @@ | ||
return common.createTemplatedFile(src, dest, Object.assign({ dir: this.stagingDir }, this.options)) | ||
.catch(common.wrapError('creating macros file')) | ||
return common.wrapError('creating macros file', async () => common.createTemplatedFile(src, dest, { dir: this.stagingDir, ...this.options })) | ||
} | ||
@@ -76,7 +74,7 @@ | ||
*/ | ||
createPackage () { | ||
async createPackage () { | ||
this.options.logger(`Creating package at ${this.stagingDir}`) | ||
return spawn('rpmbuild', ['-bb', this.specPath, '--target', this.options.arch], this.options.logger) | ||
.then(output => this.options.logger(`rpmbuild output: ${output}`)) | ||
const output = await spawn('rpmbuild', ['-bb', this.specPath, '--target', this.options.arch], this.options.logger) | ||
this.options.logger(`rpmbuild output: ${output}`) | ||
} | ||
@@ -89,8 +87,7 @@ | ||
*/ | ||
createSpec () { | ||
async createSpec () { | ||
const src = path.resolve(__dirname, '../resources/spec.ejs') | ||
this.options.logger(`Creating spec file at ${this.specPath}`) | ||
return this.createTemplatedFile(src, this.specPath) | ||
.catch(common.wrapError('creating spec file')) | ||
return common.wrapError('creating spec file', async () => this.createTemplatedFile(src, this.specPath)) | ||
} | ||
@@ -102,24 +99,22 @@ | ||
*/ | ||
generateDefaults () { | ||
return common.readElectronVersion(this.userSupplied.src) | ||
.then(electronVersion => Promise.all([ | ||
common.readMetadata(this.userSupplied), | ||
redhatDependencies.forElectron(electronVersion, this.userSupplied.logger) | ||
])).then(([pkg, requires]) => { | ||
pkg = pkg || {} | ||
async generateDefaults () { | ||
const electronVersion = await common.readElectronVersion(this.userSupplied.src) | ||
const [pkg, requires] = await Promise.all([ | ||
(async () => (await common.readMetadata(this.userSupplied)) || {})(), | ||
redhatDependencies.forElectron(electronVersion, this.userSupplied.logger) | ||
]) | ||
this.defaults = { | ||
...common.getDefaultsFromPackageJSON(pkg, { revision: 1 }), | ||
version: pkg.version || '0.0.0', | ||
license: pkg.license, | ||
compressionLevel: 2, | ||
icon: path.resolve(__dirname, '../resources/icon.png'), | ||
pre: undefined, | ||
post: undefined, | ||
preun: undefined, | ||
postun: undefined, | ||
...requires | ||
} | ||
this.defaults = Object.assign(common.getDefaultsFromPackageJSON(pkg), { | ||
version: pkg.version || '0.0.0', | ||
license: pkg.license, | ||
compressionLevel: 2, | ||
icon: path.resolve(__dirname, '../resources/icon.png'), | ||
pre: undefined, | ||
post: undefined, | ||
preun: undefined, | ||
postun: undefined | ||
}, requires) | ||
return this.defaults | ||
}) | ||
return this.defaults | ||
} | ||
@@ -157,10 +152,9 @@ | ||
*/ | ||
generateScripts () { | ||
async generateScripts () { | ||
const scriptNames = ['pre', 'post', 'preun', 'postun'] | ||
return Promise.all(_.map(this.options.scripts, (item, key) => { | ||
return Promise.all(_.map(this.options.scripts, async (item, key) => { | ||
if (scriptNames.includes(key)) { | ||
this.options.logger(`Creating installation script ${key}`) | ||
return fs.readFile(item) | ||
.then(script => (this.options[key] = script.toString())) | ||
this.options[key] = (await fs.readFile(item)).toString() | ||
} | ||
@@ -182,33 +176,21 @@ })) | ||
module.exports = (data, callback) => { | ||
module.exports = async data => { | ||
data.rename = data.rename || defaultRename | ||
data.logger = data.logger || defaultLogger | ||
if (callback) { | ||
console.warn('The node-style callback is deprecated. In a future major version, it will be' + | ||
'removed in favor of a Promise-based async style.') | ||
} | ||
const installer = new RedhatInstaller(data) | ||
const promise = installer.generateDefaults() | ||
.then(() => installer.generateOptions()) | ||
.then(() => installer.generateScripts()) | ||
.then(() => data.logger(`Creating package with options\n${JSON.stringify(installer.options, null, 2)}`)) | ||
.then(() => installer.createStagingDir()) | ||
.then(() => installer.createMacros()) | ||
.then(() => installer.createContents()) | ||
.then(() => installer.createPackage()) | ||
.then(() => installer.movePackage()) | ||
.then(() => { | ||
data.logger(`Successfully created package at ${installer.options.dest}`) | ||
return installer.options | ||
}).catch(err => { | ||
data.logger(common.errorMessage('creating package', err)) | ||
throw err | ||
}) | ||
return nodeify(promise, callback) | ||
await installer.generateDefaults() | ||
await installer.generateOptions() | ||
await installer.generateScripts() | ||
await data.logger(`Creating package with options\n${JSON.stringify(installer.options, null, 2)}`) | ||
await installer.createStagingDir() | ||
await installer.createMacros() | ||
await installer.createContents() | ||
await installer.createPackage() | ||
await installer.movePackage() | ||
data.logger(`Successfully created package at ${installer.options.dest}`) | ||
return installer.options | ||
} | ||
module.exports.Installer = RedhatInstaller |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
442013
6
11
414
290
+ Added@types/glob@7.2.0(transitive)
+ Addedasar@2.1.0(transitive)
+ Addedelectron-installer-common@0.7.3(transitive)
+ Addedfs-extra@8.1.0(transitive)
+ Addedtmp-promise@2.1.1(transitive)
- Removednodeify@^1.0.1
- Removed@types/glob@8.1.0(transitive)
- Removedasar@1.0.0(transitive)
- Removedelectron-installer-common@0.6.3(transitive)
- Removedfs-extra@7.0.1(transitive)
- Removedglob-promise@3.4.0(transitive)
- Removedis-promise@1.0.1(transitive)
- Removednodeify@1.0.1(transitive)
- Removedpify@4.0.1(transitive)
- Removedpromise@1.3.0(transitive)
Updatedfs-extra@^8.0.1