Skip to content

Commit

Permalink
Migrate to Rollup + Buble
Browse files Browse the repository at this point in the history
  • Loading branch information
balloob committed Jul 14, 2016
1 parent 7be7cf4 commit f7ecdd9
Show file tree
Hide file tree
Showing 17 changed files with 99 additions and 115 deletions.
4 changes: 0 additions & 4 deletions .babelrc

This file was deleted.

1 change: 1 addition & 0 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"polymer": "Polymer/polymer#~1.6",
"pikaday": "1.4",
"leaflet-map": "1.2.0",
"moment": "^2.14.1",
"iron-elements": "PolymerElements/iron-elements#~1.0.10",
"paper-elements": "PolymerElements/paper-elements#~1.0.7",
"google-apis": "GoogleWebComponents/google-apis#~1.1.6",
Expand Down
42 changes: 29 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,49 @@
"url": "https://github.com/balloob/home-assistant-polymer"
},
"scripts": {
"js_dev": "webpack --color --progress -d --watch",
"js_dev_demo": "BUILD_DEMO=1 webpack --color --progress -d --watch",
"js_prod": "BUILD_DEV=0 webpack --color --progress -p",
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 webpack --color --progress -p",
"frontend_html": "node script/vulcanize.js",
"setup_js_dev": "git submodule init && git submodule update && cd home-assistant-js && npm install",
"js_dev": "watch_ru_all",
"js_dev_demo": "BUILD_DEMO=1 npm run watch_ru_all",
"js_prod": "BUILD_DEV=0 npm run ru_all",
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 npm run ru_all",
"frontend_html": "script/vulcanize.js",
"frontend_prod": "npm run js_prod && npm run frontend_html",
"frontend_demo": "npm run js_demo && npm run frontend_html",
"setup_js_dev": "git submodule init && git submodule update && cd home-assistant-js && npm install",
"ru_all": "npm run ru_core | npm run ru_ui | npm run ru_demo",
"ru_core": "rollup --config rollup/core.js",
"ru_ui": "rollup --config rollup/ui.js",
"ru_demo": "rollup --config rollup/demo.js",
"watch_ru_all": "npm run watch_ru_core | npm run watch_ru_ui | npm run watch_ru_demo",
"watch_ru_core": "rollup --config rollup/core.js --watch",
"watch_ru_ui": "rollup --config rollup/ui.js --watch",
"watch_ru_demo": "rollup --config rollup/demo.js --watch",
"test": "eslint src"
},
"author": "Paulus Schoutsen <[email protected]> (http://paulusschoutsen.nl)",
"license": "MIT",
"_depComment": "keymirror, nuclear-js, object-assign are for ha-js",
"dependencies": {
"classnames": "^2.2.5",
"moment": "^2.14.1"
"keymirror": "^0.1.1",
"nuclear-js": "^1.3.0",
"object-assign": "^4.1.0",
"classnames": "^2.2.5"
},
"devDependencies": {
"babel-core": "^6.10",
"babel-loader": "^6.2",
"babel-preset-es2015-webpack": "^6.4.1",
"bower": "^1.7.9",
"eslint": "^3.0.1",
"eslint-config-airbnb-base": "^4.0.0",
"eslint-plugin-import": "^1.10.2",
"html-minifier": "^3.0.1",
"rollup": "^0.34.1",
"rollup-plugin-babel": "^2.6.1",
"rollup-plugin-buble": "^0.12.1",
"rollup-plugin-commonjs": "^3.1.0",
"rollup-plugin-multi-entry": "^2.0.0",
"rollup-plugin-node-resolve": "^1.7.1",
"rollup-plugin-replace": "^1.1.1",
"rollup-plugin-uglify": "^1.0.1",
"rollup-watch": "^2.5.0",
"sw-precache": "^3.2.0",
"vulcanize": "^1.14.8",
"webpack": "^2.1.0-beta.13"
"vulcanize": "^1.14.8"
}
}
34 changes: 34 additions & 0 deletions rollup/base-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
import buble from 'rollup-plugin-buble';
import uglify from 'rollup-plugin-uglify';

const DEV = !!JSON.parse(process.env.BUILD_DEV || 'true');
const DEMO = !!JSON.parse(process.env.BUILD_DEMO || 'false');

