build: add livereload in watch mode

This commit is contained in:
Johannes Loher 2022-08-15 15:01:47 +02:00
parent b518ede0f9
commit 0afdb45449
3 changed files with 58 additions and 1 deletions

View file

@ -93,6 +93,7 @@
"prettier": "2.7.1", "prettier": "2.7.1",
"rimraf": "3.0.2", "rimraf": "3.0.2",
"rollup": "2.78.0", "rollup": "2.78.0",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-styles": "4.0.0", "rollup-plugin-styles": "4.0.0",
"rollup-plugin-swc3": "0.3.0", "rollup-plugin-swc3": "0.3.0",
"sass": "1.54.4", "sass": "1.54.4",

View file

@ -3,6 +3,7 @@
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
import copy from "@guanghechen/rollup-plugin-copy"; import copy from "@guanghechen/rollup-plugin-copy";
import livereload from "rollup-plugin-livereload";
import styles from "rollup-plugin-styles"; import styles from "rollup-plugin-styles";
import { swc } from "rollup-plugin-swc3"; import { swc } from "rollup-plugin-swc3";
@ -25,6 +26,7 @@ const staticFiles = [
"templates", "templates",
]; ];
const isProduction = process.env.NODE_ENV === "production"; const isProduction = process.env.NODE_ENV === "production";
const isWatch = process.env.ROLLUP_WATCH === "true";
/** /**
* @type {import('rollup').RollupOptions} * @type {import('rollup').RollupOptions}
@ -74,6 +76,7 @@ const config = {
], ],
verbose: true, verbose: true,
}), }),
isWatch && livereload(distDirectory),
], ],
}; };

View file

@ -2937,7 +2937,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.5.3": "chokidar@npm:>=3.0.0 <4.0.0, chokidar@npm:^3.5.0, chokidar@npm:^3.5.3":
version: 3.5.3 version: 3.5.3
resolution: "chokidar@npm:3.5.3" resolution: "chokidar@npm:3.5.3"
dependencies: dependencies:
@ -3754,6 +3754,7 @@ __metadata:
prettier: 2.7.1 prettier: 2.7.1
rimraf: 3.0.2 rimraf: 3.0.2
rollup: 2.78.0 rollup: 2.78.0
rollup-plugin-livereload: ^2.0.5
rollup-plugin-styles: 4.0.0 rollup-plugin-styles: 4.0.0
rollup-plugin-swc3: 0.3.0 rollup-plugin-swc3: 0.3.0
sass: 1.54.4 sass: 1.54.4
@ -6002,6 +6003,27 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"livereload-js@npm:^3.3.1":
version: 3.4.1
resolution: "livereload-js@npm:3.4.1"
checksum: 31a432b6ea7aafb445e2ec1f5d4c2db9ea20ff47816fdcb36e238b13798b11e9b2e731e5f10993a566b5bc6e5fb595f39000a6939d3d2d0baf1c16f4933cf8cf
languageName: node
linkType: hard
"livereload@npm:^0.9.1":
version: 0.9.3
resolution: "livereload@npm:0.9.3"
dependencies:
chokidar: ^3.5.0
livereload-js: ^3.3.1
opts: ">= 1.2.0"
ws: ^7.4.3
bin:
livereload: bin/livereload.js
checksum: c5d62a974f7206bad7f2f49f64efa28817132b3528d24eff5940ee392ca32464bb8a546fa6205bc31b372feee5ccf223ce440c70e765c2ae8955d1108a0a66d8
languageName: node
linkType: hard
"load-json-file@npm:^4.0.0": "load-json-file@npm:^4.0.0":
version: 4.0.0 version: 4.0.0
resolution: "load-json-file@npm:4.0.0" resolution: "load-json-file@npm:4.0.0"
@ -6708,6 +6730,13 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"opts@npm:>= 1.2.0":
version: 2.0.2
resolution: "opts@npm:2.0.2"
checksum: 9389c32a4df53bedb6142181c83e6d05d88bc564b813caf965d94df214b479ae3bbd91fe8f4c291851236caae289db479f6c09389e969eb8fbd7c78cac7b5311
languageName: node
linkType: hard
"p-finally@npm:^1.0.0": "p-finally@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "p-finally@npm:1.0.0" resolution: "p-finally@npm:1.0.0"
@ -7788,6 +7817,15 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"rollup-plugin-livereload@npm:^2.0.5":
version: 2.0.5
resolution: "rollup-plugin-livereload@npm:2.0.5"
dependencies:
livereload: ^0.9.1
checksum: f69c8c4f011ecb0f1b9c18009f6791a0113e925a4bbc07739d19d648460fda3586c1fe23d5332f279f12f047ad80be263e303608c77b033611d7501d24c4affa
languageName: node
linkType: hard
"rollup-plugin-styles@npm:4.0.0": "rollup-plugin-styles@npm:4.0.0":
version: 4.0.0 version: 4.0.0
resolution: "rollup-plugin-styles@npm:4.0.0" resolution: "rollup-plugin-styles@npm:4.0.0"
@ -9083,6 +9121,21 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"ws@npm:^7.4.3":
version: 7.5.9
resolution: "ws@npm:7.5.9"
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: ^5.0.2
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
checksum: c3c100a181b731f40b7f2fddf004aa023f79d64f489706a28bc23ff88e87f6a64b3c6651fbec3a84a53960b75159574d7a7385709847a62ddb7ad6af76f49138
languageName: node
linkType: hard
"ws@npm:~8.2.3": "ws@npm:~8.2.3":
version: 8.2.3 version: 8.2.3
resolution: "ws@npm:8.2.3" resolution: "ws@npm:8.2.3"