summaryrefslogtreecommitdiff
path: root/app/build.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
committerMinteck <contact@minteck.org>2022-08-21 17:31:56 +0200
commita2df9a69dcc14cb70118cda2ded499055e7ee358 (patch)
tree6dd283e4e9452d38bce81ddaaae49b5335755842 /app/build.js
parent84dd0735820b16b60f600284d35183d76547a71f (diff)
downloadpluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.gz
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.tar.bz2
pluralconnect-a2df9a69dcc14cb70118cda2ded499055e7ee358.zip
m. update
Diffstat (limited to 'app/build.js')
-rw-r--r--app/build.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/app/build.js b/app/build.js
new file mode 100644
index 0000000..f31e572
--- /dev/null
+++ b/app/build.js
@@ -0,0 +1,26 @@
+const fs = require('fs');
+let original = fs.readFileSync("./sw.src.js").toString();
+
+let fileList = [
+ "/app/"
+];
+function files(dir, sdir) {
+ for (let file of fs.readdirSync(dir)) {
+ if (file.startsWith(".")) continue;
+
+ if (fs.lstatSync(dir + "/" + file).isDirectory()) {
+ files(dir + "/" + file, sdir + "/" + file);
+ } else {
+ if (sdir + "/" + file !== "/app/build.js" && sdir + "/" + file !== "/app/fronters/dl.js" && sdir + "/" + file !== "/app/sw.src.js" && !file.endsWith(".php")) {
+ fileList.push(sdir + "/" + file);
+ }
+ }
+ }
+}
+
+files(".", "/app");
+console.log(JSON.stringify(fileList, null, 2));
+
+original = original.replace('[["%CacheData%"]]', JSON.stringify(fileList, null, 4));
+
+fs.writeFileSync("./sw.js", fs.readFileSync("./localforage.js") + "\n\n" + original); \ No newline at end of file