diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index a12d3da..2643629 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -3,9 +3,6 @@ on:
push:
branches:
- master
- pull_request:
- branches:
- - master
jobs:
Build-and-Deploy:
runs-on: ubuntu-latest
@@ -13,9 +10,9 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js
- uses: actions/setup-node@v2-beta
+ uses: actions/setup-node@v2
with:
- node-version: '12'
+ node-version: '14'
- name: Install & build
run: |
npm install
diff --git a/.husky/pre-commit b/.husky/pre-commit
new file mode 100644
index 0000000..06c2b40
--- /dev/null
+++ b/.husky/pre-commit
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. "$(dirname "$0")/_/husky.sh"
+
+npm test
diff --git a/.husky/pre-push b/.husky/pre-push
new file mode 100644
index 0000000..952f7e3
--- /dev/null
+++ b/.husky/pre-push
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+. "$(dirname "$0")/_/husky.sh"
+
+npm run build
diff --git a/.huskyrc b/.huskyrc
deleted file mode 100644
index c205c18..0000000
--- a/.huskyrc
+++ /dev/null
@@ -1,6 +0,0 @@
-{
- "hooks": {
- "pre-commit": "npm test",
- "pre-push": "npm run build"
- }
-}
diff --git a/.vscode/settings.json b/.vscode/settings.json
index 9ee5b34..0c6ed38 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -7,5 +7,6 @@
".huskyrc": "json",
".lintstagedrc": "json",
".postcssrc": "json"
- }
+ },
+ "typescript.tsdk": "node_modules\\typescript\\lib"
}
diff --git a/package.json b/package.json
index fc62854..9ac4c2d 100644
--- a/package.json
+++ b/package.json
@@ -9,34 +9,35 @@
"author": "JSCIG",
"main": "source/index.html",
"scripts": {
+ "prepare": "husky install",
"build": "rm -rf dist && npm run pack-dist && npm run pack-sw",
"pack-dist": "parcel build source/index.html --public-url .",
"pack-sw": "rm -f dist/sw.js.map && workbox generateSW",
- "start": "workbox generateSW && parcel source/index.html --open",
+ "start": "parcel source/index.html --open",
"test": "lint-staged"
},
"dependencies": {
- "boot-cell": "^1.4.0",
- "bootstrap-icons": "^1.1.0",
+ "boot-cell": "^1.9.5",
"browser-unhandled-rejection": "^1.0.2",
- "cell-router": "^2.0.1",
- "classnames": "^2.2.6",
- "koajax": "^0.6.4",
+ "cell-router": "^2.0.4",
+ "classnames": "^2.3.1",
+ "koajax": "^0.7.0",
"mobx": "^5.15.7",
- "mobx-web-cell": "^0.3.2",
- "web-cell": "^2.2.0",
- "web-utility": "^2.0.0"
+ "mobx-web-cell": "^0.3.5",
+ "web-cell": "^2.3.0",
+ "web-utility": "^2.6.0"
},
"devDependencies": {
- "@types/classnames": "^2.2.11",
+ "@types/classnames": "^2.3.1",
+ "@types/node": "^14.17.9",
"autoprefixer": "^9.8.6",
- "husky": "^4.3.0",
- "less": "^3.12.2",
- "lint-staged": "^10.5.2",
- "parcel": "^1.12.4",
+ "husky": "^7.0.1",
+ "less": "^4.1.1",
+ "lint-staged": "^11.1.2",
+ "parcel-bundler": "^1.12.5",
"postcss-modules": "^3.2.2",
- "prettier": "^2.2.1",
- "typescript": "^4.1.2",
- "workbox-cli": "^4.3.1"
+ "prettier": "^2.3.2",
+ "typescript": "^4.3.5",
+ "workbox-cli": "^6.2.2"
}
}
diff --git a/source/index.tsx b/source/index.tsx
index 6bd7943..c303d12 100644
--- a/source/index.tsx
+++ b/source/index.tsx
@@ -18,16 +18,17 @@ self.addEventListener('unhandledrejection', event => {
const { serviceWorker } = window.navigator;
-serviceWorker
- ?.register('sw.js')
- .then(serviceWorkerUpdate)
- .then(worker => {
- if (window.confirm('检测到新版本,是否立即启用?'))
- worker.postMessage({ type: 'SKIP_WAITING' });
- });
+if (process.env.NODE_ENV !== 'development')
+ serviceWorker
+ ?.register('sw.js')
+ .then(serviceWorkerUpdate)
+ .then(worker => {
+ if (window.confirm('检测到新版本,是否立即启用?'))
+ worker.postMessage({ type: 'SKIP_WAITING' });
+ });
serviceWorker?.addEventListener('controllerchange', () =>
- window.location.reload()
+ window.location.reload(),
);
documentReady.then(() => render());
diff --git a/source/page/Main.tsx b/source/page/Main.tsx
index 3e9a4d2..b5f734a 100644
--- a/source/page/Main.tsx
+++ b/source/page/Main.tsx
@@ -154,8 +154,9 @@ export class MainPage extends mixin() {
diff --git a/source/page/index.tsx b/source/page/index.tsx
index b80204f..b1cb8de 100644
--- a/source/page/index.tsx
+++ b/source/page/index.tsx
@@ -4,7 +4,7 @@ import { NavBar } from 'boot-cell/source/Navigator/NavBar';
import { NavLinkProps, NavLink } from 'boot-cell/source/Navigator/Nav';
import {
DropMenuItemProps,
- DropMenuItem
+ DropMenuItem,
} from 'boot-cell/source/Navigator/DropMenu';
import { history } from '../model';
@@ -20,7 +20,7 @@ const menu: NavMenu[] = [
{
title: '中文讨论',
target: '_blank',
- href: 'https://github.com/JSCIG/es-discuss/discussions'
+ href: 'https://github.com/JSCIG/es-discuss/discussions',
},
{ title: '开放组织', target: '_blank', href: 'https://github.com/JSCIG' },
{
@@ -29,26 +29,26 @@ const menu: NavMenu[] = [
{
title: 'ECMAScript 语言',
target: '_blank',
- href: 'https://tc39.es/ecma262/'
+ href: 'https://tc39.es/ecma262/',
},
{
title: 'ECMAScript 国际化 API',
target: '_blank',
- href: 'https://tc39.es/ecma402/'
- }
- ]
+ href: 'https://tc39.es/ecma402/',
+ },
+ ],
},
{
title: '兼容表格',
target: '_blank',
- href: 'https://kangax.github.io/compat-table/es6/'
+ href: 'https://kangax.github.io/compat-table/es6/',
},
{ title: 'ES 6 学习', target: '_blank', href: 'http://es6-features.org/' },
- { title: '技术委员会', target: '_blank', href: 'https://tc39.es/' }
+ { title: '技术委员会', target: '_blank', href: 'https://tc39.es/' },
],
routes: Route[] = [
{ paths: [''], component: MainPage },
- { paths: ['proposals'], component: ProposalPage }
+ { paths: ['proposals'], component: ProposalPage },
];
export function PageFrame() {
@@ -56,6 +56,9 @@ export function PageFrame() {
<>
{title}
))}
- )
+ ),
)}
diff --git a/workbox-config.js b/workbox-config.js
index 6511c49..62a6fa0 100644
--- a/workbox-config.js
+++ b/workbox-config.js
@@ -1,13 +1,10 @@
module.exports = {
globDirectory: 'dist/',
- globPatterns: [
- '**/*.{html,css,js,json,webmanifest,ico,gif,jpg,jpeg,png,webp}'
- ],
+ globPatterns: ['**/*.{html,css,js,json,ico,gif,jpg,jpeg,png,webp}'],
swDest: 'dist/sw.js',
- importWorkboxFrom: 'disabled',
importScripts: [
- 'https://cdn.jsdelivr.net/npm/workbox-sw@4.3.1/build/workbox-sw.min.js'
+ 'https://cdn.jsdelivr.net/npm/workbox-sw@6.2.2/build/workbox-sw.min.js',
],
clientsClaim: true,
- cleanupOutdatedCaches: true
+ cleanupOutdatedCaches: true,
};