Skip to content

Commit b181b09

Browse files
authored
[refactor] upgrade to WebCell v3, CellRouter v3 & BootCell v2 (#10)
* [refactor] upgrade to WebCell v3, CellRouter v3 & BootCell v2 [optimize] upgrade Upstream packages * [add] GitHub actions of Vercel preview [add] Web Polyfill service links [migrate] replace NPM with PNPM to reduce Disk Usage
1 parent 0f0ed8f commit b181b09

25 files changed

+6743
-450
lines changed

.github/workflows/main.yml

+28-9
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,40 @@ on:
55
- master
66
jobs:
77
Build-and-Deploy:
8+
env:
9+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
10+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
11+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
812
runs-on: ubuntu-latest
913
steps:
10-
- name: Checkout
11-
uses: actions/checkout@v2
12-
- name: Use Node.js
13-
uses: actions/setup-node@v2
14+
- uses: actions/checkout@v3
15+
16+
- uses: pnpm/action-setup@v2
1417
with:
15-
node-version: '14'
16-
- name: Install & build
18+
version: 8
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
cache: pnpm
23+
- name: Install & Build
1724
run: |
18-
npm install
19-
npm run build
20-
- name: Deploy
25+
pnpm i --frozen-lockfile
26+
pnpm build
27+
28+
- name: Deploy to GitHub pages
2129
uses: peaceiris/actions-gh-pages@v3
2230
with:
2331
publish_dir: ./dist
2432
personal_token: ${{ secrets.GITHUB_TOKEN }}
2533
force_orphan: true
34+
35+
- name: Deploy to Vercel
36+
uses: amondnet/vercel-action@v25
37+
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
38+
with:
39+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
40+
github-token: ${{ secrets.GITHUB_TOKEN }}
41+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
42+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
43+
working-directory: ./dist
44+
vercel-args: --prod

.github/workflows/push.yml

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Commit preview
2+
on:
3+
push:
4+
branches-ignore:
5+
- master
6+
jobs:
7+
Build-and-Deploy:
8+
env:
9+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
10+
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
11+
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: pnpm/action-setup@v2
17+
with:
18+
version: 8
19+
- uses: actions/setup-node@v3
20+
with:
21+
node-version: 18
22+
cache: pnpm
23+
- name: Install & Build
24+
run: |
25+
pnpm i --frozen-lockfile
26+
pnpm build
27+
28+
- uses: amondnet/vercel-action@v25
29+
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }}
30+
with:
31+
vercel-token: ${{ secrets.VERCEL_TOKEN }}
32+
github-token: ${{ secrets.GITHUB_TOKEN }}
33+
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }}
34+
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }}
35+
working-directory: ./dist

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/.cache
1+
/.parcel-cache
22
/dist
33
/node_modules
44
package-lock.json

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
auto-install-peers = false

.parcelrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"extends": "@parcel/config-default",
3+
"transformers": {
4+
"*.{ts,tsx}": [
5+
"@parcel/transformer-typescript-tsc"
6+
]
7+
}
8+
}

.postcssrc

-8
This file was deleted.

