Socket
Socket
Sign inDemoInstall

electron-installer-common

Package Overview
Dependencies
10
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.10.1 to 0.10.2

src/index.d.ts

17

NEWS.md

@@ -5,4 +5,19 @@ # `electron-installer-common` - Changes by Version

[Unreleased]: https://github.com/electron-userland/electron-installer-common/compare/v0.10.1...master
[Unreleased]: https://github.com/electron-userland/electron-installer-common/compare/v0.10.2...master
## [0.10.2] - 2020-06-25
[0.10.2]: https://github.com/electron-userland/electron-installer-common/compare/v0.10.1...v0.10.2
### Added
* Support for Electron 9 Linux dependencies (#66)
* macOS support for `readMetadata` (#67)
* Install symbolic icons on Linux when provided (#70)
* TypeScript definition (#71)
### Fixed
* Export all dependencies-related functions (#72)
## [0.10.1] - 2020-02-13

@@ -9,0 +24,0 @@

36

package.json
{
"name": "electron-installer-common",
"version": "0.10.1",
"version": "0.10.2",
"description": "Common functionality for creating distributable Electron apps",

@@ -8,2 +8,3 @@ "author": "Mark Lee",

"main": "src/index.js",
"types": "src/index.d.ts",
"scripts": {

@@ -13,4 +14,7 @@ "ava": "ava",

"coverage": "nyc ava",
"lint": "eslint .",
"test": "npm run lint && ava"
"lint": "npm run lint:js && npm run lint:ts",
"lint:js": "eslint .",
"lint:ts": "eslint --config .eslintrc.typescript.js --ext .ts .",
"test": "npm run lint && tsd && ava",
"tsd": "tsd"
},

@@ -24,8 +28,11 @@ "repository": "electron-userland/electron-installer-common",

"NEWS.md",
"src"
"src",
"src/index.d.ts"
],
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^3.0.0",
"@typescript-eslint/parser": "^3.0.0",
"ava": "^3.0.0",
"codecov": "^3.5.0",
"eslint": "^6.0.1",
"eslint": "^7.1.0",
"eslint-config-standard": "^14.0.0",

@@ -38,9 +45,11 @@ "eslint-plugin-ava": "^10.0.0",

"nyc": "^15.0.0",
"sinon": "^8.0.4"
"sinon": "^9.0.0",
"tsd": "^0.11.0",
"typescript": "^3.9.3"
},
"dependencies": {
"@malept/cross-spawn-promise": "^1.0.0",
"asar": "^2.0.1",
"asar": "^3.0.0",
"debug": "^4.1.1",
"fs-extra": "^8.0.1",
"fs-extra": "^9.0.0",
"glob": "^7.1.4",

@@ -50,3 +59,3 @@ "lodash": "^4.17.15",

"semver": "^7.1.1",
"tmp-promise": "^2.0.1"
"tmp-promise": "^3.0.2"
},

@@ -66,3 +75,12 @@ "engines": {

]
},
"funding": {
"url": "https://github.com/electron-userland/electron-installer-common?sponsor=1"
},
"tsd": {
"directory": "test"
},
"optionalDependencies": {
"@types/fs-extra": "^9.0.1"
}
}

@@ -14,2 +14,16 @@ 'use strict'

/**
* Determine whether DRM is a necessary dependency, given the Electron version.
*/
function getDRMDepends (version, dependencyMap) {
return semver.gte(version, '9.0.0-beta.1') ? [dependencyMap.drm] : []
}
/**
* Determine whether GBM is a necessary dependency, given the Electron version.
*/
function getGBMDepends (version, dependencyMap) {
return semver.gte(version, '9.0.0-beta.1') ? [dependencyMap.gbm] : []
}
/**
* Determine whether GConf is a necessary dependency, given the Electron version.

@@ -51,2 +65,9 @@ */

/**
* Determine whether dri3 extension for X C Binding is a necessary dependency, given the Electron version.
*/
function getXcbDri3Depends (version, dependencyMap) {
return semver.gte(version, '9.0.0-beta.1') ? [dependencyMap.xcbDri3] : []
}
module.exports = {

@@ -65,10 +86,16 @@ /**

].concat(getATSPIDepends(version, dependencyMap))
.concat(getDRMDepends(version, dependencyMap))
.concat(getGBMDepends(version, dependencyMap))
.concat(getGConfDepends(version, dependencyMap))
.concat(getUUIDDepends(version, dependencyMap))
.concat(getXcbDri3Depends(version, dependencyMap))
},
getATSPIDepends: getATSPIDepends,
getGConfDepends: getGConfDepends,
getGTKDepends: getGTKDepends,
getTrashDepends: getTrashDepends,
getUUIDDepends: getUUIDDepends,
getATSPIDepends,
getDRMDepends,
getGBMDepends,
getGConfDepends,
getGTKDepends,
getTrashDepends,
getUUIDDepends,
getXcbDri3Depends,

@@ -75,0 +102,0 @@ /**

@@ -18,2 +18,3 @@ 'use strict'

module.exports = {
...dependencies,
...sandboxHelper,

@@ -26,9 +27,3 @@ createDesktopFile: desktop.createDesktopFile,

getDefaultsFromPackageJSON,
getDepends: dependencies.getDepends,
getGConfDepends: dependencies.getGConfDepends,
getGTKDepends: dependencies.getGTKDepends,
getHomePage,
getTrashDepends: dependencies.getTrashDepends,
getUUIDDepends: dependencies.getUUIDDepends,
mergeUserSpecified: dependencies.mergeUserSpecified,
readElectronVersion,

@@ -35,0 +30,0 @@ readMetadata,

@@ -90,4 +90,5 @@ 'use strict'

return Promise.all(_.map(this.options.icon, (iconSrc, resolution) => {
const iconExt = resolution === 'scalable' ? 'svg' : 'png'
const iconFile = path.join(this.stagingDir, this.baseAppDir, 'share', 'icons', 'hicolor', resolution, 'apps', `${this.appIdentifier}.${iconExt}`)
const iconExt = ['scalable', 'symbolic'].includes(resolution) ? 'svg' : 'png'
const iconName = resolution === 'symbolic' ? `${this.appIdentifier}-symbolic` : this.appIdentifier
const iconFile = path.join(this.stagingDir, this.baseAppDir, 'share', 'icons', 'hicolor', resolution, 'apps', `${iconName}.${iconExt}`)

@@ -94,0 +95,0 @@ return error.wrapError('creating hicolor icon file', async () => this.copyIcon(iconSrc, iconFile))

'use strict'
const { promisify } = require('util')
const asar = require('asar')
const fs = require('fs-extra')
const glob = promisify(require('glob'))
const path = require('path')
const { wrapError } = require('./error')
async function readPackageJSONFromUnpackedApp (options) {
const appPackageJSONPath = path.join(options.src, 'resources', 'app', 'package.json')
async function determineResourcesDir (src) {
if (await fs.pathExists(path.join(src, 'resources'))) {
return 'resources'
}
return (await glob('*.app/Contents/Resources', { cwd: src }))[0]
}
async function readPackageJSONFromUnpackedApp (resourcesDir, options) {
const appPackageJSONPath = path.join(options.src, resourcesDir, 'app', 'package.json')
options.logger(`Reading package metadata from ${appPackageJSONPath}`)

@@ -19,4 +30,5 @@

/**
* Read `package.json` either from `resources/app.asar` (if the app is packaged)
* or from `resources/app/package.json` (if it is not).
* Read `package.json` either from `$RESOURCES_DIR/app.asar` (if the app is packaged)
* or from `$RESOURCES_DIR/app/package.json` (if it is not). `$RESOURCES_DIR` is either
* `AppName.app/Contents/Resources` on macOS, or `resources` on other platforms.
*

@@ -30,5 +42,9 @@ * Options used:

module.exports = async function readMetadata (options) {
const appAsarPath = path.join(options.src, 'resources/app.asar')
return wrapError('reading package metadata', async () => {
const resourcesDir = await determineResourcesDir(options.src)
if (!resourcesDir) {
throw new Error('Could not determine resources directory in Electron app')
}
const appAsarPath = path.join(options.src, resourcesDir, 'app.asar')
return wrapError('reading package metadata', async () => {
if (await fs.pathExists(appAsarPath)) {

@@ -38,5 +54,5 @@ options.logger(`Reading package metadata from ${appAsarPath}`)

} else {
return readPackageJSONFromUnpackedApp(options)
return readPackageJSONFromUnpackedApp(resourcesDir, options)
}
})
}

@@ -11,7 +11,7 @@ 'use strict'

*/
async function generateTemplate (file, data) {
debug(`Generating template from ${file}`)
async function generateTemplate (templatePath, data) {
debug(`Generating template from ${templatePath}`)
const result = _.template(await fs.readFile(file))(data)
debug(`Generated template from ${file}\n${result}`)
const result = _.template(await fs.readFile(templatePath))(data)
debug(`Generated template from ${templatePath}\n${result}`)
return result

@@ -18,0 +18,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc