Skip to content

[optimize] upgrade Upsteam packages #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Build-and-Deploy:
runs-on: ubuntu-latest
steps:
- 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
Expand Down
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm test
5 changes: 5 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh

. "$(dirname "$0")/_/husky.sh"

npm run build
6 changes: 0 additions & 6 deletions .huskyrc

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,6 @@
".huskyrc": "json",
".lintstagedrc": "json",
".postcssrc": "json"
}
},
"typescript.tsdk": "node_modules\\typescript\\lib"
}
35 changes: 18 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
17 changes: 9 additions & 8 deletions source/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<PageFrame />));
3 changes: 2 additions & 1 deletion source/page/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ export class MainPage extends mixin() {
</Button>
<Button
size="lg"
color="primary"
target="_blank"
href="https://github.com/JSCIG/es-discuss/issues"
href="https://github.com/JSCIG/es-discuss/discussions"
>
参与讨论
</Button>
Expand Down
23 changes: 13 additions & 10 deletions source/page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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' },
{
Expand All @@ -29,33 +29,36 @@ 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() {
return (
<>
<NavBar
narrow
expand="md"
theme="dark"
background="dark"
brand={
<>
<img
Expand All @@ -77,7 +80,7 @@ export function PageFrame() {
<DropMenuItem {...rest}>{title}</DropMenuItem>
))}
</NavLink>
)
),
)}
</NavBar>

Expand Down
9 changes: 3 additions & 6 deletions workbox-config.js
Original file line number Diff line number Diff line change
@@ -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,
};