From e10f3de56277fb52c8fa43aaf541222500d11ae0 Mon Sep 17 00:00:00 2001 From: undefined Date: Sun, 9 May 2021 12:10:13 +0800 Subject: [PATCH] add typedoc --- package.json | 14 +++++--- packages/fps-importer/package.json | 2 +- packages/hydrojudge/package.json | 4 +-- packages/hydrooj/package.json | 6 ++-- packages/hydrooj/src/typedoc.entry.ts | 44 +++++++++++++++++++++++++ packages/import-qduoj/package.json | 2 +- packages/login-with-github/lib.ts | 9 +---- packages/login-with-github/package.json | 6 ++-- packages/login-with-github/setting.yaml | 7 +--- packages/login-with-google/lib.ts | 9 ++--- packages/login-with-google/package.json | 6 ++-- packages/login-with-osu/lib.ts | 9 +---- packages/login-with-osu/package.json | 8 ++--- packages/ui-default/package.json | 14 ++++---- packages/utils/package.json | 2 +- typedoc.json | 25 ++++++++++++++ 16 files changed, 105 insertions(+), 62 deletions(-) create mode 100644 packages/hydrooj/src/typedoc.entry.ts create mode 100644 typedoc.json diff --git a/package.json b/package.json index cb16183e7..0f0253e80 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,7 @@ "snowpack": "cd packages/ui-default && snowpack dev", "pub": "node build/publish", "jest": "node build/jest", + "typedoc": "cross-env NODE_OPTIONS=--max_old_space_size=8192 typedoc", "debug": "node --async-stack-traces --trace-deprecation --enable-source-maps build/start --debug --template", "start": "node build/start", "clean": "zsh -c \"rm -rf tsconfig.build.tsbuildinfo ./packages/*/tsconfig.tsbuildinfo ./packages/*/dist ./.coverage\"" @@ -28,12 +29,13 @@ "@shelf/jest-mongodb": "^1.2.3", "@types/cross-spawn": "^6.0.2", "@types/jest": "^26.0.23", - "@types/node": "^15.0.1", + "@types/node": "^15.0.2", "@types/semver": "^7.3.5", - "@typescript-eslint/eslint-plugin": "^4.21.0", - "@typescript-eslint/parser": "^4.21.0", + "@typescript-eslint/eslint-plugin": "^4.22.1", + "@typescript-eslint/parser": "^4.22.1", + "cross-env": "^7.0.3", "cross-spawn": "^7.0.3", - "eslint": "^7.25.0", + "eslint": "^7.26.0", "eslint-config-airbnb-typescript": "^12.0.0", "eslint-import-resolver-typescript": "^2.4.0", "eslint-plugin-import": "^2.22.1", @@ -41,9 +43,11 @@ "globby": "^11.0.3", "jest": "^26.6.3", "latest-version": "^5.1.0", + "nmls": "^2.0.3", "ora": "^5.4.0", "semver": "^7.3.5", - "ts-jest": "^26.5.5", + "ts-jest": "^26.5.6", + "typedoc": "^0.20.36", "typescript": "4.2.4", "yargs": "^16.2.0" } diff --git a/packages/fps-importer/package.json b/packages/fps-importer/package.json index 1ea0593c6..f92658940 100644 --- a/packages/fps-importer/package.json +++ b/packages/fps-importer/package.json @@ -9,7 +9,7 @@ "dependencies": { "adm-zip": "^0.5.5", "decode-html": "^2.0.0", - "fs-extra": "^9.1.0", + "fs-extra": "^10.0.0", "xml2js": "^0.4.23" }, "devDependencies": { diff --git a/packages/hydrojudge/package.json b/packages/hydrojudge/package.json index 4293d303e..9124d93fd 100644 --- a/packages/hydrojudge/package.json +++ b/packages/hydrojudge/package.json @@ -9,13 +9,13 @@ "@hydrooj/utils": "^1.0.14", "axios": "^0.21.1", "bson": "^4.3.0", - "fs-extra": "^9.1.0", + "fs-extra": "^10.0.0", "js-yaml": "^4.0.0", "lodash": "^4.17.21", "p-queue": "^6.6.1", "shell-quote": "^1.7.2", "ws": "^7.4.5", - "yargs": "^16.2.0" + "yargs": "^17.0.1" }, "license": "AGPL-3.0-only", "devDependencies": { diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 2f9d9a7e3..534045040 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -16,7 +16,7 @@ "ansi_up": "^5.0.1", "cookies": "^0.8.0", "detect-browser": "^5.1.1", - "fs-extra": "^9.1.0", + "fs-extra": "^10.0.0", "inquirer": "^8.0.0", "js-yaml": "^4.0.0", "koa": "^2.13.1", @@ -36,7 +36,7 @@ "serialize-javascript": "^5.0.1", "sockjs": "^0.3.20", "superagent": "^6.1.0", - "yargs": "^16.2.0" + "yargs": "^17.0.1" }, "devDependencies": { "@types/adm-zip": "^0.4.34", @@ -54,7 +54,7 @@ "@types/nodemailer": "^6.4.1", "@types/serialize-javascript": "^5.0.0", "@types/sockjs": "^0.3.32", - "@types/superagent": "^4.1.8", + "@types/superagent": "^4.1.11", "@types/yargs": "^16.0.1", "formidable": "^1.2.2" } diff --git a/packages/hydrooj/src/typedoc.entry.ts b/packages/hydrooj/src/typedoc.entry.ts new file mode 100644 index 000000000..f1cc92342 --- /dev/null +++ b/packages/hydrooj/src/typedoc.entry.ts @@ -0,0 +1,44 @@ +import * as interfaces from './interface'; +import * as document from './model/document'; +import user from './model/user'; +import domain from './model/domain'; +import problem from './model/problem'; +import record from './model/record'; +import task from './model/task'; +import * as training from './model/training'; +import blacklist from './model/blacklist'; +import * as builtin from './model/builtin'; +import oauth from './model/oauth'; +import * as oplog from './model/oplog'; +import * as system from './model/system'; +import * as setting from './model/setting'; +import solution from './model/solution'; +import token from './model/token'; +import message from './model/message'; +import * as discussion from './model/discussion'; +import * as contest from './model/contest'; +import * as opcount from './model/opcount'; + +export const Interface = interfaces; + +export namespace Model { + export const User = user; + export const Document = document; + export const Domain = domain; + export const Problem = problem; + export const Record = record; + export const Task = task; + export const Blacklist = blacklist; + export const Builtin = builtin; + export const Training = training; + export const Contest = contest; + export const System = system; + export const Setting = setting; + export const Solution = solution; + export const Token = token; + export const Oplog = oplog; + export const Opcount = opcount; + export const Oauth = oauth; + export const Discussion = discussion; + export const Message = message; +} diff --git a/packages/import-qduoj/package.json b/packages/import-qduoj/package.json index 4e14af4ed..ccb67233b 100644 --- a/packages/import-qduoj/package.json +++ b/packages/import-qduoj/package.json @@ -9,6 +9,6 @@ "dependencies": { "adm-zip": "^0.5.5", "decode-html": "^2.0.0", - "fs-extra": "^9.1.0" + "fs-extra": "^10.0.0" } } diff --git a/packages/login-with-github/lib.ts b/packages/login-with-github/lib.ts index 2c65fe066..3a4e203c5 100644 --- a/packages/login-with-github/lib.ts +++ b/packages/login-with-github/lib.ts @@ -1,14 +1,10 @@ import 'hydrooj'; import * as superagent from 'superagent'; -import superagentProxy from 'superagent-proxy'; - -superagentProxy(superagent); declare module 'hydrooj' { interface SystemKeys { 'login-with-github.id': string, 'login-with-github.secret': string, - 'login-with-github.proxy': string, } interface Lib { oauth_github: typeof import('./lib'), @@ -27,17 +23,15 @@ async function get() { async function callback({ state, code }) { const { system, token } = global.Hydro.model; const { UserFacingError } = global.Hydro.error; - const [[appid, secret, proxy, url], s] = await Promise.all([ + const [[appid, secret, url], s] = await Promise.all([ system.getMany([ 'login-with-github.id', 'login-with-github.secret', - 'login-with-github.proxy', 'server.url', ]), token.get(state, token.TYPE_OAUTH), ]); const res = await superagent.post('https://github.com/login/oauth/access_token') - .proxy(proxy) .send({ client_id: appid, client_secret: secret, @@ -53,7 +47,6 @@ async function callback({ state, code }) { } const t = res.body.access_token; const userInfo = await superagent.get('https://api.github.com/user') - .proxy(proxy) .set('User-Agent', 'Hydro-OAuth') .set('Authorization', `token ${t}`); const ret = { diff --git a/packages/login-with-github/package.json b/packages/login-with-github/package.json index e75bc3720..563f7a9d5 100644 --- a/packages/login-with-github/package.json +++ b/packages/login-with-github/package.json @@ -10,14 +10,12 @@ "build": "tsc" }, "devDependencies": { - "@types/superagent": "^4.1.8", - "@types/superagent-proxy": "^2.0.0" + "@types/superagent": "^4.1.11" }, "peerDependencies": { "hydrooj": "^2.15.0" }, "dependencies": { - "superagent": "^6.1.0", - "superagent-proxy": "^2.0.0" + "superagent": "^6.1.0" } } diff --git a/packages/login-with-github/setting.yaml b/packages/login-with-github/setting.yaml index b0a2b6c00..61dbcb797 100644 --- a/packages/login-with-github/setting.yaml +++ b/packages/login-with-github/setting.yaml @@ -7,9 +7,4 @@ secret: type: text category: system desc: Github OAuth Secret - name: secret -proxy: - type: text - category: system - desc: Github OAuth Proxy - name: proxy \ No newline at end of file + name: secret \ No newline at end of file diff --git a/packages/login-with-google/lib.ts b/packages/login-with-google/lib.ts index 7bf01c349..d097dc028 100644 --- a/packages/login-with-google/lib.ts +++ b/packages/login-with-google/lib.ts @@ -1,14 +1,10 @@ import 'hydrooj'; import * as superagent from 'superagent'; -import proxy from 'superagent-proxy'; - -proxy(superagent); declare module 'hydrooj' { interface SystemKeys { 'login-with-google.id': string, 'login-with-google.secret': string, - 'login-with-google.proxy': string, } interface Lib { oauth_google: typeof import('./lib'), @@ -33,16 +29,15 @@ async function callback({ const { UserFacingError } = global.Hydro.error; if (error) throw new UserFacingError(error); const [ - [appid, secret, url, proxyUrl], + [appid, secret, url], s, ] = await Promise.all([ system.getMany([ - 'login-with-google.id', 'login-with-google.secret', 'server.url', 'login-with-google.proxy', + 'login-with-google.id', 'login-with-google.secret', 'server.url', ]), token.get(state, token.TYPE_OAUTH), ]); const res = await superagent.post('https://oauth2.googleapis.com/token') - .proxy(proxyUrl) .send({ client_id: appid, client_secret: secret, diff --git a/packages/login-with-google/package.json b/packages/login-with-google/package.json index 39e66ae8d..3bd7700c7 100644 --- a/packages/login-with-google/package.json +++ b/packages/login-with-google/package.json @@ -10,14 +10,12 @@ "build": "tsc" }, "devDependencies": { - "@types/superagent": "^4.1.8", - "@types/superagent-proxy": "^2.0.0" + "@types/superagent": "^4.1.11" }, "peerDependencies": { "hydrooj": "^2.15.0" }, "dependencies": { - "superagent": "^6.1.0", - "superagent-proxy": "^2.0.0" + "superagent": "^6.1.0" } } diff --git a/packages/login-with-osu/lib.ts b/packages/login-with-osu/lib.ts index bc07210d3..5358eef0c 100644 --- a/packages/login-with-osu/lib.ts +++ b/packages/login-with-osu/lib.ts @@ -1,14 +1,10 @@ import 'hydrooj'; import * as superagent from 'superagent'; -import superagentProxy from 'superagent-proxy'; - -superagentProxy(superagent); declare module 'hydrooj' { interface SystemKeys { 'login-with-osu.id': string, 'login-with-osu.secret': string, - 'login-with-osu.proxy': string, } interface Lib { oauth_osu: typeof import('./lib'), @@ -32,17 +28,15 @@ async function get() { async function callback({ state, code }) { const { system, token } = global.Hydro.model; const { UserFacingError } = global.Hydro.error; - const [[appid, secret, proxy, url], s] = await Promise.all([ + const [[appid, secret, url], s] = await Promise.all([ system.getMany([ 'login-with-osu.id', 'login-with-osu.secret', - 'login-with-osu.proxy', 'server.url', ]), token.get(state, token.TYPE_OAUTH), ]); const res = await superagent.post(`${BASE_URL}oauth/token`) - .proxy(proxy) .send({ client_id: appid, client_secret: secret, @@ -58,7 +52,6 @@ async function callback({ state, code }) { } const t = res.body.access_token; const userInfo = await superagent.get(`${BASE_URL}api/v2/me`) - .proxy(proxy) .set('User-Agent', 'Hydro-OAuth') .set('Authorization', `Bearer ${t}`); const ret = { diff --git a/packages/login-with-osu/package.json b/packages/login-with-osu/package.json index 931c87a84..fd103d2f6 100644 --- a/packages/login-with-osu/package.json +++ b/packages/login-with-osu/package.json @@ -10,14 +10,12 @@ "build": "tsc" }, "devDependencies": { - "@types/superagent": "^4.1.8", - "@types/superagent-proxy": "^2.0.0" + "@types/superagent": "^4.1.11" }, "peerDependencies": { "hydrooj": "^2.15.0" }, "dependencies": { - "superagent": "^6.1.0", - "superagent-proxy": "^2.0.0" + "superagent": "^6.1.0" } -} \ No newline at end of file +} diff --git a/packages/ui-default/package.json b/packages/ui-default/package.json index 13866699e..f0dcc15bc 100644 --- a/packages/ui-default/package.json +++ b/packages/ui-default/package.json @@ -18,7 +18,7 @@ "@babel/plugin-syntax-dynamic-import": "^7.0.0", "@babel/plugin-syntax-import-meta": "^7.10.4", "@babel/plugin-transform-runtime": "^7.13.10", - "@babel/preset-env": "^7.14.0", + "@babel/preset-env": "^7.14.1", "@babel/preset-react": "^7.13.13", "@babel/register": "^7.13.14", "@babel/runtime-corejs2": "^7.14.0", @@ -35,7 +35,7 @@ "css-loader": "^4.2.2", "diff-dom": "^4.2.2", "emojify.js": "^1.1.0", - "eslint": "^7.22.0", + "eslint": "^7.26.0", "eslint-config-airbnb": "^18.2.1", "eslint-import-resolver-webpack": "^0.13.0", "eslint-plugin-babel": "^5.3.1", @@ -57,7 +57,7 @@ "jquery-scroll-lock": "^3.1.3", "jquery.easing": "^1.4.1", "jquery.transit": "^0.9.12", - "mini-css-extract-plugin": "^1.4.0", + "mini-css-extract-plugin": "^1.6.0", "moment": "^2.29.1", "monaco-editor": "^0.23.0", "monaco-editor-webpack-plugin": "^3.0.1", @@ -67,7 +67,7 @@ "pickadate": "^3.6.4", "plugin-error": "^1.0.1", "postcss-loader": "^3.0.0", - "prism-themes": "^1.6.0", + "prism-themes": "^1.7.0", "prop-types": "^15.7.2", "react": "^17.0.2", "react-dom": "^17.0.2", @@ -101,7 +101,7 @@ "dependencies": { "98.css": "^0.1.16", "js-yaml": "^4.0.0", - "katex": "^0.13.2", + "katex": "^0.13.9", "lodash": "^4.17.21", "markdown-it": "^12.0.6", "markdown-it-anchor": "^7.1.0", @@ -113,7 +113,7 @@ "prismjs": "^1.23.0", "streamsaver": "^2.0.5", "web-streams-polyfill": "^3.0.2", - "xss": "^1.0.8", - "yargs": "^16.2.0" + "xss": "^1.0.9", + "yargs": "^17.0.1" } } diff --git a/packages/utils/package.json b/packages/utils/package.json index c6ed867e6..c2427bd67 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -9,7 +9,7 @@ "dependencies": { "bson": "^4.3.0", "moment": "^2.29.1", - "systeminformation": "^5.6.10" + "systeminformation": "^5.6.20" }, "devDependencies": { "moment-timezone": "^0.5.33" diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 000000000..37c2c10f1 --- /dev/null +++ b/typedoc.json @@ -0,0 +1,25 @@ +{ + "entryPoints": [ + "packages/hydrooj/src/model/blacklist.ts", + "packages/hydrooj/src/model/builtin.ts", + "packages/hydrooj/src/model/contest.ts", + "packages/hydrooj/src/model/discussion.ts", + "packages/hydrooj/src/model/document.ts", + "packages/hydrooj/src/model/domain.ts", + "packages/hydrooj/src/model/message.ts", + "packages/hydrooj/src/model/oauth.ts", + "packages/hydrooj/src/model/opcount.ts", + "packages/hydrooj/src/model/oplog.ts", + "packages/hydrooj/src/model/problem.ts", + "packages/hydrooj/src/model/record.ts", + "packages/hydrooj/src/model/setting.ts", + "packages/hydrooj/src/model/solution.ts", + "packages/hydrooj/src/model/system.ts", + "packages/hydrooj/src/model/task.ts", + "packages/hydrooj/src/model/token.ts", + "packages/hydrooj/src/model/training.ts", + "packages/hydrooj/src/model/user.ts" + ], + "tsconfig": "packages/hydrooj/tsconfig.json", + "out": "docs" +}