const plugins = [
nodeResolve(),

commonjs(),

replace({
values: {
__DEV__: JSON.stringify(DEV),
__DEMO__: JSON.stringify(DEMO),
},
}),

buble(),
];

if (!DEV) {
plugins.push(uglify());
}

export default {
format: 'iife',
exports: 'none',
treeshake: true,
plugins,
};
8 changes: 8 additions & 0 deletions rollup/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import config from './base-config';

export default Object.assign({}, config, {
entry: 'src/entry-points/app-core.js',
targets: [
{ dest: 'build/_core_compiled.js', format: 'iife' },
],
});
8 changes: 8 additions & 0 deletions rollup/demo.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import config from './base-config';

export default Object.assign({}, config, {
entry: 'home-assistant-js/demo_data/expose_window.js',
targets: [
{ dest: 'build/_demo_data_compiled.js', format: 'iife' },
],
});
8 changes: 8 additions & 0 deletions rollup/ui.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import config from './base-config';

export default Object.assign({}, config, {
entry: 'src/entry-points/home-assistant-main.js',
targets: [
{ dest: 'build/_ui_compiled.js', format: 'iife' },
],
});
48 changes: 0 additions & 48 deletions script/rollup.js

This file was deleted.

2 changes: 2 additions & 0 deletions script/vulcanize.js
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#! /usr/bin/env node

var Vulcanize = require('vulcanize');
var minify = require('html-minifier');
var fs = require('fs');
Expand Down
2 changes: 1 addition & 1 deletion src/entry-points/app-core.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import HomeAssistant from '../../home-assistant-js/dist/homeassistant.es6';
import HomeAssistant from '../../home-assistant-js/src/index';

const hass = new HomeAssistant();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<link rel='import' href='../layouts/partial-cards.html'>
<link rel='import' href='../layouts/partial-logbook.html'>
<link rel='import' href='../layouts/partial-history.html'>
<!-- <link rel='import' href='../layouts/partial-map.html'> -->
<link rel='import' href='../managers/notification-manager.html'>
<link rel="import" href="../dialogs/more-info-dialog.html">
<link rel="import" href="../dialogs/ha-voice-command-dialog.html">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import '../managers/notification-manager';
import '../dialogs/more-info-dialog';
import '../dialogs/ha-voice-command-dialog';

export default new Polymer({
Polymer({
is: 'home-assistant-main',

behaviors: [window.hassBehavior],
Expand Down
File renamed without changes.
12 changes: 6 additions & 6 deletions src/home-assistant.html
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<script src='../bower_components/moment/min/moment.min.js'></script>

<link rel='import' href='../bower_components/polymer/polymer.html'>
<link rel='import' href='../bower_components/paper-spinner/paper-spinner.html'>
<link rel='import' href='./util/roboto.html'>
Expand All @@ -6,8 +8,8 @@
<link rel="import" href="../bower_components/iron-iconset-svg/iron-iconset-svg.html">

<link rel='import' href='./util/hass-behavior.html'>
<link rel='import' href='./layouts/login-form.html'>
<link rel='import' href='./layouts/home-assistant-main.html'>
<link rel='import' href='./entry-points/login-form.html'>
<link rel='import' href='./entry-points/home-assistant-main.html'>
<link rel='import' href='./resources/home-assistant-style.html'>

<dom-module id='home-assistant'>
Expand All @@ -21,16 +23,14 @@
</style>

<template>
<home-assistant-main hass='[[hass]]' hidden$='[[!loaded]]'></home-assistant-main>

<template is='dom-if' if='[[!loaded]]'>
<login-form
hass='[[hass]]'
force-show-loading='[[computeForceShowLoading(dataLoaded, iconsLoaded)]]'>
</login-form>
</template>

<template is='dom-if' if='[[loaded]]'>
<home-assistant-main hass='[[hass]]' hidden$='[[!loaded]]'></home-assistant-main>
</template>
</template>
</dom-module>

Expand Down
5 changes: 0 additions & 5 deletions src/home-assistant.js

This file was deleted.

35 changes: 0 additions & 35 deletions webpack.config.js

This file was deleted.

0 comments on commit f7ecdd9

Please sign in to comment.