You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@echarts.apache.org by wa...@apache.org on 2022/04/19 12:32:03 UTC
[echarts-website] 01/02: WIP: support PWA
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 <yh...@all-my-life.cn>
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: commits-unsubscribe@echarts.apache.org
For additional commands, e-mail: commits-help@echarts.apache.org