Electron-to-Chromium
![codecov](https://codecov.io/gh/Kilian/electron-to-chromium/branch/master/graph/badge.svg)
This repository provides a mapping of Electron versions to the Chromium version that it uses.
This package is used in Browserslist, so you can use e.g. electron >= 1.4
in Autoprefixer, Stylelint, babel-present-env and eslint-plugin-compat.
Install
Install using npm install electron-to-chromium
.
Usage
to include electron-to-chromium, require it:
var e2c = require('electron-to-chromium');
Properties
The Electron-to-Chromium object has 4 properties to use:
versions
An object of key-value pairs with a major Electron version as the key, and the respective major Chromium version as the value.
var versions = e2c.versions;
console.log(versions['1.4']);
fullVersions
An object of key-value pairs with a Electron version as the key, and the respective full Chromium version as the value.
var versions = e2c.fullVersions;
console.log(versions['1.4.11']);
chromiumVersions
An object of key-value pairs with a major Chromium version as the key, and the respective major Electron version as the value.
var versions = e2c.chromiumVersions;
console.log(versions['54']);
fullChromiumVersions
An object of key-value pairs with a Chromium version as the key, and an array of the respective major Electron versions as the value.
var versions = e2c.fullChromiumVersions;
console.log(versions['54.0.2840.101']);
electronToChromium(query)
Arguments:
- Query: string or number, required. A major or full electron version.
A function that returns the corresponding Chromium version for a given Electron function. Returns a string.
If you provide it with a major Electron version, it will return a major Chromium version:
var chromeVersion = e2c.electronToChromium('1.4');
If you provide it with a full Electron version, it will return the full Chromium version.
var chromeVersion = e2c.electronToChromium('1.4.11');
If a query does not match a Chromium version, it will return undefined
.
var chromeVersion = e2c.electronToChromium('9000');
chromiumToElectron(query)
Arguments:
- Query: string or number, required. A major or full chromium version.
Returns a string with the corresponding Electron version for a given Chromium query.
If you provide it with a major Chromium version, it will return a major Electron version:
var electronVersion = e2c.chromiumToElectron('54');
If you provide it with a full Chrome version, it will return an array of full Electron versions.
var electronVersions = e2c.chromiumToElectron('56.0.2924.87');
If a query does not match an Electron version, it will return undefined
.
var electronVersion = e2c.chromiumToElectron('10');
electronToBrowserList(query) DEPRECATED
Arguments:
- Query: string or number, required. A major Electron version.
Deprecated: Browserlist already includes electron-to-chromium.
A function that returns a Browserlist query that matches the given major Electron version. Returns a string.
If you provide it with a major Electron version, it will return a Browserlist query string that matches the chromium capabilities:
var query = e2c.electronToBrowserList('1.4');
If a query does not match a Chromium version, it will return undefined
.
var query = e2c.electronToBrowserList('9000');
importing just versions, fullVersions, chromiumVersions and fullChromiumVersions
all list can be imported on their own, if file-size is a concern.
versions
var versions = require('electron-to-chromium/versions');
fullVersions
var fullVersions = require('electron-to-chromium/full-versions');
chromiumVersions
var chromiumVersions = require('electron-to-chromium/chromium-versions');
fullChromiumVersions
var fullChromiumVersions = require('electron-to-chromium/full-chromium-versions');
Updating
This package will be updated with each new Electron release.
To update the list, run npm run build.js
. Requires internet access as it downloads from the canonical list of Electron versions.
to verify correct behaviour, run npm test
;