.vscode/settings.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"editor.formatOnSave": true,
33
"editor.codeActionsOnSave": {
4-
"source.fixAll": true
4+
"source.fixAll": "explicit"
55
},
66
"files.associations": {
77
".huskyrc": "json",

README.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
# JavaScript Chinese Interest Group
22

3-
[![NPM Dependency](https://david-dm.org/JSCIG/jscig.github.io.svg)][1]
4-
[![CI & CD](https://github.com/JSCIG/jscig.github.io/workflows/CI%20&%20CD/badge.svg)][2]
3+
[![CI & CD](https://github.com/JSCIG/jscig.github.io/actions/workflows/main.yml/badge.svg)][2]
54

65
JavaScript 中文讨论组致力于提供一个加强中国 JavaScript 社区对 JavaScript 语言标准(ECMAScript)工作的参与的平台。
76

@@ -13,14 +12,15 @@ JavaScript 中文讨论组致力于提供一个加强中国 JavaScript 社区对
1312

1413
## 官网开发
1514

16-
本网站是一个基于 [WebCell v2](https://web-cell.dev) 的纯 Web 前端项目,参与开发的基本命令如下:
15+
本网站是一个基于 [WebCell v3](https://web-cell.dev) 的纯 Web 前端项目,参与开发的基本命令如下:
1716

1817
```bash
1918
git clone https://github.com/JSCIG/jscig.github.io
2019
cd jscig.github.io
21-
npm install
20+
21+
npm i pnpm -g
22+
pnpm i
2223
npm start
2324
```
2425

25-
[1]: https://david-dm.org/JSCIG/jscig.github.io
26-
[2]: https://github.com/JSCIG/jscig.github.io/actions
26+
[2]: https://github.com/JSCIG/jscig.github.io/actions/workflows/main.yml

package.json

+27-24
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,46 @@
11
{
22
"name": "@jscig/official",
3-
"version": "0.5.0",
3+
"version": "0.6.0",
44
"private": true,
55
"description": "Official Web site of JavaScript Chinese Interest Group",
66
"homepage": "https://jscig.github.io/",
77
"repository": "https://github.com/JSCIG/jscig.github.io",
88
"license": "UNLICENSED",
99
"author": "JSCIG",
10-
"main": "source/index.html",
1110
"scripts": {
1211
"prepare": "husky install",
13-
"build": "rm -rf dist && npm run pack-dist && npm run pack-sw",
14-
"pack-dist": "parcel build source/index.html --public-url .",
12+
"clean": "rm -rf .parcel-cache/ dist/",
13+
"build": "npm run pack-dist && npm run pack-sw",
14+
"pack-dist": "npm run clean && parcel build source/index.html --public-url .",
1515
"pack-sw": "rm -f dist/sw.js.map && workbox generateSW",
16-
"start": "parcel source/index.html --open",
16+
"start": "npm run clean && parcel source/index.html --open",
1717
"test": "lint-staged"
1818
},
1919
"dependencies": {
20-
"boot-cell": "^1.9.5",
20+
"boot-cell": "^2.0.0-beta.7",
2121
"browser-unhandled-rejection": "^1.0.2",
22-
"cell-router": "^2.0.4",
23-
"classnames": "^2.3.1",
24-
"koajax": "^0.7.0",
25-
"mobx": "^5.15.7",
26-
"mobx-web-cell": "^0.3.5",
27-
"web-cell": "^2.3.0",
28-
"web-utility": "^2.6.2"
22+
"cell-router": "^3.0.0-rc.5",
23+
"classnames": "^2.5.1",
24+
"dom-renderer": "^2.0.6",
25+
"koajax": "^0.9.6",
26+
"mobx": "^6.12.0",
27+
"web-cell": "^3.0.0-rc.8",
28+
"web-utility": "^4.1.3"
2929
},
3030
"devDependencies": {
31-
"@types/classnames": "^2.3.1",
32-
"@types/node": "^14.17.9",
33-
"autoprefixer": "^9.8.6",
34-
"husky": "^7.0.1",
35-
"less": "^4.1.1",
36-
"lint-staged": "^11.1.2",
37-
"parcel-bundler": "^1.12.5",
38-
"postcss-modules": "^3.2.2",
39-
"prettier": "^2.3.2",
40-
"typescript": "^4.3.5",
41-
"workbox-cli": "^6.2.2"
31+
"@parcel/config-default": "~2.11.0",
32+
"@parcel/packager-raw-url": "~2.11.0",
33+
"@parcel/transformer-less": "2.11.0",
34+
"@parcel/transformer-typescript-tsc": "~2.11.0",
35+
"@parcel/transformer-webmanifest": "~2.11.0",
36+
"@types/node": "^18.19.8",
37+
"husky": "^8.0.3",
38+
"lint-staged": "^15.2.0",
39+
"parcel": "~2.11.0",
40+
"postcss": "^8.4.33",
41+
"postcss-modules": "^4.3.1",
42+
"prettier": "^3.2.4",
43+
"typescript": "~5.3.3",
44+
"workbox-cli": "^7.0.0"
4245
}
4346
}

0 commit comments

Comments
 (0)