electron-installer-common
Advanced tools
Comparing version 0.4.1 to 0.4.2
10
NEWS.md
@@ -5,4 +5,12 @@ # `electron-installer-common` - Changes by Version | ||
[Unreleased]: https://github.com/electron-userland/electron-installer-common/compare/v0.4.1...master | ||
[Unreleased]: https://github.com/electron-userland/electron-installer-common/compare/v0.4.2...master | ||
## [0.4.2] - 2019-01-03 | ||
[0.4.2]: https://github.com/electron-userland/electron-installer-common/compare/v0.4.1...v0.4.2 | ||
### Added | ||
* Re-export public functions not already in `src/index.js` (#7) | ||
## [0.4.1] - 2019-01-02 | ||
@@ -9,0 +17,0 @@ |
{ | ||
"name": "electron-installer-common", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "Common functionality for creating distributable Electron apps", | ||
@@ -5,0 +5,0 @@ "author": "Mark Lee", |
'use strict' | ||
const _ = require('lodash') | ||
const asar = require('asar') | ||
const dependencies = require('./dependencies') | ||
const error = require('./error') | ||
const fs = require('fs-extra') | ||
@@ -9,2 +10,5 @@ const getHomePage = require('./gethomepage') | ||
const path = require('path') | ||
const readElectronVersion = require('./readelectronversion') | ||
const readMetadata = require('./readmetadata') | ||
const replaceScopeName = require('./replacescopename') | ||
const spawn = require('./spawn') | ||
@@ -23,6 +27,2 @@ const tmp = require('tmp-promise') | ||
function errorMessage (message, err) { | ||
return `Error ${message}: ${err.message || err}` | ||
} | ||
/** | ||
@@ -41,3 +41,3 @@ * Create hicolor icon for the package. | ||
.then(() => fs.chmod(iconFile, '0644')) | ||
.catch(wrapError('creating hicolor icon file')) | ||
.catch(error.wrapError('creating hicolor icon file')) | ||
})) | ||
@@ -55,6 +55,6 @@ } | ||
return fs.ensureDir(path.dirname(iconFile), '0755') | ||
.catch(wrapError('creating icon path')) | ||
.catch(error.wrapError('creating icon path')) | ||
.then(() => fs.copy(options.icon, iconFile)) | ||
.then(() => fs.chmod(iconFile, '0644')) | ||
.catch(wrapError('creating icon file')) | ||
.catch(error.wrapError('creating icon file')) | ||
} | ||
@@ -80,9 +80,2 @@ | ||
function wrapError (message) { | ||
return err => { | ||
/* istanbul ignore next */ | ||
throw new Error(errorMessage(message, err)) | ||
} | ||
} | ||
module.exports = { | ||
@@ -98,3 +91,3 @@ /** | ||
.then(() => fs.copy(options.src, applicationDir, { filter: ignoreFunc })) | ||
.catch(wrapError('copying application directory')) | ||
.catch(error.wrapError('copying application directory')) | ||
}, | ||
@@ -119,3 +112,3 @@ /** | ||
}).then(() => fs.symlink(binSrc, binDest, 'file')) | ||
.catch(wrapError('creating binary symlink')) | ||
.catch(error.wrapError('creating binary symlink')) | ||
}, | ||
@@ -127,3 +120,3 @@ createContents: function createContents (options, dir, functions) { | ||
.then(() => dir) | ||
.catch(wrapError('creating contents of package')) | ||
.catch(error.wrapError('creating contents of package')) | ||
}, | ||
@@ -141,3 +134,3 @@ /** | ||
.then(() => fs.chmod(copyrightFile, '0644')) | ||
.catch(wrapError('creating copyright file')) | ||
.catch(error.wrapError('creating copyright file')) | ||
}, | ||
@@ -155,7 +148,7 @@ /** | ||
return fs.ensureDir(path.dirname(desktopDest), '0755') | ||
.catch(wrapError('creating desktop path')) | ||
.catch(error.wrapError('creating desktop path')) | ||
.then(() => generateTemplate(options, desktopSrc)) | ||
.then(data => fs.outputFile(desktopDest, data)) | ||
.then(() => fs.chmod(desktopDest, '0644')) | ||
.catch(wrapError('creating desktop file')) | ||
.catch(error.wrapError('creating desktop file')) | ||
}, | ||
@@ -169,7 +162,7 @@ /** | ||
return tmp.dir({ prefix: 'electron-', unsafeCleanup: true }) | ||
.catch(wrapError('creating temporary directory')) | ||
.catch(error.wrapError('creating temporary directory')) | ||
.then(dir => { | ||
const tempDir = path.join(dir.path, `${options.name}_${options.version}_${options.arch}`) | ||
return fs.ensureDir(tempDir, '0755') | ||
}).catch(wrapError('changing permissions on temporary directory')) | ||
}).catch(error.wrapError('changing permissions on temporary directory')) | ||
}, | ||
@@ -187,3 +180,3 @@ | ||
}, | ||
errorMessage: errorMessage, | ||
errorMessage: error.errorMessage, | ||
generateTemplate: generateTemplate, | ||
@@ -210,2 +203,8 @@ getDefaultsFromPackageJSON: function getDefaultsFromPackageJSON (pkg) { | ||
}, | ||
getDepends: dependencies.getDepends, | ||
getGConfDepends: dependencies.getGConfDepends, | ||
getGTKDepends: dependencies.getGTKDepends, | ||
getTrashDepends: dependencies.getTrashDepends, | ||
getUUIDDepends: dependencies.getUUIDDepends, | ||
mergeUserSpecified: dependencies.mergeUserSpecified, | ||
/** | ||
@@ -223,25 +222,9 @@ * Move the package to the specified destination. | ||
return fs.move(file, dest, { clobber: true }) | ||
}))).catch(wrapError('moving package files')) | ||
}))).catch(error.wrapError('moving package files')) | ||
}, | ||
/** | ||
* Read `package.json` either from `resources/app.asar` (if the app is packaged) | ||
* or from `resources/app/package.json` (if it is not). | ||
*/ | ||
readMeta: function readMeta (options) { | ||
const appAsarPath = path.join(options.src, 'resources/app.asar') | ||
const appPackageJSONPath = path.join(options.src, 'resources/app/package.json') | ||
return fs.pathExists(appAsarPath) | ||
.then(asarExists => { | ||
if (asarExists) { | ||
options.logger(`Reading package metadata from ${appAsarPath}`) | ||
return JSON.parse(asar.extractFile(appAsarPath, 'package.json')) | ||
} else { | ||
options.logger(`Reading package metadata from ${appPackageJSONPath}`) | ||
return fs.readJson(appPackageJSONPath) | ||
} | ||
}).catch(wrapError('reading package metadata')) | ||
}, | ||
readElectronVersion: readElectronVersion, | ||
readMeta: readMetadata, | ||
replaceScopeName: replaceScopeName, | ||
spawn: spawn, | ||
wrapError: wrapError | ||
wrapError: error.wrapError | ||
} |
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
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 9 instances in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
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
58910
159
574
1
5
9