Random Rollup tweaks (#6034)

This commit is contained in:
Paulus Schoutsen 2020-05-25 01:12:42 -07:00 committed by GitHub
parent 1876b3827f
commit b8e71609db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 11 deletions

View File

@ -56,14 +56,16 @@ function watchRollup(createConfig, extraWatchSrc = [], serveOptions) {
...inputOptions, ...inputOptions,
output: [outputOptions], output: [outputOptions],
watch: { watch: {
include: ["src"] + extraWatchSrc, include: ["src/**"] + extraWatchSrc,
}, },
}); });
let startedHttp = false; let startedHttp = false;
watcher.on("event", (event) => { watcher.on("event", (event) => {
if (event.code === "ERROR") { if (event.code === "BUNDLE_END") {
log(`Build done @ ${new Date().toLocaleTimeString()}`);
} else if (event.code === "ERROR") {
log.error(event.error); log.error(event.error);
} else if (event.code === "END") { } else if (event.code === "END") {
if (startedHttp || !serveOptions) { if (startedHttp || !serveOptions) {
@ -90,18 +92,18 @@ gulp.task("rollup-watch-app", () => {
}); });
gulp.task("rollup-watch-hassio", () => { gulp.task("rollup-watch-hassio", () => {
watchRollup(rollupConfig.createHassioConfig, ["hassio/src"]); watchRollup(rollupConfig.createHassioConfig, ["hassio/src/**"]);
}); });
gulp.task("rollup-dev-server-demo", () => { gulp.task("rollup-dev-server-demo", () => {
watchRollup(rollupConfig.createDemoConfig, ["demo/src"], { watchRollup(rollupConfig.createDemoConfig, ["demo/src/**"], {
root: paths.demo_output_root, root: paths.demo_output_root,
port: 8090, port: 8090,
}); });
}); });
gulp.task("rollup-dev-server-cast", () => { gulp.task("rollup-dev-server-cast", () => {
watchRollup(rollupConfig.createCastConfig, ["cast/src"], { watchRollup(rollupConfig.createCastConfig, ["cast/src/**"], {
root: paths.cast_output_root, root: paths.cast_output_root,
port: 8080, port: 8080,
networkAccess: true, networkAccess: true,
@ -109,7 +111,7 @@ gulp.task("rollup-dev-server-cast", () => {
}); });
gulp.task("rollup-dev-server-gallery", () => { gulp.task("rollup-dev-server-gallery", () => {
watchRollup(rollupConfig.createGalleryConfig, ["gallery/src"], { watchRollup(rollupConfig.createGalleryConfig, ["gallery/src/**"], {
root: paths.gallery_output_root, root: paths.gallery_output_root,
port: 8100, port: 8100,
}); });

View File

@ -115,6 +115,7 @@ module.exports = function (opts = {}) {
if (resolvedWorkerFile in refIds) { if (resolvedWorkerFile in refIds) {
chunkRefId = refIds[resolvedWorkerFile]; chunkRefId = refIds[resolvedWorkerFile];
} else { } else {
this.addWatchFile(resolvedWorkerFile);
const source = await getBundledWorker( const source = await getBundledWorker(
resolvedWorkerFile, resolvedWorkerFile,
rollupOptions rollupOptions

View File

@ -96,9 +96,12 @@ const createRollupConfig = ({
// https://rollupjs.org/guide/en/#outputentryfilenames // https://rollupjs.org/guide/en/#outputentryfilenames
// https://rollupjs.org/guide/en/#outputchunkfilenames // https://rollupjs.org/guide/en/#outputchunkfilenames
// https://rollupjs.org/guide/en/#outputassetfilenames // https://rollupjs.org/guide/en/#outputassetfilenames
entryFileNames: isProdBuild ? "[name]-[hash].js" : "[name].js", entryFileNames:
chunkFileNames: isProdBuild ? "c.[hash].js" : "[name].js", isProdBuild && !isStatsBuild ? "[name]-[hash].js" : "[name].js",
assetFileNames: isProdBuild ? "a.[hash].js" : "[name].js", chunkFileNames:
isProdBuild && !isStatsBuild ? "c.[hash].js" : "[name].js",
assetFileNames:
isProdBuild && !isStatsBuild ? "a.[hash].js" : "[name].js",
// https://rollupjs.org/guide/en/#outputsourcemap // https://rollupjs.org/guide/en/#outputsourcemap
sourcemap: isProdBuild ? true : "inline", sourcemap: isProdBuild ? true : "inline",
}, },

View File

@ -1,6 +1,6 @@
{ {
"background_color": "#FFFFFF", "background_color": "#FFFFFF",
"description": "Open-source home automation platform running on Python 3.", "description": "Home automation platform that puts local control and privacy first.",
"dir": "ltr", "dir": "ltr",
"display": "standalone", "display": "standalone",
"icons": [ "icons": [
@ -31,7 +31,7 @@
], ],
"lang": "en-US", "lang": "en-US",
"name": "Home Assistant Demo", "name": "Home Assistant Demo",
"short_name": "Demo", "short_name": "HA Demo",
"start_url": "/?homescreen=1", "start_url": "/?homescreen=1",
"theme_color": "#03A9F4" "theme_color": "#03A9F4"
} }