Update CopyPlugin options
This commit is contained in:
parent
c3d8855ec3
commit
bc7bf9870c
@ -19,6 +19,10 @@ describe("public folder", function () {
|
|||||||
expect(fs.existsSync(path.join(publicFolder, "thelounge.webmanifest"))).to.be.true;
|
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 () {
|
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"))).to.be.false;
|
||||||
expect(fs.existsSync(path.join(publicFolder, "index.html.tpl"))).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 () {
|
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"))).to.be.true;
|
||||||
expect(fs.existsSync(path.join(publicFolder, "css", "style.css.map"))).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) {
|
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
|
expect(fs.existsSync(path.join(publicFolder, "js", "loading-error-handlers.js"))).to.be
|
||||||
.true;
|
.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();
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -91,42 +91,50 @@ const config = {
|
|||||||
new MiniCssExtractPlugin({
|
new MiniCssExtractPlugin({
|
||||||
filename: "css/style.css",
|
filename: "css/style.css",
|
||||||
}),
|
}),
|
||||||
new CopyPlugin([
|
new CopyPlugin({
|
||||||
{
|
patterns: [
|
||||||
from: "./node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff*",
|
{
|
||||||
to: "fonts/[name].[ext]",
|
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");
|
|
||||||
},
|
},
|
||||||
},
|
{
|
||||||
{
|
from: "./client/js/loading-error-handlers.js",
|
||||||
from: "./client/audio/*",
|
to: "js/[name].[ext]",
|
||||||
to: "audio/[name].[ext]",
|
},
|
||||||
},
|
{
|
||||||
{
|
from: "./client/*",
|
||||||
from: "./client/img/*",
|
to: "[name].[ext]",
|
||||||
to: "img/[name].[ext]",
|
globOptions: {
|
||||||
},
|
ignore: ["**/index.html.tpl", "**/service-worker.js"],
|
||||||
{
|
},
|
||||||
from: "./client/themes/*",
|
},
|
||||||
to: "themes/[name].[ext]",
|
{
|
||||||
},
|
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
|
// socket.io uses debug, we don't need it
|
||||||
new webpack.NormalModuleReplacementPlugin(
|
new webpack.NormalModuleReplacementPlugin(
|
||||||
/debug/,
|
/debug/,
|
||||||
|
Loading…
Reference in New Issue
Block a user