[6a3a178] | 1 | ### Made by [@kilianvalkhof](https://twitter.com/kilianvalkhof)
|
---|
| 2 |
|
---|
| 3 | #### Other projects:
|
---|
| 4 |
|
---|
| 5 | - 💻 [Polypane](https://polypane.app) - Develop responsive websites and apps twice as fast on multiple screens at once
|
---|
| 6 | - 🖌️ [Superposition](https://superposition.design) - Kickstart your design system by extracting design tokens from your website
|
---|
| 7 | - 🗒️ [FromScratch](https://fromscratch.rocks) - A smart but simple autosaving scratchpad
|
---|
| 8 |
|
---|
| 9 | ---
|
---|
| 10 |
|
---|
| 11 | # Electron-to-Chromium [![npm](https://img.shields.io/npm/v/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![travis](https://img.shields.io/travis/Kilian/electron-to-chromium/master.svg)](https://travis-ci.org/Kilian/electron-to-chromium) [![npm-downloads](https://img.shields.io/npm/dm/electron-to-chromium.svg)](https://www.npmjs.com/package/electron-to-chromium) [![codecov](https://codecov.io/gh/Kilian/electron-to-chromium/branch/master/graph/badge.svg)](https://codecov.io/gh/Kilian/electron-to-chromium)[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_shield)
|
---|
| 12 |
|
---|
| 13 | This repository provides a mapping of Electron versions to the Chromium version that it uses.
|
---|
| 14 |
|
---|
| 15 | This package is used in [Browserslist](https://github.com/ai/browserslist), so you can use e.g. `electron >= 1.4` in [Autoprefixer](https://github.com/postcss/autoprefixer), [Stylelint](https://github.com/stylelint/stylelint), [babel-preset-env](https://github.com/babel/babel-preset-env) and [eslint-plugin-compat](https://github.com/amilajack/eslint-plugin-compat).
|
---|
| 16 |
|
---|
| 17 | **Supported by:**
|
---|
| 18 |
|
---|
| 19 | <a href="https://m.do.co/c/bb22ea58e765">
|
---|
| 20 | <img src="https://opensource.nyc3.cdn.digitaloceanspaces.com/attribution/assets/SVG/DO_Logo_horizontal_blue.svg" width="201px">
|
---|
| 21 | </a>
|
---|
| 22 |
|
---|
| 23 |
|
---|
| 24 | ## Install
|
---|
| 25 | Install using `npm install electron-to-chromium`.
|
---|
| 26 |
|
---|
| 27 | ## Usage
|
---|
| 28 | To include Electron-to-Chromium, require it:
|
---|
| 29 |
|
---|
| 30 | ```js
|
---|
| 31 | var e2c = require('electron-to-chromium');
|
---|
| 32 | ```
|
---|
| 33 |
|
---|
| 34 | ### Properties
|
---|
| 35 | The Electron-to-Chromium object has 4 properties to use:
|
---|
| 36 |
|
---|
| 37 | #### `versions`
|
---|
| 38 | An object of key-value pairs with a _major_ Electron version as the key, and the corresponding major Chromium version as the value.
|
---|
| 39 |
|
---|
| 40 | ```js
|
---|
| 41 | var versions = e2c.versions;
|
---|
| 42 | console.log(versions['1.4']);
|
---|
| 43 | // returns "53"
|
---|
| 44 | ```
|
---|
| 45 |
|
---|
| 46 | #### `fullVersions`
|
---|
| 47 | An object of key-value pairs with a Electron version as the key, and the corresponding full Chromium version as the value.
|
---|
| 48 |
|
---|
| 49 | ```js
|
---|
| 50 | var versions = e2c.fullVersions;
|
---|
| 51 | console.log(versions['1.4.11']);
|
---|
| 52 | // returns "53.0.2785.143"
|
---|
| 53 | ```
|
---|
| 54 |
|
---|
| 55 | #### `chromiumVersions`
|
---|
| 56 | An object of key-value pairs with a _major_ Chromium version as the key, and the corresponding major Electron version as the value.
|
---|
| 57 |
|
---|
| 58 | ```js
|
---|
| 59 | var versions = e2c.chromiumVersions;
|
---|
| 60 | console.log(versions['54']);
|
---|
| 61 | // returns "1.4"
|
---|
| 62 | ```
|
---|
| 63 |
|
---|
| 64 | #### `fullChromiumVersions`
|
---|
| 65 | An object of key-value pairs with a Chromium version as the key, and an array of the corresponding major Electron versions as the value.
|
---|
| 66 |
|
---|
| 67 | ```js
|
---|
| 68 | var versions = e2c.fullChromiumVersions;
|
---|
| 69 | console.log(versions['54.0.2840.101']);
|
---|
| 70 | // returns ["1.5.1", "1.5.0"]
|
---|
| 71 | ```
|
---|
| 72 | ### Functions
|
---|
| 73 |
|
---|
| 74 | #### `electronToChromium(query)`
|
---|
| 75 | Arguments:
|
---|
| 76 | * Query: string or number, required. A major or full Electron version.
|
---|
| 77 |
|
---|
| 78 | A function that returns the corresponding Chromium version for a given Electron function. Returns a string.
|
---|
| 79 |
|
---|
| 80 | If you provide it with a major Electron version, it will return a major Chromium version:
|
---|
| 81 |
|
---|
| 82 | ```js
|
---|
| 83 | var chromeVersion = e2c.electronToChromium('1.4');
|
---|
| 84 | // chromeVersion is "53"
|
---|
| 85 | ```
|
---|
| 86 |
|
---|
| 87 | If you provide it with a full Electron version, it will return the full Chromium version.
|
---|
| 88 |
|
---|
| 89 | ```js
|
---|
| 90 | var chromeVersion = e2c.electronToChromium('1.4.11');
|
---|
| 91 | // chromeVersion is "53.0.2785.143"
|
---|
| 92 | ```
|
---|
| 93 |
|
---|
| 94 | If a query does not match a Chromium version, it will return `undefined`.
|
---|
| 95 |
|
---|
| 96 | ```js
|
---|
| 97 | var chromeVersion = e2c.electronToChromium('9000');
|
---|
| 98 | // chromeVersion is undefined
|
---|
| 99 | ```
|
---|
| 100 |
|
---|
| 101 | #### `chromiumToElectron(query)`
|
---|
| 102 | Arguments:
|
---|
| 103 | * Query: string or number, required. A major or full Chromium version.
|
---|
| 104 |
|
---|
| 105 | Returns a string with the corresponding Electron version for a given Chromium query.
|
---|
| 106 |
|
---|
| 107 | If you provide it with a major Chromium version, it will return a major Electron version:
|
---|
| 108 |
|
---|
| 109 | ```js
|
---|
| 110 | var electronVersion = e2c.chromiumToElectron('54');
|
---|
| 111 | // electronVersion is "1.4"
|
---|
| 112 | ```
|
---|
| 113 |
|
---|
| 114 | If you provide it with a full Chrome version, it will return an array of full Electron versions.
|
---|
| 115 |
|
---|
| 116 | ```js
|
---|
| 117 | var electronVersions = e2c.chromiumToElectron('56.0.2924.87');
|
---|
| 118 | // electronVersions is ["1.6.3", "1.6.2", "1.6.1", "1.6.0"]
|
---|
| 119 | ```
|
---|
| 120 |
|
---|
| 121 | If a query does not match an Electron version, it will return `undefined`.
|
---|
| 122 |
|
---|
| 123 | ```js
|
---|
| 124 | var electronVersion = e2c.chromiumToElectron('10');
|
---|
| 125 | // electronVersion is undefined
|
---|
| 126 | ```
|
---|
| 127 |
|
---|
| 128 | #### `electronToBrowserList(query)` **DEPRECATED**
|
---|
| 129 | Arguments:
|
---|
| 130 | * Query: string or number, required. A major Electron version.
|
---|
| 131 |
|
---|
| 132 | _**Deprecated**: Browserlist already includes electron-to-chromium._
|
---|
| 133 |
|
---|
| 134 | A function that returns a [Browserslist](https://github.com/ai/browserslist) query that matches the given major Electron version. Returns a string.
|
---|
| 135 |
|
---|
| 136 | If you provide it with a major Electron version, it will return a Browserlist query string that matches the Chromium capabilities:
|
---|
| 137 |
|
---|
| 138 | ```js
|
---|
| 139 | var query = e2c.electronToBrowserList('1.4');
|
---|
| 140 | // query is "Chrome >= 53"
|
---|
| 141 | ```
|
---|
| 142 |
|
---|
| 143 | If a query does not match a Chromium version, it will return `undefined`.
|
---|
| 144 |
|
---|
| 145 | ```js
|
---|
| 146 | var query = e2c.electronToBrowserList('9000');
|
---|
| 147 | // query is undefined
|
---|
| 148 | ```
|
---|
| 149 |
|
---|
| 150 | ### Importing just versions, fullVersions, chromiumVersions and fullChromiumVersions
|
---|
| 151 | All lists can be imported on their own, if file size is a concern.
|
---|
| 152 |
|
---|
| 153 | #### `versions`
|
---|
| 154 |
|
---|
| 155 | ```js
|
---|
| 156 | var versions = require('electron-to-chromium/versions');
|
---|
| 157 | ```
|
---|
| 158 |
|
---|
| 159 | #### `fullVersions`
|
---|
| 160 |
|
---|
| 161 | ```js
|
---|
| 162 | var fullVersions = require('electron-to-chromium/full-versions');
|
---|
| 163 | ```
|
---|
| 164 |
|
---|
| 165 | #### `chromiumVersions`
|
---|
| 166 |
|
---|
| 167 | ```js
|
---|
| 168 | var chromiumVersions = require('electron-to-chromium/chromium-versions');
|
---|
| 169 | ```
|
---|
| 170 |
|
---|
| 171 | #### `fullChromiumVersions`
|
---|
| 172 |
|
---|
| 173 | ```js
|
---|
| 174 | var fullChromiumVersions = require('electron-to-chromium/full-chromium-versions');
|
---|
| 175 | ```
|
---|
| 176 |
|
---|
| 177 | ## Updating
|
---|
| 178 | This package will be updated with each new Electron release.
|
---|
| 179 |
|
---|
| 180 | To update the list, run `npm run build.js`. Requires internet access as it downloads from the canonical list of Electron versions.
|
---|
| 181 |
|
---|
| 182 | To verify correct behaviour, run `npm test`.
|
---|
| 183 |
|
---|
| 184 |
|
---|
| 185 | ## License
|
---|
| 186 | [![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2FKilian%2Felectron-to-chromium?ref=badge_large)
|
---|