You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
907 B
29 lines
907 B
/**
|
|
* We've seen cases where the functions inside safari-notifications.js are not found.
|
|
* This is our attempt to ensure that all the functions are available.
|
|
*/
|
|
|
|
const fs = require("fs");
|
|
const path = require("path");
|
|
|
|
const swScriptsDir = path.resolve(__dirname, "sw_scripts");
|
|
const outputFile = path.resolve(__dirname, "sw_scripts-combined.js");
|
|
|
|
// Read all files in the sw_scripts directory
|
|
fs.readdir(swScriptsDir, (err, files) => {
|
|
if (err) {
|
|
console.error("Error reading directory:", err);
|
|
return;
|
|
}
|
|
|
|
// Combine files content into one script
|
|
const combinedContent = files
|
|
.filter((file) => path.extname(file) === ".js")
|
|
.map((file) => fs.readFileSync(path.join(swScriptsDir, file), "utf8"))
|
|
.join("\n");
|
|
|
|
// Write the combined content to the output file
|
|
fs.writeFileSync(outputFile, combinedContent, "utf8");
|
|
|
|
console.log("Service worker files combined.");
|
|
});
|
|
|