From d6ed36a3168a99118dd7d5f4dee1a849c548e98d Mon Sep 17 00:00:00 2001 From: TechQuery Date: Sun, 24 Aug 2025 17:08:02 +0800 Subject: [PATCH 1/4] [add] Wiki pages with Open Source policy files [optimize] upgrade to Koa 3 & other latest Upstream packages --- .github/workflows/main.yml | 2 + .gitmodules | 3 + components/Layout/MDXLayout.tsx | 18 + components/Navigator/MainNavigator.tsx | 1 + next-env.d.ts | 1 + package.json | 59 +- pages/_app.tsx | 22 +- pages/api/core.ts | 66 + pages/wiki/index.tsx | 48 + pages/wiki/policy | 1 + pnpm-lock.yaml | 2453 ++++++++++++------------ translation/en-US.ts | 4 +- translation/zh-CN.ts | 4 +- translation/zh-TW.ts | 4 +- 14 files changed, 1418 insertions(+), 1268 deletions(-) create mode 100644 .gitmodules create mode 100644 components/Layout/MDXLayout.tsx create mode 100644 pages/wiki/index.tsx create mode 160000 pages/wiki/policy diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 172c8ce..94a03fc 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,8 @@ jobs: steps: - uses: actions/checkout@v4 if: ${{ env.VERCEL_TOKEN && env.VERCEL_ORG_ID && env.VERCEL_PROJECT_ID }} + with: + submodules: true - name: Deploy to Vercel id: vercel-deployment diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..91aa7ff --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "pages/wiki/policy"] + path = pages/wiki/policy + url = https://github.com/fpsig/open-source-policy diff --git a/components/Layout/MDXLayout.tsx b/components/Layout/MDXLayout.tsx new file mode 100644 index 0000000..d6ee1f5 --- /dev/null +++ b/components/Layout/MDXLayout.tsx @@ -0,0 +1,18 @@ +import { FC } from 'react'; +import { Container, ContainerProps } from 'react-bootstrap'; + +import { PageHead } from './PageHead'; + +export const MDXLayout: FC = ({ + className = 'mt-5 pt-5 pb-3', + title, + children, + ...props +}) => ( + + +

{title}

