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
This commit is contained in:
Paulus Schoutsen 2017-08-03 23:40:16 -07:00 committed by GitHub
parent 17519cce30
commit 572f92fd1e
14 changed files with 50 additions and 100 deletions

View File

@ -1,3 +0,0 @@
{
"presets": ["es2015"],
}

2
.nvmrc
View File

@ -1 +1 @@
6.2
8.2.1

View File

@ -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"
}
}

View File

@ -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({

View File

@ -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']);

View File

@ -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'
);
});

View File

@ -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([

View File

@ -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",

View File

@ -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 @@
</app-header>
<div class='content'>
<paper-card>
<div class='card-content'>
Currently Chrome is the only supported browser.
</div>
</paper-card>
<paper-card heading='Pick automation to edit'>
<div class='card-content'>
The automation editor allows you to create and edit automations.

View File

@ -32,6 +32,8 @@
<template is='dom-if' if='[[!showEditor]]'>
<ha-automation-picker
narrow='[[narrow]]'
show-menu='[[showMenu]]'
automations='[[automations]]'
is-wide='[[isWide]]'
></ha-automation-picker>

View File

@ -8,12 +8,11 @@
<link rel="import" href="./ha-entity-marker.html">
<dom-module id="ha-panel-map">
<!-- this is somehow magically working with bundling, leave it for now -->
<link
rel="stylesheet"
href="../../bower_components/leaflet/dist/leaflet.css"
/>
<template>
<link
rel="stylesheet"
href="/static/images/leaflet/leaflet.css"
/>
<style include="ha-style">
#map {
height: calc(100% - 64px);
@ -54,15 +53,6 @@ Polymer({
},
attached: function () {
// The link tag is resolved relative to the _current_ url instead of the
// source HTML file. Vulcanized this is taken care off. Fix it in dev.
if (window.HASS_DEV) {
var style = document.createElement('link');
style.setAttribute(
'href', '/static/home-assistant-polymer/bower_components/leaflet/dist/leaflet.css');
style.setAttribute('rel', 'stylesheet');
this.shadowRoot.appendChild(style);
}
var map = this._map = window.L.map(this.$.map);
map.setView([51.505, -0.09], 13);
window.L.tileLayer(

View File

@ -1,8 +1,8 @@
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import babel from 'rollup-plugin-babel';
import uglify from 'rollup-plugin-uglify';
const commonjs = require('rollup-plugin-commonjs');
const nodeResolve = require('rollup-plugin-node-resolve');
const replace = require('rollup-plugin-replace');
const babel = require('rollup-plugin-babel');
const uglify = require('rollup-plugin-uglify');
const DEV = !!JSON.parse(process.env.BUILD_DEV || 'true');
const DEMO = !!JSON.parse(process.env.BUILD_DEMO || 'false');
@ -49,7 +49,7 @@ if (!DEV) {
plugins.push(uglify());
}
export default {
module.exports = {
format: 'iife',
exports: 'none',
treeshake: true,

View File

@ -522,23 +522,17 @@ accessibility-developer-tools@^2.10.0:
version "2.11.0"
resolved "https://registry.yarnpkg.com/accessibility-developer-tools/-/accessibility-developer-tools-2.11.0.tgz#2b669c802671672aed5c61c42a782082a2fc7d2c"
acorn-jsx@^3.0.0, acorn-jsx@^3.0.1:
acorn-jsx@^3.0.0:
version "3.0.1"
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-3.0.1.tgz#afdf9488fb1ecefc8348f6fb22f464e32a58b36b"
dependencies:
acorn "^3.0.4"
acorn-object-spread@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/acorn-object-spread/-/acorn-object-spread-1.0.0.tgz#48ead0f4a8eb16995a17a0db9ffc6acaada4ba68"
dependencies:
acorn "^3.1.0"
acorn@4.0.4, acorn@^4.0.1:
version "4.0.4"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.4.tgz#17a8d6a7a6c4ef538b814ec9abac2779293bf30a"
acorn@^3.0.4, acorn@^3.1.0, acorn@^3.3.0:
acorn@^3.0.4:
version "3.3.0"
resolved "https://registry.yarnpkg.com/acorn/-/acorn-3.3.0.tgz#45e37fb39e8da3f25baee3ff5369e2bb5f22017a"
@ -846,7 +840,7 @@ babel-core@6, babel-core@^6.24.1:
slash "^1.0.0"
source-map "^0.5.0"
babel-core@^6.0.2, babel-core@^6.18.2:
babel-core@^6.0.2, babel-core@^6.18.2, babel-core@^6.25.0:
version "6.25.0"
resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-6.25.0.tgz#7dd42b0463c742e9d5296deb3ec67a9322dad729"
dependencies:
@ -1770,18 +1764,6 @@ browserstack@^1.2.0:
dependencies:
https-proxy-agent "1.0.0"
buble@^0.13.1:
version "0.13.2"
resolved "https://registry.yarnpkg.com/buble/-/buble-0.13.2.tgz#5c4572728384ea704f1dc9e7a5da166c0d7ee2e4"
dependencies:
acorn "^3.3.0"
acorn-jsx "^3.0.1"
acorn-object-spread "^1.0.0"
chalk "^1.1.3"
magic-string "^0.14.0"
minimist "^1.2.0"
os-homedir "^1.0.1"
buffer-crc32@^0.2.1, buffer-crc32@~0.2.3:
version "0.2.13"
resolved "https://registry.yarnpkg.com/buffer-crc32/-/buffer-crc32-0.2.13.tgz#0d333e3f00eac50aa1454abd30ef8c2a5d9a7242"
@ -3712,15 +3694,6 @@ gulp-babel@^6.1.2:
through2 "^2.0.0"
vinyl-sourcemaps-apply "^0.2.0"
gulp-buble@^0.8.0:
version "0.8.0"
resolved "https://registry.yarnpkg.com/gulp-buble/-/gulp-buble-0.8.0.tgz#57ac36083a4e2bdd396453baf9afa15d8fc384c1"
dependencies:
buble "^0.13.1"
gulp-util "^3.0.7"
readable-stream "^2.1.0"
vinyl-sourcemaps-apply "^0.2.1"
gulp-filter@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/gulp-filter/-/gulp-filter-5.0.0.tgz#cfa81966fb67884f2ba754b067152929428d59bc"
@ -3798,7 +3771,7 @@ gulp-util@^2.2.20:
through2 "^0.5.0"
vinyl "^0.2.1"
gulp-util@^3.0.0, gulp-util@^3.0.6, gulp-util@^3.0.7, gulp-util@^3.0.8:
gulp-util@^3.0.0, gulp-util@^3.0.6, gulp-util@^3.0.8:
version "3.0.8"
resolved "https://registry.yarnpkg.com/gulp-util/-/gulp-util-3.0.8.tgz#0054e1e744502e27c04c187c3ecc505dd54bbb4f"
dependencies:
@ -4970,12 +4943,6 @@ lru-cache@^4.0.2:
pseudomap "^1.0.2"
yallist "^2.1.2"
magic-string@^0.14.0:
version "0.14.0"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.14.0.tgz#57224aef1701caeed273b17a39a956e72b172462"
dependencies:
vlq "^0.2.1"
magic-string@^0.15.2:
version "0.15.2"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.15.2.tgz#0681d7388741bbc3addaa65060992624c6c09e9c"
@ -6232,7 +6199,7 @@ readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable
string_decoder "~0.10.x"
util-deprecate "~1.0.1"
readable-stream@^2.0.6, readable-stream@^2.1.0, readable-stream@^2.1.4:
readable-stream@^2.0.6, readable-stream@^2.1.4:
version "2.3.3"
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.3.tgz#368f2512d79f9d46fdfc71349ae7878bbc1eb95c"
dependencies: