Skip to content

Commit f046d99

Browse files
authored
[optimize] upgrade Upsteam packages (#6)
1 parent acf7b16 commit f046d99

File tree

10 files changed

+59
-54
lines changed

10 files changed

+59
-54
lines changed

.github/workflows/main.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,16 @@ on:
33
push:
44
branches:
55
- master
6-
pull_request:
7-
branches:
8-
- master
96
jobs:
107
Build-and-Deploy:
118
runs-on: ubuntu-latest
129
steps:
1310
- name: Checkout
1411
uses: actions/checkout@v2
1512
- name: Use Node.js
16-
uses: actions/setup-node@v2-beta
13+
uses: actions/setup-node@v2
1714
with:
18-
node-version: '12'
15+
node-version: '14'
1916
- name: Install & build
2017
run: |
2118
npm install

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
npm test

.husky/pre-push

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
3+
. "$(dirname "$0")/_/husky.sh"
4+
5+
npm run build

.huskyrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@
77
".huskyrc": "json",
88
".lintstagedrc": "json",
99
".postcssrc": "json"
10-
}
10+
},
11+
"typescript.tsdk": "node_modules\\typescript\\lib"
1112
}

package.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,35 @@
99
"author": "JSCIG",
1010
"main": "source/index.html",
1111
"scripts": {
12+
"prepare": "husky install",
1213
"build": "rm -rf dist && npm run pack-dist && npm run pack-sw",
1314
"pack-dist": "parcel build source/index.html --public-url .",
1415
"pack-sw": "rm -f dist/sw.js.map && workbox generateSW",
15-
"start": "workbox generateSW && parcel source/index.html --open",
16+
"start": "parcel source/index.html --open",
1617
"test": "lint-staged"
1718
},
1819
"dependencies": {
19-
"boot-cell": "^1.4.0",
20-
"bootstrap-icons": "^1.1.0",
20+
"boot-cell": "^1.9.5",
2121
"browser-unhandled-rejection": "^1.0.2",
22-
"cell-router": "^2.0.1",
23-
"classnames": "^2.2.6",
24-
"koajax": "^0.6.4",
22+
"cell-router": "^2.0.4",
23+
"classnames": "^2.3.1",
24+
"koajax": "^0.7.0",
2525
"mobx": "^5.15.7",
26-
"mobx-web-cell": "^0.3.2",
27-
"web-cell": "^2.2.0",
28-
"web-utility": "^2.0.0"
26+
"mobx-web-cell": "^0.3.5",
27+
"web-cell": "^2.3.0",
28+
"web-utility": "^2.6.0"
2929
},
3030
"devDependencies": {
31-
"@types/classnames": "^2.2.11",
31+
"@types/classnames": "^2.3.1",
32+
"@types/node": "^14.17.9",
3233
"autoprefixer": "^9.8.6",
33-
"husky": "^4.3.0",
34-
"less": "^3.12.2",
35-
"lint-staged": "^10.5.2",
36-
"parcel": "^1.12.4",
34+
"husky": "^7.0.1",
35+
"less": "^4.1.1",
36+
"lint-staged": "^11.1.2",
37+
"parcel-bundler": "^1.12.5",
3738
"postcss-modules": "^3.2.2",
38-
"prettier": "^2.2.1",
39-
"typescript": "^4.1.2",
40-
"workbox-cli": "^4.3.1"
39+
"prettier": "^2.3.2",
40+
"typescript": "^4.3.5",
41+
"workbox-cli": "^6.2.2"
4142
}
4243
}

source/index.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,17 @@ self.addEventListener('unhandledrejection', event => {
1818

1919
const { serviceWorker } = window.navigator;
2020

21-
serviceWorker
22-
?.register('sw.js')
23-
.then(serviceWorkerUpdate)
24-
.then(worker => {
25-
if (window.confirm('检测到新版本,是否立即启用?'))
26-
worker.postMessage({ type: 'SKIP_WAITING' });
27-
});
21+
if (process.env.NODE_ENV !== 'development')
22+
serviceWorker
23+
?.register('sw.js')
24+
.then(serviceWorkerUpdate)
25+
.then(worker => {
26+
if (window.confirm('检测到新版本,是否立即启用?'))
27+
worker.postMessage({ type: 'SKIP_WAITING' });
28+
});
2829

2930
serviceWorker?.addEventListener('controllerchange', () =>
30-
window.location.reload()
31+
window.location.reload(),
3132
);
3233

3334
documentReady.then(() => render(<PageFrame />));

source/page/Main.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,9 @@ export class MainPage extends mixin() {
154154
</Button>
155155
<Button
156156
size="lg"
157+
color="primary"
157158
target="_blank"
158-
href="https://github.com/JSCIG/es-discuss/issues"
159+
href="https://github.com/JSCIG/es-discuss/discussions"
159160
>
160161
参与讨论
161162
</Button>

source/page/index.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { NavBar } from 'boot-cell/source/Navigator/NavBar';
44
import { NavLinkProps, NavLink } from 'boot-cell/source/Navigator/Nav';
55
import {
66
DropMenuItemProps,
7-
DropMenuItem
7+
DropMenuItem,
88
} from 'boot-cell/source/Navigator/DropMenu';
99

1010
import { history } from '../model';
@@ -20,7 +20,7 @@ const menu: NavMenu[] = [
2020
{
2121
title: '中文讨论',
2222
target: '_blank',
23-
href: 'https://github.com/JSCIG/es-discuss/discussions'
23+
href: 'https://github.com/JSCIG/es-discuss/discussions',
2424
},
2525
{ title: '开放组织', target: '_blank', href: 'https://github.com/JSCIG' },
2626
{
@@ -29,33 +29,36 @@ const menu: NavMenu[] = [
2929
{
3030
title: 'ECMAScript 语言',
3131
target: '_blank',
32-
href: 'https://tc39.es/ecma262/'
32+
href: 'https://tc39.es/ecma262/',
3333
},
3434
{
3535
title: 'ECMAScript 国际化 API',
3636
target: '_blank',
37-
href: 'https://tc39.es/ecma402/'
38-
}
39-
]
37+
href: 'https://tc39.es/ecma402/',
38+
},
39+
],
4040
},
4141
{
4242
title: '兼容表格',
4343
target: '_blank',
44-
href: 'https://kangax.github.io/compat-table/es6/'
44+
href: 'https://kangax.github.io/compat-table/es6/',
4545
},
4646
{ title: 'ES 6 学习', target: '_blank', href: 'http://es6-features.org/' },
47-
{ title: '技术委员会', target: '_blank', href: 'https://tc39.es/' }
47+
{ title: '技术委员会', target: '_blank', href: 'https://tc39.es/' },
4848
],
4949
routes: Route[] = [
5050
{ paths: [''], component: MainPage },
51-
{ paths: ['proposals'], component: ProposalPage }
51+
{ paths: ['proposals'], component: ProposalPage },
5252
];
5353

5454
export function PageFrame() {
5555
return (
5656
<>
5757
<NavBar
5858
narrow
59+
expand="md"
60+
theme="dark"
61+
background="dark"
5962
brand={
6063
<>
6164
<img
@@ -77,7 +80,7 @@ export function PageFrame() {
7780
<DropMenuItem {...rest}>{title}</DropMenuItem>
7881
))}
7982
</NavLink>
80-
)
83+
),
8184
)}
8285
</NavBar>
8386

workbox-config.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
module.exports = {
22
globDirectory: 'dist/',
3-
globPatterns: [
4-
'**/*.{html,css,js,json,webmanifest,ico,gif,jpg,jpeg,png,webp}'
5-
],
3+
globPatterns: ['**/*.{html,css,js,json,ico,gif,jpg,jpeg,png,webp}'],
64
swDest: 'dist/sw.js',
7-
importWorkboxFrom: 'disabled',
85
importScripts: [
9-
'https://cdn.jsdelivr.net/npm/workbox-sw@4.3.1/build/workbox-sw.min.js'
6+
'https://cdn.jsdelivr.net/npm/workbox-sw@6.2.2/build/workbox-sw.min.js',
107
],
118
clientsClaim: true,
12-
cleanupOutdatedCaches: true
9+
cleanupOutdatedCaches: true,
1310
};

0 commit comments

Comments
 (0)