From b669e71146ff11718eda161d021a364752955053 Mon Sep 17 00:00:00 2001 From: Dobromir Popov Date: Sat, 6 Apr 2024 19:22:35 +0300 Subject: [PATCH] added wpa needed files. WPA is still WIP. --- .gitignore | 9 +++++ next.config.js | 17 ++++++---- package-lock.json | 30 +++++++++++++++++ package.json | 1 + pages/_app.tsx | 7 ---- pages/_document.js | 4 +++ pages/api/email.ts | 2 ++ pages/cart/publishers/myschedule.tsx | 4 +-- manifest.json => public/manifest.json | 6 ++-- server.js | 47 +++++++++++++++++++-------- 10 files changed, 95 insertions(+), 32 deletions(-) rename manifest.json => public/manifest.json (80%) diff --git a/.gitignore b/.gitignore index 738df3e..144dd26 100644 --- a/.gitignore +++ b/.gitignore @@ -19,6 +19,15 @@ next-env.d.ts .vercel .env*.local +# PWA files +**/public/sw.js +**/public/workbox-*.js +**/public/worker-*.js +**/public/sw.js.map +**/public/workbox-*.js.map +**/public/worker-*.js.map + + *.zip next-cart-app.zip diff --git a/next.config.js b/next.config.js index abc67f4..5df56b9 100644 --- a/next.config.js +++ b/next.config.js @@ -1,14 +1,17 @@ const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer'); -const withPWA = require("next-pwa"); +const withPWA = require("next-pwa")({ + dest: 'public' +}); + module.exports = withPWA({ - pwa: { - dest: "public", - // register: true, - // skipwaiting: true, - // disable: process.env.NODE_ENV === "development", - }, + // pwa: { + // dest: "public", + // // register: true, + // // skipwaiting: true, + // // disable: process.env.NODE_ENV === "development", + // }, typescript: { // !! WARN !! // Dangerously allow production builds to successfully complete even if diff --git a/package-lock.json b/package-lock.json index de48e85..21ca1c1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -84,6 +84,7 @@ "uuid": "^9.0.1", "webpack-bundle-analyzer": "^4.10.1", "winston": "^3.11.0", + "workbox": "^0.0.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz", "xlsx-style": "^0.8.13", "xml-js": "^1.6.11", @@ -5311,6 +5312,20 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, + "node_modules/babel-runtime": { + "version": "6.26.0", + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", + "integrity": "sha512-ITKNuq2wKlW1fJg9sSW52eepoYgZBggvOAHC0u/CYu/qxQ9EVzThCgR69BnSXLHjy2f7SY5zaQ4yt7H9ZVxY2g==", + "dependencies": { + "core-js": "^2.4.0", + "regenerator-runtime": "^0.11.0" + } + }, + "node_modules/babel-runtime/node_modules/regenerator-runtime": { + "version": "0.11.1", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz", + "integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg==" + }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -6418,6 +6433,13 @@ "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz", "integrity": "sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==" }, + "node_modules/core-js": { + "version": "2.6.12", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.6.12.tgz", + "integrity": "sha512-Kb2wC0fvsWfQrgk8HU5lW6U/Lcs8+9aaYcy4ZFc6DDlo4nZ7n70dEgE5rtR0oG6ufKDUnrwfWL1mXR5ljDatrQ==", + "deprecated": "core-js@<3.23.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Some versions have web compatibility issues. Please, upgrade your dependencies to the actual version of core-js.", + "hasInstallScript": true + }, "node_modules/core-js-compat": { "version": "3.36.1", "resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.36.1.tgz", @@ -16610,6 +16632,14 @@ "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", "integrity": "sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==" }, + "node_modules/workbox": { + "version": "0.0.0", + "resolved": "https://registry.npmjs.org/workbox/-/workbox-0.0.0.tgz", + "integrity": "sha512-/I5JIWHK18DDGGoXOZgOkOFLsiMQZlHLnwEzw328ZMU4TA21yFCw11YEnZ1CsOnSazl0DMbFmLJ6q5hpQhP/aQ==", + "dependencies": { + "babel-runtime": "6.x.x" + } + }, "node_modules/workbox-background-sync": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/workbox-background-sync/-/workbox-background-sync-7.0.0.tgz", diff --git a/package.json b/package.json index 3e68daf..989f05a 100644 --- a/package.json +++ b/package.json @@ -102,6 +102,7 @@ "uuid": "^9.0.1", "webpack-bundle-analyzer": "^4.10.1", "winston": "^3.11.0", + "workbox": "^0.0.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.19.1/xlsx-0.19.1.tgz", "xlsx-style": "^0.8.13", "xml-js": "^1.6.11", diff --git a/pages/_app.tsx b/pages/_app.tsx index 6538651..648d4a5 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -28,13 +28,6 @@ export default function App({ return ( <> - - {/* Other tags */} - - diff --git a/pages/_document.js b/pages/_document.js index b4b8b74..95bdd1e 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -7,6 +7,10 @@ class MyDocument extends Document { + diff --git a/pages/api/email.ts b/pages/api/email.ts index f565e5f..7c9fba5 100644 --- a/pages/api/email.ts +++ b/pages/api/email.ts @@ -290,6 +290,8 @@ export default async function handler(req, res) { } break; + + case "sendNewAssignmentEmails": default: return res.status(400).json({ message: "Invalid action" }); } diff --git a/pages/cart/publishers/myschedule.tsx b/pages/cart/publishers/myschedule.tsx index c7c4ee2..bf8a2d5 100644 --- a/pages/cart/publishers/myschedule.tsx +++ b/pages/cart/publishers/myschedule.tsx @@ -113,7 +113,7 @@ export default function MySchedulePage({ assignments }) { Добави в календар