This repository has been archived by the owner on Jun 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[refactor] simplify Souce Code based on Web Utility, KoAJAX & MobX
[migrate] replace NPM + React scripts + Travis CI with PNPM + Parcel + GitHub actions [optimize] upgrade Upstream packages & ReadMe document [fix] some detail bugs
- Loading branch information
Showing
31 changed files
with
9,480 additions
and
621 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: CI & CD | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
Build-and-Deploy: | ||
runs-on: ubuntu-latest | ||
env: | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- uses: pnpm/action-setup@v2 | ||
with: | ||
version: 8 | ||
- uses: actions/setup-node@v3 | ||
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }} | ||
with: | ||
node-version: 18 | ||
cache: pnpm | ||
- name: Install Dependencies | ||
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }} | ||
run: pnpm i --frozen-lockfile | ||
|
||
- name: Build Production | ||
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }} | ||
run: pnpm build | ||
|
||
- name: Deploy Production | ||
uses: peaceiris/actions-gh-pages@v3 | ||
if: ${{ !env.VERCEL_TOKEN || !env.VERCEL_ORG_ID || !env.VERCEL_PROJECT_ID }} | ||
with: | ||
publish_dir: ./dist | ||
personal_token: ${{ secrets.GITHUB_TOKEN }} | ||
force_orphan: true | ||
|
||
- name: Deploy to Vercel | ||
uses: amondnet/vercel-action@v25 | ||
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
working-directory: ./dist | ||
vercel-args: --prod |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Pull Request | ||
on: | ||
push: | ||
branches-ignore: | ||
- master | ||
jobs: | ||
Build-and-Deploy: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }} | ||
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | ||
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} | ||
|
||
- name: Deploy to Vercel | ||
uses: amondnet/vercel-action@v25 | ||
if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} | ||
with: | ||
vercel-token: ${{ secrets.VERCEL_TOKEN }} | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
vercel-org-id: ${{ secrets.VERCEL_ORG_ID }} | ||
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID }} | ||
working-directory: ./dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
|
||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/usr/bin/env sh | ||
|
||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npm run build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
registry=https://registry.npm.taobao.org | ||
auto-install-peers = false |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { readFileSync, readdirSync, writeFileSync } from 'fs'; | ||
import { join } from 'path'; | ||
|
||
const [root = 'dist'] = process.argv.slice(2); | ||
|
||
console.time(); | ||
|
||
for (const name of readdirSync(root)) | ||
if (name.endsWith('.js')) { | ||
const path = join(root, name); | ||
const data = readFileSync(path, { encoding: 'utf-8' }); | ||
|
||
writeFileSync(path, data.replace(/\$\w+\$import\$\w+\W/, '')); | ||
|
||
console.log(`[fix] ${path}`); | ||
} | ||
|
||
console.timeEnd(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,84 @@ | ||
{ | ||
"name": "git-pager", | ||
"version": "0.9.0", | ||
"version": "1.0.0", | ||
"private": true, | ||
"author": "shiy2008@gmail.com", | ||
"engines": { | ||
"node": ">=8.0.0" | ||
"node": ">=18" | ||
}, | ||
"dependencies": { | ||
"@octokit/rest": "^16.28.7", | ||
"@octokit/rest": "^20.0.2", | ||
"browser-unhandled-rejection": "^1.0.2", | ||
"classnames": "^2.2.6", | ||
"clipboard-polyfill": "^2.8.1", | ||
"core-js": "^3.2.0", | ||
"classnames": "^2.3.2", | ||
"core-js": "^3.33.0", | ||
"hostname-is-private": "^2.0.8", | ||
"koa": "^2.7.0", | ||
"koa": "^2.14.2", | ||
"koa-logger": "^3.2.1", | ||
"koa-mount": "^4.0.0", | ||
"koa-route": "^3.2.0", | ||
"koa-static": "^5.0.0", | ||
"koajax": "^0.9.4", | ||
"leancloud-storage": "^3.15.0", | ||
"leanengine": "^3.4.0", | ||
"leanengine": "^3.8.0", | ||
"markdown-ime": "^1.0.3", | ||
"marked": "^0.7.0", | ||
"mobx": "^5.13.0", | ||
"mobx-react": "^6.1.1", | ||
"node-fetch": "^2.6.0", | ||
"react": "^16.8.6", | ||
"react-dom": "^16.8.6", | ||
"turndown": "^5.0.3", | ||
"marked": "^9.1.0", | ||
"mobx": "^5.15.7", | ||
"mobx-react": "^6.3.1", | ||
"node-fetch": "^2.7.0", | ||
"react": "^17.0.2", | ||
"react-dom": "^17.0.2", | ||
"turndown": "^7.1.2", | ||
"turndown-plugin-gfm": "^1.0.2", | ||
"yaml": "^1.6.0" | ||
"web-utility": "^4.1.3", | ||
"yaml": "^2.3.2" | ||
}, | ||
"devDependencies": { | ||
"@types/classnames": "^2.2.9", | ||
"@types/jest": "24.0.17", | ||
"@types/marked": "^0.6.5", | ||
"@types/node": "12.6.9", | ||
"@types/react": "16.8.24", | ||
"@types/react-dom": "16.8.5", | ||
"@types/turndown": "^5.0.0", | ||
"@types/yaml": "^1.0.2", | ||
"husky": "^3.0.2", | ||
"lint-staged": "^9.2.1", | ||
"prettier": "^1.18.2", | ||
"react-scripts": "3.0.1", | ||
"typescript": "3.5.3" | ||
"@parcel/packager-raw-url": "~2.9.3", | ||
"@parcel/transformer-less": "~2.9.3", | ||
"@parcel/transformer-webmanifest": "~2.9.3", | ||
"@types/classnames": "^2.3.1", | ||
"@types/jest": "29.5.5", | ||
"@types/node": "^18.18.4", | ||
"@types/react": "^17.0.67", | ||
"@types/react-dom": "^17.0.21", | ||
"@types/turndown": "^5.0.2", | ||
"@types/yaml": "^1.9.7", | ||
"buffer": "^6.0.3", | ||
"husky": "^8.0.3", | ||
"jest": "^29.7.0", | ||
"lint-staged": "^14.0.1", | ||
"parcel": "~2.9.3", | ||
"prettier": "^3.0.3", | ||
"process": "^0.11.10", | ||
"ts-jest": "^29.1.1", | ||
"ts-node": "^10.9.1", | ||
"typescript": "~5.2.2", | ||
"workbox-cli": "^7.0.0" | ||
}, | ||
"scripts": { | ||
"front": "react-scripts start", | ||
"format": "lint-staged", | ||
"build": "lint-staged && react-scripts build", | ||
"start": "node ./server ./build LEANCLOUD_APP_PORT", | ||
"dev": "npm run build && node --inspect ./server ./build LEANCLOUD_APP_PORT", | ||
"test": "react-scripts test", | ||
"deploy": "npm run build && lean deploy", | ||
"eject": "react-scripts eject" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "lint-staged", | ||
"pre-push": "npm test -- --watchAll=false && npm run build" | ||
} | ||
"prepare": "husky install", | ||
"parcel": "rm -rf .parcel-cache/ dist/ && parcel", | ||
"front": "npm run parcel -- public/index.html", | ||
"pack": "npm run parcel -- build public/index.html --public-url . --no-source-maps && ts-node fix-bundle", | ||
"build": "npm run pack && workbox generateSW", | ||
"start": "node ./server ./dist LEANCLOUD_APP_PORT", | ||
"dev": "npm run build && node --inspect ./server ./dist LEANCLOUD_APP_PORT", | ||
"test": "lint-staged && jest", | ||
"deploy": "npm run build && lean deploy" | ||
}, | ||
"lint-staged": { | ||
"*.{html,md,css,less,js,json,ts,jsx,tsx}": [ | ||
"prettier --write", | ||
"git add" | ||
] | ||
"*.{html,md,css,less,js,json,ts,jsx,tsx}": "prettier --write" | ||
}, | ||
"eslintConfig": { | ||
"extends": "react-app" | ||
}, | ||
"prettier": { | ||
"singleQuote": true | ||
"singleQuote": true, | ||
"trailingComma": "none", | ||
"arrowParens": "avoid" | ||
}, | ||
"browserslist": { | ||
"production": [ | ||
">0.2%", | ||
"not dead", | ||
"not op_mini all" | ||
], | ||
"development": [ | ||
"last 2 chrome version", | ||
"last 2 firefox version", | ||
"last 2 safari version", | ||
"last 2 edge version" | ||
] | ||
"browserslist": "> 0.5%, last 2 versions, not dead, IE 11", | ||
"jest": { | ||
"preset": "ts-jest" | ||
} | ||
} |
Oops, something went wrong.