MVP Gulp introduction (#334)

* Install gulp as dev dependency

* Placeholder gulpfile

* Replace rollup invocations with gulp

* Consolidate duplicated code

* Big cleanup of gulpfile

* Without cache test

* Revert "Without cache test"

This reverts commit 0e3881d8d7.
This commit is contained in:
Adam Mills 2017-07-13 12:08:26 -04:00 committed by Paulus Schoutsen
parent 8a2f881684
commit 2c69e001ee
11 changed files with 95 additions and 66 deletions

View File

@ -1,20 +1,3 @@
{
"presets": [
[
"es2015",
{
"modules": false
}
]
],
"plugins": [
"external-helpers",
"transform-object-rest-spread",
[
"transform-react-jsx",
{
"pragma":"h"
}
],
]
"presets": ["es2015"],
}

32
gulpfile.babel.js Normal file
View File

@ -0,0 +1,32 @@
'use strict';
import gulp from 'gulp';
import rollupEach from 'gulp-rollup-each';
import rollupConfig from './rollup.config';
gulp.task('run_rollup', () => {
return gulp.src([
'src/core.js',
'src/compatibility.js',
'panels/automation/editor.js',
'demo_data/demo_data.js',
])
.pipe(rollupEach(rollupConfig))
.pipe(gulp.dest('build-temp'));
});
gulp.task('ru_all', ['run_rollup'], () => {
gulp.src([
'build-temp/core.js',
'build-temp/compatibility.js',
])
.pipe(gulp.dest('build/'));
});
gulp.task('watch_ru_all', ['ru_all'], () => {
gulp.watch([
'src/**/*.js',
'panels/**/*.js',
'demo_data/**/*.js'
], ['ru_all']);
});

View File

@ -8,23 +8,16 @@
},
"scripts": {
"clean": "rm -rf build/* build-temp/*",
"js_dev": "node script/gen-service-worker.js && npm run 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",
"gulp": "gulp",
"js_dev": "node script/gen-service-worker.js && npm run gulp watch_ru_all",
"js_dev_demo": "BUILD_DEMO=1 npm run gulp watch_ru_all",
"js_prod": "BUILD_DEV=0 npm run gulp ru_all",
"js_demo": "BUILD_DEV=0 BUILD_DEMO=1 npm run gulp ru_all",
"frontend_html": "node script/vulcanize.js",
"frontend_prod": "npm run js_prod && npm run frontend_html",
"frontend_demo": "npm run js_demo && npm run frontend_html",
"ru_all": "npm run ru_automation && npm run ru_core && npm run ru_compatibility && npm run ru_demo",
"ru_automation": "rollup --config rollup/automation.js",
"ru_core": "rollup --config rollup/core.js",
"ru_compatibility": "rollup --config rollup/compatibility.js",
"ru_demo": "rollup --config rollup/demo.js",
"watch_ru_all": "(npm run watch_ru_automation & npm run watch_ru_core & npm run watch_ru_compatibility & npm run watch_ru_demo) && wait",
"watch_ru_automation": "rollup --config rollup/automation.js --watch --sourcemap inline",
"watch_ru_core": "rollup --config rollup/core.js --watch --sourcemap inline",
"watch_ru_compatibility": "rollup --config rollup/compatibility.js --watch --sourcemap inline",
"watch_ru_demo": "rollup --config rollup/demo.js --watch --sourcemap inline",
"ru_all": "npm run gulp ru_all",
"watch_ru_all": "npm run gulp watch_ru_all",
"lint_js": "eslint src panels preact-src --ext js,html",
"lint_html": "ls -1 src/home-assistant.html panels/**/ha-panel-*.html | xargs polymer lint --input",
"test": "npm run lint_js && npm run lint_html"
@ -47,6 +40,8 @@
"eslint-plugin-html": "^2.0.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-react": "^7.0.0",
"gulp": "^3.9.1",
"gulp-rollup-each": "^1.0.2",
"html-minifier": "^3.4.3",
"hydrolysis": "^1.24.1",
"polymer-cli": "^0.17.0",

View File

@ -9,6 +9,25 @@ const DEMO = !!JSON.parse(process.env.BUILD_DEMO || 'false');
const plugins = [
babel({
"babelrc": false,
"presets": [
[
"es2015",
{
"modules": false
}
]
],
"plugins": [
"external-helpers",
"transform-object-rest-spread",
[
"transform-react-jsx",
{
"pragma":"h"
}
],
]
}),
nodeResolve({

View File

@ -1,8 +0,0 @@
import config from './base-config';
export default Object.assign({}, config, {
entry: 'panels/automation/editor.js',
targets: [
{ dest: 'build-temp/editor.js', format: 'iife' },
],
});

View File

@ -1,8 +0,0 @@
import config from './base-config';
export default Object.assign({}, config, {
entry: 'src/compatibility.js',
targets: [
{ dest: 'build/compatibility.js', format: 'iife' },
],
});

View File

@ -1,8 +0,0 @@
import config from './base-config';
export default Object.assign({}, config, {
entry: 'src/app-core.js',
targets: [
{ dest: 'build/core.js', format: 'iife' },
],
});

View File

@ -1,8 +0,0 @@
import config from './base-config';
export default Object.assign({}, config, {
entry: 'demo_data/expose_window.js',
targets: [
{ dest: 'build-temp/demo_data.js', format: 'iife' },
],
});

View File

@ -1120,6 +1120,10 @@ better-assert@~1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/binaryextensions/-/binaryextensions-1.0.1.tgz#1e637488b35b58bda5f4774bf96a5212a8c90755"
bindings@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/bindings/-/bindings-1.2.1.tgz#14ad6113812d2d37d72e67b4cacb4bb726505f11"
bl@^1.0.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/bl/-/bl-1.2.0.tgz#1397e7ec42c5f5dc387470c500e34a9f6be9ea98"
@ -3114,6 +3118,13 @@ gulp-rename@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/gulp-rename/-/gulp-rename-1.2.2.tgz#3ad4428763f05e2764dec1c67d868db275687817"
gulp-rollup-each@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/gulp-rollup-each/-/gulp-rollup-each-1.0.2.tgz#71b033b81bbcb00d1e1be0e8af00e1c4adc1a22e"
dependencies:
rollup "^0.43.0"
vinyl-sourcemaps-apply "^0.2.1"
gulp-sourcemaps@1.6.0:
version "1.6.0"
resolved "https://registry.yarnpkg.com/gulp-sourcemaps/-/gulp-sourcemaps-1.6.0.tgz#b86ff349d801ceb56e1d9e7dc7bbcb4b7dee600c"
@ -4327,7 +4338,7 @@ mv@~2:
ncp "~2.0.0"
rimraf "~2.4.0"
nan@^2.0.8, nan@^2.3.3:
nan@^2.0.5, nan@^2.0.8, nan@^2.3.3:
version "2.5.0"
resolved "https://registry.yarnpkg.com/nan/-/nan-2.5.0.tgz#aa8f1e34531d807e9e27755b234b4a6ec0c152a8"
@ -5317,6 +5328,14 @@ rollup@^0.41.6:
dependencies:
source-map-support "^0.4.0"
rollup@^0.43.0:
version "0.43.1"
resolved "https://registry.yarnpkg.com/rollup/-/rollup-0.43.1.tgz#a7770af9711bd21dda977e7cce3d0f63fdfdfa04"
dependencies:
source-map-support "^0.4.0"
optionalDependencies:
weak "^1.0.1"
run-async@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/run-async/-/run-async-0.1.0.tgz#c8ad4a5e110661e402a7d21b530e009f25f8e389"
@ -5584,7 +5603,7 @@ source-map-support@^0.4.0, source-map-support@^0.4.2:
dependencies:
source-map "^0.5.3"
source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.3, source-map@~0.5.1:
source-map@0.5.x, source-map@^0.5.0, source-map@^0.5.1, source-map@^0.5.3, source-map@~0.5.1:
version "0.5.6"
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.6.tgz#75ce38f52bf0733c5a7f0c118d81334a2bb5f412"
@ -6323,6 +6342,12 @@ vinyl-fs@^2.2.0, vinyl-fs@^2.4.3:
vali-date "^1.0.0"
vinyl "^1.0.0"
vinyl-sourcemaps-apply@^0.2.1:
version "0.2.1"
resolved "https://registry.yarnpkg.com/vinyl-sourcemaps-apply/-/vinyl-sourcemaps-apply-0.2.1.tgz#ab6549d61d172c2b1b87be5c508d239c8ef87705"
dependencies:
source-map "^0.5.1"
vinyl@^0.4.0, vinyl@^0.4.3:
version "0.4.6"
resolved "https://registry.yarnpkg.com/vinyl/-/vinyl-0.4.6.tgz#2f356c87a550a255461f36bbeb2a5ba8bf784847"
@ -6419,6 +6444,13 @@ wd@^1.0.0:
underscore.string "3.3.4"
vargs "0.1.0"
weak@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/weak/-/weak-1.0.1.tgz#ab99aab30706959aa0200cb8cf545bb9cb33b99e"
dependencies:
bindings "^1.2.1"
nan "^2.0.5"
web-component-tester@^5.0.0, web-component-tester@^5.0.1:
version "5.0.1"
resolved "https://registry.yarnpkg.com/web-component-tester/-/web-component-tester-5.0.1.tgz#e7a833283d8cfff31aabe0bf678eb1206f3d2564"