Skip to content
This repository has been archived by the owner on May 11, 2018. It is now read-only.

Fill data with electron as a target. #229

Merged
merged 11 commits into from Mar 29, 2017
Merged

Conversation

yavorsky
Copy link
Member

For now, we are converting electron version to chrome with electronToChromium when building the plugins list because of compat-table has no info about electron.

With this PR we could convert all chrome version we need to support into electron like we always do for the opera.

It will make consistent log output, better preset-env debugging, performance optimization (less work while building plugins for the preset). Also data/plugins or data/built-ins is a solid universal source that could be useful for different things in the future, so filling it is a good idea as for me.

@codecov-io
Copy link

codecov-io commented Mar 28, 2017

Codecov Report

Merging #229 into master will decrease coverage by 0.36%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #229      +/-   ##
=========================================
- Coverage   93.06%   92.7%   -0.37%     
=========================================
  Files           4       4              
  Lines         202     192      -10     
  Branches       60      57       -3     
=========================================
- Hits          188     178      -10     
  Misses          9       9              
  Partials        5       5
Impacted Files Coverage Δ
src/index.js 95.53% <ø> (-0.23%) ⬇️
src/normalize-options.js 87.09% <ø> (-1.48%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 48a329b...fef4820. Read the comment docs.

const chromiumVersionsLength = chromiumToElectronVersions.length;
const maxChromium = +chromiumToElectronVersions[chromiumVersionsLength - 1];
if (targetVersion > maxChromium) return null;
const closestChrome = chromiumToElectronVersions.reduce((result, version) => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This results an incorrect version of electron being mapped, for example for async:

{
  "chrome": 56,
  "electron": 1.5
}

Electron should be 1.6.

Should be able to reduce (hehe) the reduce with something like:

const closestChrome = chromiumToElectronVersions.find((version) => targetVersion <= version);

EDIT: even better, I guess we can drop findClosestElectronVersion completely and use chromiumToElectron once it lands?

/cc: @Kilian

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@existentialism so we need to update chromiumToElectron. for now, it will just return undefined if no explicit values were found.

@Kilian
Copy link
Contributor

Kilian commented Mar 28, 2017

1.3.0 is released! Thanks @yavorsky :) https://www.npmjs.com/package/electron-to-chromium

@hzoo
Copy link
Member

hzoo commented Mar 28, 2017

@Kilian there's a regression with 1.3.0 Cannot find module './full-chrome-versions'

@Kilian
Copy link
Contributor

Kilian commented Mar 28, 2017

v1.3.1 up now, sorry about that.

@yavorsky
Copy link
Member Author

yavorsky commented Mar 28, 2017

@Kilian please, join BabelJS slack channel

Copy link
Member

@existentialism existentialism left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 (sans lint issue), if/when electron-to-chromium adds an option we can always update.

Copy link
Member

@hzoo hzoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice work here @yavorsky

@existentialism existentialism merged commit aead61c into master Mar 29, 2017
@yavorsky yavorsky deleted the electron-as-target branch March 29, 2017 13:43
@malept
Copy link

malept commented Apr 1, 2017

FYI, this broke Electron Forge, because we assume that we can send a full Electron version (as a string) as a target version. Downgrading from 1.3.0 to 1.2.2 fixes it. I need to see if #231 fixes this for us.

@yavorsky
Copy link
Member Author

yavorsky commented Apr 2, 2017

Electron version value was inconsistent: all targets must be a number, but electron option accepted a string. For now, you can just parseFloat(electronVersion) before pass to preset-env options.

@malept Is it a problem to use numeric float value? 1.2 instead of "1.2.0" for ex. ? If yes, we could force #231 merge or publish a hotfix to accept electron value in a string unless #231 will be merged.

Update: electron/forge#187 will fix issue.

@MarshallOfSound
Copy link

@yavorsky Might have been inconsistent but this change should have been considered breaking and been bumped as such IMO 👍

@yavorsky
Copy link
Member Author

yavorsky commented Apr 2, 2017

@MarshallOfSound It was rather bug fix than breaking change 🙂. According to the docs, target must be only a number (unless we merge #231).

But yeah we should add this at least to the changelog.
Do you need some help with electron/forge#187 ? Seems like it will fully solve this.

@jquense
Copy link

jquense commented Apr 5, 2017

broke me too. I realize that the "correct" handling of this is a bit vague, but generally it'd be good side on the one that doesn't break folks, even if it was technically bug. Not a huge deal but just adding my voice. Thanks ya'll

@existentialism
Copy link
Member

@MarshallOfSound @jquense sorry for the unintentional breakage, we restored string version support for electron in https://github.com/babel/babel-preset-env/releases/tag/v1.3.3!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants