From 572f92fd1ecbc31d3d9c3d349f268b6b15158141 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 3 Aug 2017 23:40:16 -0700 Subject: [PATCH] Migrate to Polymer 2 (#370) * Update bower.json to point at Polymer 2 * No longer use babel to run node scripts * Refer to CSS from static dir * Fix some panel bugs --- .babelrc | 3 -- .nvmrc | 2 +- bower.json | 6 +-- gulp/tasks/build.js | 35 ++++++++++------- gulp/tasks/clean.js | 4 +- gulp/tasks/default.js | 6 +-- gulp/tasks/rollup.js | 6 +-- gulpfile.babel.js => gulpfile.js | 0 package.json | 2 +- panels/automation/ha-automation-picker.html | 11 ------ panels/automation/ha-panel-automation.html | 2 + panels/map/ha-panel-map.html | 18 ++------- rollup.config.js | 12 +++--- yarn.lock | 43 +++------------------ 14 files changed, 50 insertions(+), 100 deletions(-) delete mode 100644 .babelrc rename gulpfile.babel.js => gulpfile.js (100%) diff --git a/.babelrc b/.babelrc deleted file mode 100644 index 169fbc0e24..0000000000 --- a/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["es2015"], -} diff --git a/.nvmrc b/.nvmrc index 913671cdf7..2b0aa21219 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -6.2 \ No newline at end of file +8.2.1 diff --git a/bower.json b/bower.json index a14acdacd9..5f1dc013c2 100644 --- a/bower.json +++ b/bower.json @@ -47,7 +47,7 @@ "paper-tabs": "PolymerElements/paper-tabs#^2.0.0", "paper-toast": "PolymerElements/paper-toast#^2.0.0", "paper-toggle-button": "PolymerElements/paper-toggle-button#^2.0.0", - "polymer": "Polymer/polymer#~1.9.2", + "polymer": "Polymer/polymer#~2.0.2", "polymer-sortablejs": "^0.1.3", "vaadin-combo-box": "vaadin/vaadin-combo-box#v2.0.0-alpha4", "vaadin-date-picker": "vaadin/vaadin-date-picker#v2.0.0-alpha1", @@ -109,7 +109,7 @@ "paper-tabs": "^2.0.0", "paper-toast": "^2.0.0", "paper-toggle-button": "^2.0.0", - "polymer": "~1.9.2", - "webcomponentsjs": "^0.7.24" + "polymer": "^2.0.2", + "webcomponentsjs": "^v1.0.2" } } diff --git a/gulp/tasks/build.js b/gulp/tasks/build.js index a20c03ef15..75196b03cc 100644 --- a/gulp/tasks/build.js +++ b/gulp/tasks/build.js @@ -1,26 +1,31 @@ -import buble from 'gulp-buble'; -import uglify from 'gulp-uglify'; -import { gulp as cssSlam } from 'css-slam'; -import gulp from 'gulp'; -import filter from 'gulp-filter'; -import htmlMinifier from 'gulp-html-minifier'; -import gulpif from 'gulp-if'; -import { PolymerProject, HtmlSplitter } from 'polymer-build'; -import { +const babel = require('gulp-babel'); +const uglify = require('gulp-uglify'); +const { gulp: cssSlam } = require('css-slam'); +const gulp = require('gulp'); +const filter = require('gulp-filter'); +const htmlMinifier = require('gulp-html-minifier'); +const gulpif = require('gulp-if'); +const { PolymerProject, HtmlSplitter } = require('polymer-build'); +const { composeStrategies, generateShellMergeStrategy, -} from 'polymer-bundler'; -import mergeStream from 'merge-stream'; -import rename from 'gulp-rename'; +} = require('polymer-bundler'); +const mergeStream = require('merge-stream'); +const rename = require('gulp-rename'); -import polymerConfig from '../../polymer'; +const polymerConfig = require('../../polymer'); function minifyStream(stream) { const sourcesHtmlSplitter = new HtmlSplitter(); return stream .pipe(sourcesHtmlSplitter.split()) - .pipe(gulpif(/\.js$/, buble())) - .pipe(gulpif(/\.js$/, uglify({ sourceMap : false }))) + .pipe(gulpif(/[^app]\.js$/, babel({ + sourceType: 'script', + presets: [ + ['es2015', { modules: false }] + ] + }))) + .pipe(gulpif(/\.js$/, uglify({ sourceMap: false }))) .pipe(gulpif(/\.css$/, cssSlam())) .pipe(gulpif(/\.html$/, cssSlam())) .pipe(gulpif(/\.html$/, htmlMinifier({ diff --git a/gulp/tasks/clean.js b/gulp/tasks/clean.js index 5110b23a0c..bc74493c62 100644 --- a/gulp/tasks/clean.js +++ b/gulp/tasks/clean.js @@ -1,5 +1,5 @@ -import del from 'del'; -import gulp from 'gulp'; +const del = require('del'); +const gulp = require('gulp'); gulp.task('clean', () => { return del(['build', 'build-temp']); diff --git a/gulp/tasks/default.js b/gulp/tasks/default.js index 3c0cce5f35..21d1494253 100644 --- a/gulp/tasks/default.js +++ b/gulp/tasks/default.js @@ -1,9 +1,9 @@ -import gulp from 'gulp'; -import runSequence from 'run-sequence'; +const gulp = require('gulp'); +const runSequence = require('run-sequence'); gulp.task('default', () => { return runSequence.use(gulp)( 'clean', - 'build', + 'build' ); }); diff --git a/gulp/tasks/rollup.js b/gulp/tasks/rollup.js index f6b449e5ef..b554296e8d 100644 --- a/gulp/tasks/rollup.js +++ b/gulp/tasks/rollup.js @@ -1,6 +1,6 @@ -import gulp from 'gulp'; -import rollupEach from 'gulp-rollup-each'; -import rollupConfig from '../../rollup.config'; +const gulp = require('gulp'); +const rollupEach = require('gulp-rollup-each'); +const rollupConfig = require('../../rollup.config'); gulp.task('run_rollup', () => { return gulp.src([ diff --git a/gulpfile.babel.js b/gulpfile.js similarity index 100% rename from gulpfile.babel.js rename to gulpfile.js diff --git a/package.json b/package.json index 4ed8b33fc1..d48c7c1854 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "preact": "^8.1.0" }, "devDependencies": { + "babel-core": "^6.25.0", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-react-jsx": "^6.24.1", @@ -40,7 +41,6 @@ "eslint-plugin-react": "^7.0.0", "gulp": "^3.9.1", "gulp-babel": "^6.1.2", - "gulp-buble": "^0.8.0", "gulp-filter": "^5.0.0", "gulp-html-minifier": "^0.1.8", "gulp-if": "^2.0.2", diff --git a/panels/automation/ha-automation-picker.html b/panels/automation/ha-automation-picker.html index e7f20ae4b3..fb44a2dcfb 100644 --- a/panels/automation/ha-automation-picker.html +++ b/panels/automation/ha-automation-picker.html @@ -24,11 +24,6 @@ padding: 16px; } - .content > paper-card:first-child { - margin-bottom: 16px; - color: var(--google-red-500); - } - paper-item { cursor: pointer; } @@ -59,12 +54,6 @@
- -
- Currently Chrome is the only supported browser. -
-
-
The automation editor allows you to create and edit automations. diff --git a/panels/automation/ha-panel-automation.html b/panels/automation/ha-panel-automation.html index 84240f7aac..cb0e13399d 100644 --- a/panels/automation/ha-panel-automation.html +++ b/panels/automation/ha-panel-automation.html @@ -32,6 +32,8 @@