+ + {children} +
+); diff --git a/components/Navigator/MainNavigator.tsx b/components/Navigator/MainNavigator.tsx index bb03258..b19c347 100644 --- a/components/Navigator/MainNavigator.tsx +++ b/components/Navigator/MainNavigator.tsx @@ -27,6 +27,7 @@ const topNavBarMenu = ({ t }: typeof i18n): MenuItem[] => [ name: t('hackathon'), }, { href: '/license-filter', name: t('license_filter') }, + { href: '/wiki', name: t('wiki') }, ]; export interface MainNavigatorProps { diff --git a/next-env.d.ts b/next-env.d.ts index 52e831b..254b73c 100644 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,5 +1,6 @@ /// /// +/// // NOTE: This file should not be edited // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information. diff --git a/package.json b/package.json index 3d66b2e..d6805db 100644 --- a/package.json +++ b/package.json @@ -12,68 +12,69 @@ "test": "lint-staged && npm run lint" }, "dependencies": { - "@koa/router": "^13.1.1", + "@koa/router": "^14.0.0", "@mdx-js/loader": "^3.1.0", "@mdx-js/react": "^3.1.0", - "@next/mdx": "^15.3.5", - "core-js": "^3.44.0", + "@next/mdx": "^15.5.0", + "core-js": "^3.45.1", "file-type": "^21.0.0", "idea-react": "^2.0.0-rc.13", - "koa": "^2.16.1", + "koa": "^3.0.1", "koajax": "^3.1.2", "license-filter": "^0.2.5", - "marked": "^16.0.0", + "marked": "^16.2.0", "mime": "^4.0.7", "mobx": "^6.13.7", "mobx-github": "^0.3.11", "mobx-i18n": "^0.7.1", - "mobx-lark": "^2.2.0", + "mobx-lark": "^2.4.0", "mobx-react": "^9.2.0", "mobx-react-helper": "^0.5.1", "mobx-restful": "^2.1.0", - "mobx-restful-table": "^2.5.2", - "next": "^15.3.5", + "mobx-restful-table": "^2.5.3", + "next": "^15.5.0", "next-pwa": "^5.6.0", - "next-ssr-middleware": "^1.0.1", - "react": "^19.1.0", + "next-ssr-middleware": "^1.0.2", + "react": "^19.1.1", "react-bootstrap": "^2.10.10", - "react-dom": "^19.1.0", + "react-dom": "^19.1.1", "react-typed-component": "^1.0.6", - "undici": "^7.11.0", - "web-utility": "^4.4.3" + "undici": "^7.15.0", + "web-utility": "^4.5.1", + "yaml": "^2.8.1" }, "devDependencies": { "@babel/plugin-proposal-decorators": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-react": "^7.27.1", - "@cspell/eslint-plugin": "^9.1.5", - "@eslint/js": "^9.31.0", + "@cspell/eslint-plugin": "^9.2.0", + "@eslint/js": "^9.34.0", "@softonus/prettier-plugin-duplicate-remover": "^1.1.2", - "@stylistic/eslint-plugin": "^5.1.0", + "@stylistic/eslint-plugin": "^5.2.3", "@types/eslint-config-prettier": "^6.11.3", - "@types/koa": "^2.15.0", + "@types/koa": "^3.0.0", "@types/koa__router": "^12.0.4", "@types/next-pwa": "^5.6.9", - "@types/node": "^22.16.3", - "@types/react": "^19.1.8", - "@types/react-dom": "^19.1.6", - "eslint": "^9.31.0", - "eslint-config-next": "^15.3.5", - "eslint-config-prettier": "^10.1.5", + "@types/node": "^22.17.2", + "@types/react": "^19.1.11", + "@types/react-dom": "^19.1.7", + "eslint": "^9.34.0", + "eslint-config-next": "^15.5.0", + "eslint-config-prettier": "^10.1.8", "eslint-plugin-react": "^7.37.5", "eslint-plugin-simple-import-sort": "^12.1.1", "globals": "^16.3.0", "husky": "^9.1.7", - "jiti": "^2.4.2", - "less": "^4.3.0", + "jiti": "^2.5.1", + "less": "^4.4.1", "less-loader": "^12.3.0", - "lint-staged": "^16.1.2", + "lint-staged": "^16.1.5", "next-with-less": "^3.0.1", "prettier": "^3.6.2", "prettier-plugin-css-order": "^2.1.2", - "sass": "^1.89.2", - "typescript": "~5.8.3", - "typescript-eslint": "^8.36.0" + "sass": "^1.90.0", + "typescript": "~5.9.2", + "typescript-eslint": "^8.40.0" }, "resolutions": { "next": "$next" diff --git a/pages/_app.tsx b/pages/_app.tsx index 3ef27ad..0f9aaa9 100644 --- a/pages/_app.tsx +++ b/pages/_app.tsx @@ -10,12 +10,7 @@ import { Image } from 'react-bootstrap'; import { MainNavigator } from '../components/Navigator/MainNavigator'; import { PageContent } from '../components/PageContent'; import { isServer } from '../models/configuration'; -import { - createI18nStore, - I18nContext, - I18nProps, - loadSSRLanguage, -} from '../models/Translation'; +import { createI18nStore, I18nContext, I18nProps, loadSSRLanguage } from '../models/Translation'; configure({ enforceActions: 'never' }); @@ -46,7 +41,8 @@ export default class CustomApp extends App { render() { const { Component, pageProps, router } = this.props, { t } = this.i18nStore; - const thisFullYear = new Date().getFullYear(); + const thisFullYear = new Date().getFullYear(), + { asPath } = router; return ( @@ -59,7 +55,7 @@ export default class CustomApp extends App {
- {router.route.startsWith('/article/') ? ( + {asPath.startsWith('/article/') || asPath.startsWith('/wiki/') ? ( @@ -71,8 +67,7 @@ export default class CustomApp extends App {