This is an automated email from the ASF dual-hosted git repository.

wangzx pushed a commit to branch pwa
in repository https://gitbox.apache.org/repos/asf/echarts-website.git

commit 863807bb0b7137924a2e2eb2542684538b548bd8
Author: plainheart <[email protected]>
AuthorDate: Mon Apr 18 21:09:53 2022 +0800

    WIP: support PWA
---
 .htaccess             |  4 ++++
 .scripts/build-pwa.js | 18 ++++++++++++++++++
 .scripts/package.json | 11 -----------
 package.json          | 12 +++++++-----
 4 files changed, 29 insertions(+), 16 deletions(-)

diff --git a/.htaccess b/.htaccess
index d736965f..59ce4c5a 100644
--- a/.htaccess
+++ b/.htaccess
@@ -13,6 +13,10 @@ RedirectMatch 404 /\.asf\.yaml
     Header set Access-Control-Allow-Headers "*"
 </IfModule>
 
+<IfModule mod_mime.c>
+   # Manifest file
+   AddType application/manifest+json webmanifest
+</IfModule>
 
 <IfModule mod_expires.c>
     ExpiresActive on
diff --git a/.scripts/build-pwa.js b/.scripts/build-pwa.js
new file mode 100644
index 00000000..9e40dfab
--- /dev/null
+++ b/.scripts/build-pwa.js
@@ -0,0 +1,18 @@
+const { generateSW } = require('workbox-build');
+
+generateSW({
+    globDirectory: '../',
+    globPatterns: [
+      '**/*\.*'
+    ],
+    globIgnores: [
+      '**/*.map',
+      '\.*',
+      '**/node_modules/**',
+      '**/package*\.json',
+      'sw\.js',
+      'workbox*',
+    ],
+    sourcemap: false,
+    swDest: 'sw.js'
+});
\ No newline at end of file
diff --git a/.scripts/package.json b/.scripts/package.json
deleted file mode 100644
index 818aa3a9..00000000
--- a/.scripts/package.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
-  "name": "echarts-website",
-  "version": "1.0.0",
-  "dependencies": {
-    "globby": "^11.0.3"
-  },
-  "devDependencies": {
-    "node-fetch": "^2.6.1",
-    "minimist": "^1.2.5"
-  }
-}
diff --git a/package.json b/package.json
index 570e82b6..d2b6a73b 100644
--- a/package.json
+++ b/package.json
@@ -1,16 +1,18 @@
 {
   "name": "echarts-website",
   "version": "1.0.0",
-  "description": "",
   "scripts": {
+    "build:pwa": "node .scripts/build-pwa.js"
   },
   "devDependencies": {
-    "@jamesives/github-pages-deploy-action": "^4.1.3"
+    "@jamesives/github-pages-deploy-action": "^4.1.3",
+    "globby": "^11.1.0",
+    "minimist": "^1.2.5",
+    "node-fetch": "^2.6.1",
+    "workbox-build": "^6.5.3"
   },
   "repository": {
     "type": "git",
     "url": "git+https://github.com/apache/echarts-website.git";
-  },
-  "author": "",
-  "license": "ISC"
+  }
 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to