Merge pull request #3912 from thelounge/renovate/copy-webpack-plugin-6.x

Update dependency copy-webpack-plugin to v6
This commit is contained in:
Pavel Djundik 2020-05-16 21:36:58 +03:00 committed by GitHub
commit abb8566ce7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 401 additions and 333 deletions

View File

@ -79,7 +79,7 @@
"babel-loader": "8.1.0",
"babel-plugin-istanbul": "6.0.0",
"chai": "4.2.0",
"copy-webpack-plugin": "5.1.1",
"copy-webpack-plugin": "6.0.1",
"css-loader": "3.5.3",
"cssnano": "4.1.10",
"dayjs": "1.8.26",

View File

@ -19,6 +19,10 @@ describe("public folder", function () {
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
});
it("audio files are copied", function () {
expect(fs.existsSync(path.join(publicFolder, "audio", "pop.wav"))).to.be.true;
});
it("index HTML file is not copied", function () {
expect(fs.existsSync(path.join(publicFolder, "index.html"))).to.be.false;
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).to.be.false;
@ -32,6 +36,8 @@ describe("public folder", function () {
it("style files are built", function () {
expect(fs.existsSync(path.join(publicFolder, "css", "style.css"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "default.css"))).to.be.true;
expect(fs.existsSync(path.join(publicFolder, "themes", "morning.css"))).to.be.true;
});
it("style files contain expected content", function (done) {
@ -55,4 +61,15 @@ describe("public folder", function () {
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
.true;
});
it("service worker has cacheName set", function (done) {
fs.readFile(path.join(publicFolder, "service-worker.js"), "utf8", function (err, contents) {
expect(err).to.be.null;
expect(contents.includes("const cacheName =")).to.be.true;
expect(contents.includes("__HASH__")).to.be.false;
done();
});
});
});

View File

@ -91,42 +91,50 @@ const config = {
new MiniCssExtractPlugin({
filename: "css/style.css",
}),
new CopyPlugin([
{
from: "./node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff*",
to: "fonts/[name].[ext]",
},
{
from: "./client/js/loading-error-handlers.js",
to: "js/[name].[ext]",
},
{
from: "./client/*",
to: "[name].[ext]",
ignore: ["index.html.tpl", "service-worker.js"],
},
{
from: "./client/service-worker.js",
to: "[name].[ext]",
transform(content) {
return content
.toString()
.replace("__HASH__", isProduction ? Helper.getVersionCacheBust() : "dev");
new CopyPlugin({
patterns: [
{
from:
"./node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff*",
to: "fonts/[name].[ext]",
},
},
{
from: "./client/audio/*",
to: "audio/[name].[ext]",
},
{
from: "./client/img/*",
to: "img/[name].[ext]",
},
{
from: "./client/themes/*",
to: "themes/[name].[ext]",
},
]),
{
from: "./client/js/loading-error-handlers.js",
to: "js/[name].[ext]",
},
{
from: "./client/*",
to: "[name].[ext]",
globOptions: {
ignore: ["**/index.html.tpl", "**/service-worker.js"],
},
},
{
from: "./client/service-worker.js",
to: "[name].[ext]",
transform(content) {
return content
.toString()
.replace(
"__HASH__",
isProduction ? Helper.getVersionCacheBust() : "dev"
);
},
},
{
from: "./client/audio/*",
to: "audio/[name].[ext]",
},
{
from: "./client/img/*",
to: "img/[name].[ext]",
},
{
from: "./client/themes/*",
to: "themes/[name].[ext]",
},
],
}),
// socket.io uses debug, we don't need it
new webpack.NormalModuleReplacementPlugin(
/debug/,

637
yarn.lock

File diff suppressed because it is too large Load Diff