Skip to content

Commit

Permalink
Upgrade dependency packages and clean up code (#1348)
Browse files Browse the repository at this point in the history
* Modify npmmirror.com to registry.npmjs.org

* Delete useless packages

* Update PATCH_UP and MINOR_UP package

* Upgrade dev dependency

* Upgrade node-fetch to v3. See https://www.npmjs.com/package/node-fetch#installation

* Upgrade html-to-text dockerode and eslint

* Upgrade graphql-request

* Orgnize hasura function and COS function

* Orgnize hasura function and COS function

* Orgnize hasura contest function and comments for user routes

* Delete outdated files

* Move CompilerPayload and ServerPayload to config/contest

* Modify dependency

* Upgrade nodejs verison

* Add auto update
  • Loading branch information
zzdhybthu authored May 17, 2024
1 parent 72db2db commit c92e793
Show file tree
Hide file tree
Showing 28 changed files with 3,134 additions and 4,703 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Use Node.js ${{matrix.node-version}}
uses: actions/setup-node@v1
with:
node-version: "16.x"
node-version: "20.x"

- name: get yarn cache path
id: yarn-cache-dir-path
Expand Down
7 changes: 7 additions & 0 deletions .mergify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,10 @@ pull_request_rules:
add:
- "dependency"
- "bot"
- name: automatic merge for Renovate pull requests
conditions:
- author=renovate[bot]
- check-success=test
actions:
merge:
method: rebase
84 changes: 37 additions & 47 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"license": "MIT",
"private": true,
"scripts": {
"preinstall": "npm config set registry https://registry.npmjs.org && yarn config set registry https://registry.yarnpkg.com",
"start": "nodemon",
"debug": "nodemon --debug",
"build": "babel src -d build -x \".ts\" --ignore \"src/@types/**/*\" --source-maps",
Expand All @@ -11,74 +12,63 @@
"typecheck": "tsc --noUnusedLocals"
},
"dependencies": {
"@babel/runtime": "7.21.5",
"@types/node-cron": "3.0.7",
"@babel/runtime": "^7.24.5",
"@types/node-cron": "^3.0.11",
"@types/web-push": "3.6.3",
"async-mutex": "^0.5.0",
"bcrypt": "5.1.0",
"bcrypt": "^5.1.1",
"cors": "2.8.5",
"cos-nodejs-sdk-v5": "^2.11.19",
"debug": "4.3.4",
"dockerode": "3.3.5",
"dotenv": "16.0.3",
"express": "4.18.2",
"fs": "^0.0.1-security",
"dockerode": "4.0.2",
"dotenv": "^16.4.5",
"express": "^4.19.2",
"graphql": "16.8.1",
"graphql-request": "4.3.0",
"graphql-tag": "2.12.6",
"html-to-text": "8.2.1",
"graphql-request": "6.1.0",
"html-to-text": "9.0.5",
"isemail": "3.2.0",
"js-yaml": "^4.1.0",
"jsonwebtoken": "9.0.0",
"mathjs": "10.6.4",
"mongoose": "6.10.5",
"jsonwebtoken": "^9.0.2",
"morgan": "1.10.0",
"multer": "^1.4.5-lts.1",
"node-cron": "3.0.2",
"node-fetch": "2.6.9",
"nodemailer": "6.9.1",
"node-cron": "^3.0.3",
"node-fetch": "3.3.2",
"nodemailer": "^6.9.13",
"qcloud-cos-sts": "^3.1.0",
"unisms": "^0.0.6",
"uuid": "^9.0.1",
"web-push": "3.6.7"
},
"devDependencies": {
"@babel/cli": "7.21.5",
"@babel/core": "7.21.5",
"@babel/node": "7.20.7",
"@babel/cli": "^7.24.5",
"@babel/core": "^7.24.5",
"@babel/node": "^7.23.9",
"@babel/plugin-proposal-class-properties": "7.18.6",
"@babel/plugin-proposal-nullish-coalescing-operator": "7.18.6",
"@babel/plugin-proposal-numeric-separator": "7.18.6",
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-proposal-optional-chaining": "7.21.0",
"@babel/plugin-transform-runtime": "7.21.4",
"@babel/preset-env": "7.21.5",
"@babel/preset-typescript": "7.21.5",
"@types/bcrypt": "5.0.0",
"@types/cors": "2.8.13",
"@types/debug": "4.1.7",
"@types/dockerode": "3.3.16",
"@types/express": "4.17.17",
"@types/html-to-text": "8.1.1",
"@babel/plugin-transform-runtime": "^7.24.3",
"@babel/preset-env": "^7.24.5",
"@babel/preset-typescript": "^7.24.1",
"@types/bcrypt": "^5.0.2",
"@types/cors": "^2.8.17",
"@types/debug": "^4.1.12",
"@types/dockerode": "^3.3.29",
"@types/express": "^4.17.21",
"@types/html-to-text": "9.0.4",
"@types/js-yaml": "^4.0.9",
"@types/jsonwebtoken": "8.5.9",
"@types/mongodb": "4.0.6",
"@types/mongoose": "5.10.3",
"@types/morgan": "1.9.4",
"@types/multer": "1.4.7",
"@types/node-fetch": "2.6.3",
"@types/nodemailer": "6.4.7",
"@types/uuid": "^9.0.8",
"@typescript-eslint/eslint-plugin": "5.59.1",
"@typescript-eslint/parser": "5.59.1",
"@types/jsonwebtoken": "9.0.6",
"@types/morgan": "^1.9.9",
"@types/node-fetch": "^2.6.11",
"@types/nodemailer": "^6.4.15",
"@typescript-eslint/eslint-plugin": "7.9.0",
"@typescript-eslint/parser": "7.9.0",
"cross-env": "7.0.3",
"eslint": "8.39.0",
"eslint-config-prettier": "8.8.0",
"husky": "7.0.4",
"lint-staged": "12.5.0",
"nodemon": "2.0.22",
"prettier": "2.8.8",
"typescript": "4.9.5"
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"husky": "9.0.11",
"lint-staged": "15.2.2",
"nodemon": "3.1.0",
"typescript": "5.4.5"
},
"husky": {
"hooks": {
Expand Down
10 changes: 8 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
{
"extends": ["config:base"],
"automerge": false,
"automerge": true,
"timezone": "Asia/Shanghai",
"schedule": "after 4am and before 8am every saturday",
"lockFileMaintenance": {
"enabled": true,
"schedule": "after 10pm on saturday"
}
},
"prConcurrentLimit": 0,
"prHourlyLimit": 5,
"rangeStrategy": "pin",
"separateMajorMinor": true,
"separateMinorPatch": true,
"separateMultipleMajor": true
}
1 change: 1 addition & 0 deletions src/configs/authorization.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

export const roles = [
"user", // base role; email not verified; cannot log into info
"student", // email verified; can log into info; can write weekly; can join contests
Expand Down
59 changes: 59 additions & 0 deletions src/configs/contest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@

type ContestImages = {
[key: string]: {
COMPILER_IMAGE: string;
COMPILER_TIMEOUT: string;
SERVER_IMAGE: string;
CLIENT_IMAGE: string;
ENVOY_IMAGE: string;
RUNNER_TOKEN_TIMEOUT: string
};
};

export interface TeamLabelBind {
team_id: string;
label: string;
}

export interface ContestResult { // used by server docker.
status: string; // value: `Finished` or `Crashed`.
scores: number[]; // order is the same as `team_label_binds`.
};

export interface TeamResult { // used by backend.
team_id: string;
score: number;
};

export interface JwtCompilerPayload {
code_id: string;
team_id: string;
contest_name: string;
cos_path: string;
}

export interface JwtServerPayload {
contest_id: string;
round_id?: string;
room_id: string;
team_label_binds: TeamLabelBind[];
}

export const contest_image_map: ContestImages = {
"THUAI6": {
SERVER_IMAGE: "eesast/thuai6_run",
CLIENT_IMAGE: "eesast/thuai6_run",
COMPILER_IMAGE: "eesast/thuai6_cpp",
ENVOY_IMAGE: "envoyproxy/envoy:dev-55a95a171c1371b2402e9c8e2092f5b0ca02462d",
COMPILER_TIMEOUT: "10m",
RUNNER_TOKEN_TIMEOUT: "30m",
},
"THUAI7": {
SERVER_IMAGE: "eesast/thuai7_run_server",
CLIENT_IMAGE: "eesast/thuai7_run_client",
COMPILER_IMAGE: "eesast/thuai7_cpp",
ENVOY_IMAGE: "envoyproxy/envoy:dev-55a95a171c1371b2402e9c8e2092f5b0ca02462d",
COMPILER_TIMEOUT: "10m",
RUNNER_TOKEN_TIMEOUT: "30m"
}
}
Loading

0 comments on commit c92e793

Please sign in to comment.