mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-13 20:36:35 +00:00
Build ES5/ES6 in parallel to share gulp deps (#615)
* Build ES5/ES6 in parallel to share gulp deps * Rollup es5 files into build-temp-es5 * Use correct ES5 path for compatibility.js
This commit is contained in:
parent
41e97a6f83
commit
3ff9fe1041
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,6 +1,7 @@
|
|||||||
build/*
|
build/*
|
||||||
build-temp/*
|
build-temp/*
|
||||||
build-es5/*
|
build-es5/*
|
||||||
|
build-temp-es5/*
|
||||||
build-translations/*
|
build-translations/*
|
||||||
node_modules/*
|
node_modules/*
|
||||||
bower_components/*
|
bower_components/*
|
||||||
|
@ -59,4 +59,6 @@ function build(es6) {
|
|||||||
.pipe(gulp.dest(es6 ? 'build' : 'build-es5'));
|
.pipe(gulp.dest(es6 ? 'build' : 'build-es5'));
|
||||||
}
|
}
|
||||||
gulp.task('build_es5', ['ru_all_es5', 'build-translations'], () => build(/* es6= */ false));
|
gulp.task('build_es5', ['ru_all_es5', 'build-translations'], () => build(/* es6= */ false));
|
||||||
gulp.task('build', ['ru_all', 'build-translations'], () => build(/* es6= */ true));
|
gulp.task('build_es6', ['ru_all', 'build-translations'], () => build(/* es6= */ true));
|
||||||
|
|
||||||
|
gulp.task('build', ['build_es5', 'build_es6']);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const del = require('del');
|
const del = require('del');
|
||||||
const gulp = require('gulp');
|
const gulp = require('gulp');
|
||||||
|
|
||||||
gulp.task('clean', () => del(['build-es5', 'build', 'build-temp', 'build-translations']));
|
gulp.task('clean', () => del(['build-es5', 'build', 'build-temp-es5', 'build-temp', 'build-translations']));
|
||||||
|
@ -3,6 +3,5 @@ const runSequence = require('run-sequence');
|
|||||||
|
|
||||||
gulp.task('default', () => runSequence.use(gulp)(
|
gulp.task('default', () => runSequence.use(gulp)(
|
||||||
'clean',
|
'clean',
|
||||||
'build_es5',
|
|
||||||
'build',
|
'build',
|
||||||
));
|
));
|
||||||
|
@ -17,7 +17,7 @@ function generateIndex(es6) {
|
|||||||
const toReplace = [
|
const toReplace = [
|
||||||
['/home-assistant-polymer/hass_frontend/mdi.html',
|
['/home-assistant-polymer/hass_frontend/mdi.html',
|
||||||
`/static/mdi-${md5(path.resolve(config.output, 'mdi.html'))}.html`],
|
`/static/mdi-${md5(path.resolve(config.output, 'mdi.html'))}.html`],
|
||||||
['/home-assistant-polymer/build-temp/compatibility.js',
|
['/home-assistant-polymer/build-temp-es5/compatibility.js',
|
||||||
`/static/compatibility-${md5(path.resolve(config.output_es5, 'compatibility.js'))}.js`],
|
`/static/compatibility-${md5(path.resolve(config.output_es5, 'compatibility.js'))}.js`],
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ async function buildHassioPanel(es6) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
return minifyStream(stream, es6)
|
return minifyStream(stream, es6)
|
||||||
.pipe(rename(`hassio-main-${es6 ? 'latest' : 'es5'}.html`))
|
.pipe(rename('hassio-main.html'))
|
||||||
.pipe(gulp.dest('build-temp'));
|
.pipe(gulp.dest(es6 ? 'build-temp' : 'build-temp-es5'));
|
||||||
}
|
}
|
||||||
|
|
||||||
gulp.task('hassio-panel-es5', buildHassioPanel.bind(null, /* es6= */ false));
|
gulp.task('hassio-panel-es5', buildHassioPanel.bind(null, /* es6= */ false));
|
||||||
|
@ -11,7 +11,7 @@ gulp.task('run_rollup_es5', () => gulp.src([
|
|||||||
'demo_data/demo_data.js',
|
'demo_data/demo_data.js',
|
||||||
])
|
])
|
||||||
.pipe(rollupEach(rollupConfig, rollupConfig))
|
.pipe(rollupEach(rollupConfig, rollupConfig))
|
||||||
.pipe(gulp.dest('build-temp')));
|
.pipe(gulp.dest('build-temp-es5')));
|
||||||
|
|
||||||
gulp.task('run_rollup', () => gulp.src([
|
gulp.task('run_rollup', () => gulp.src([
|
||||||
'js/core.js',
|
'js/core.js',
|
||||||
@ -24,8 +24,8 @@ gulp.task('run_rollup', () => gulp.src([
|
|||||||
|
|
||||||
gulp.task('ru_all_es5', ['run_rollup_es5'], () => {
|
gulp.task('ru_all_es5', ['run_rollup_es5'], () => {
|
||||||
gulp.src([
|
gulp.src([
|
||||||
'build-temp/core.js',
|
'build-temp-es5/core.js',
|
||||||
'build-temp/compatibility.js',
|
'build-temp-es5/compatibility.js',
|
||||||
])
|
])
|
||||||
.pipe(gulp.dest('build-es5/'));
|
.pipe(gulp.dest('build-es5/'));
|
||||||
});
|
});
|
||||||
|
@ -83,7 +83,7 @@
|
|||||||
if (compatibilityRequired) {
|
if (compatibilityRequired) {
|
||||||
var e = document.createElement('script');
|
var e = document.createElement('script');
|
||||||
e.onerror = initError;
|
e.onerror = initError;
|
||||||
e.src = '/home-assistant-polymer/build-temp/compatibility.js';
|
e.src = '/home-assistant-polymer/build-temp-es5/compatibility.js';
|
||||||
document.head.appendChild(e);
|
document.head.appendChild(e);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
"url": "https://github.com/home-assistant/home-assistant-polymer"
|
"url": "https://github.com/home-assistant/home-assistant-polymer"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"clean": "rm -rf build/* build-temp/* build-es5/* build-translations/*",
|
"clean": "rm -rf build/* build-temp/* build-es5/* build-temp-es5/* build-translations/*",
|
||||||
"gulp": "gulp",
|
"gulp": "gulp",
|
||||||
"build": "BUILD_DEV=0 gulp",
|
"build": "BUILD_DEV=0 gulp",
|
||||||
"build_demo": "BUILD_DEV=0 BUILD_DEMO=1 gulp",
|
"build_demo": "BUILD_DEV=0 BUILD_DEMO=1 gulp",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user