Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Support serving ES6 JS to clients #596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 10, 2017
Merged

Conversation

andrey-git
Copy link
Contributor

Add an option to serve ES6 JS to clients
Backend PR: home-assistant/core#10474

In addition to hass_frontend package with all the frontend content, generate hass_frontend_es6 that contains untranspiled* files.

(Not really untranspiled, as react JS is still transpiled to regular JS, and babel es2016 preset is used)

@balloob I didn't check that hassio-panel produces valid result.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

babelrc: false,
presets: [
[
'es2016',
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can just remove any preset completely?

If we want to use a preset, we should use browser-env.

Copy link
Member

Choose a reason for hiding this comment

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

Using babel-preset-env which takes in a browserlist query.

We can support latest 2 versions of Chrome, Firefox and Safari?

http://browserl.ist/?q=last+2+firefox+versions%2C+last+2+chrome+versions%2C+last+2+safari+versions

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed completely

],
plugins: [
'external-helpers',
'transform-object-rest-spread',
Copy link
Member

Choose a reason for hiding this comment

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

This one too is in the modern browsers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Browsers recognize it, but rollup doesn't.

]
],
plugins: [
'external-helpers',
Copy link
Member

Choose a reason for hiding this comment

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

If we don't transpile, we don't need this.

Copy link
Member

Choose a reason for hiding this comment

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

We need this if we do browser-env.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Without it a warning is issued. Lets keep it.

'external-helpers',
'transform-object-rest-spread',
[
'transform-react-jsx',
Copy link
Member

Choose a reason for hiding this comment

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

This is the only thing we need :-)

@@ -4,6 +4,7 @@ const runSequence = require('run-sequence');
gulp.task('default', () => {
return runSequence.use(gulp)(
'clean',
'build'
'build',
'build_es6'
Copy link
Member

@balloob balloob Nov 9, 2017

Choose a reason for hiding this comment

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

I know it's kind of too late now, but I think "modern" would have been a better suffix that would stand time as I can see us changing what we transpile.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe change to es5 and un-suffixed?

Copy link
Member

Choose a reason for hiding this comment

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

Oh I like that more. ES5 is a fixed goal.

sourceType: 'script',
presets: [
['es2015', { modules: false }]
es6 ? ['es2016'] : ['es2015', { modules: false }]
Copy link
Member

Choose a reason for hiding this comment

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

Should this be browser-env too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed completely

const fs = require('fs');
const path = require('path');
const swPrecache = require('sw-precache');
// var uglifyJS = require('uglify-js');
Copy link
Member

Choose a reason for hiding this comment

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

stale comment.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

Copy link

@houndci-bot houndci-bot left a comment

Choose a reason for hiding this comment

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

Some files could not be reviewed due to errors:

Oops! Something went wrong! :(
ESLint: 4.9.0.
ESLint couldn't find the plugin "eslint-plugin-html". This can happen for a couple different reasons:
1. If ESLint is installed globally, then make sure eslint-plugin-html is also installed globally. A globally-installed ESLint cannot find a locally-installed plugin.
2. If ESLint is installed locally, then it's likely that the plugin isn't installed correctly. Try reinstalling by running the following:
    npm i eslint-plugin-html@latest --save-dev
If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

@balloob
Copy link
Member

balloob commented Nov 10, 2017

@pvizeli reminder that I need to fix the Hass.io build before the next release.

@balloob balloob merged commit 583abed into home-assistant:master Nov 10, 2017
@andrey-git
Copy link
Contributor Author

Ouch, now if someone syncs FE they will get a broken experience until BE is submitted too.

@balloob
Copy link
Member

balloob commented Nov 11, 2017

Yeah, sorry about that 😞 thanks for the quick fix!

@andrey-git andrey-git deleted the es6 branch November 11, 2017 22:06
NovapaX pushed a commit to NovapaX/home-assistant-polymer that referenced this pull request Nov 13, 2017
* Support serving ES6 JS to clients

* Make es6 default dir and es5 a special dir

* Fix package building

* Fix build_frontend script
NovapaX pushed a commit to NovapaX/home-assistant-polymer that referenced this pull request Nov 15, 2017
* Support serving ES6 JS to clients

* Make es6 default dir and es5 a special dir

* Fix package building

* Fix build_frontend script
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
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.

4 participants