diff --git a/build/start.ts b/build/start.ts index 0952a3acc..901bcddf5 100644 --- a/build/start.ts +++ b/build/start.ts @@ -5,6 +5,7 @@ import cluster from 'cluster'; import fs from 'fs-extra'; import { filter } from 'lodash'; import { argv } from 'yargs'; +// @ts-ignore import * as hydro from 'hydrooj'; if (!cluster.isMaster) { diff --git a/package.json b/package.json index 9c555ddef..d528be034 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "scripts": { "build": "tsc -b", "build:watch": "tsc -b --watch", - "lint": "eslint packages/**/*.ts --fix", + "lint": "eslint packages --ext ts --fix", "pub": "node build/publish", "jest": "node build/jest", "start": "node_modules/.bin/hydrooj" @@ -36,4 +36,4 @@ "fs-extra": "^9.0.1", "yargs": "^15.4.1" } -} +} \ No newline at end of file diff --git a/packages/geoip/lib.ts b/packages/geoip/lib.ts index 43ede5d77..35aa68fe8 100644 --- a/packages/geoip/lib.ts +++ b/packages/geoip/lib.ts @@ -1,3 +1,4 @@ +import 'hydrooj'; import fs from 'fs'; import path from 'path'; import { Reader } from 'maxmind'; diff --git a/packages/geoip/package.json b/packages/geoip/package.json index 2dab5c1c7..b1de0a371 100644 --- a/packages/geoip/package.json +++ b/packages/geoip/package.json @@ -1,14 +1,12 @@ { - "name": "@hydrooj/geoip", - "version": "1.1.6", - "main": "package.json", - "repository": "git@github.com:hydro-dev/Hydro.git", - "author": "undefined ", - "license": "MIT", - "dependencies": { - "maxmind": "^4.1.3" - }, - "peerDependencies": { - "hydrooj": "^2.12.0" - } + "name": "@hydrooj/geoip", + "version": "1.1.6", + "main": "package.json", + "repository": "git@github.com:hydro-dev/Hydro.git", + "author": "undefined ", + "license": "MIT", + "dependencies": { + "hydrooj": "^2.12.0", + "maxmind": "^4.1.3" + } } \ No newline at end of file diff --git a/tsconfig.base.json b/packages/geoip/tsconfig.json similarity index 75% rename from tsconfig.base.json rename to packages/geoip/tsconfig.json index 33bd1ad9f..aa7d73857 100644 --- a/tsconfig.base.json +++ b/packages/geoip/tsconfig.json @@ -2,13 +2,18 @@ "compilerOptions": { "target": "es2019", "module": "commonjs", - "composite": true, - "incremental": true, "esModuleInterop": true, "moduleResolution": "node", "declaration": true, "sourceMap": true, + "composite": true, "strictBindCallApply": true, "experimentalDecorators": true, + "outDir": ".", + "rootDir": "." }, + "include": [ + "*.ts" + ], + "exclude": [] } \ No newline at end of file diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 47e4cb906..897e47b2c 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -3,6 +3,7 @@ "version": "2.12.3", "bin": "bin/hydrooj.js", "main": "dist/loader.js", + "typings": "dist/loader.d.ts", "repository": "https://github.com/hydro-dev/Hydro.git", "author": "masnn", "license": "GPL-3.0-only", diff --git a/packages/hydrooj/src/check.ts b/packages/hydrooj/src/check.ts index 00e604ecb..343f2167e 100644 --- a/packages/hydrooj/src/check.ts +++ b/packages/hydrooj/src/check.ts @@ -1,7 +1,6 @@ // TODO check more import os from 'os'; -import superagent from 'superagent'; import { Dictionary } from 'lodash'; import * as system from './model/system'; import * as db from './service/db'; diff --git a/packages/hydrooj/tsconfig.json b/packages/hydrooj/tsconfig.json index 3bfbca3d6..615bf0265 100644 --- a/packages/hydrooj/tsconfig.json +++ b/packages/hydrooj/tsconfig.json @@ -1,14 +1,22 @@ { - "extends": "../../tsconfig.base", "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "esModuleInterop": true, + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "composite": true, + "strictBindCallApply": true, + "experimentalDecorators": true, "outDir": "dist", - "rootDir": "src", + "rootDir": "src" }, "include": [ - "src", + "src" ], "exclude": [ - "dist", - "bin" + "bin", + "dist" ] } \ No newline at end of file diff --git a/packages/login-with-github/package.json b/packages/login-with-github/package.json index 85df2c52a..89e4cc012 100644 --- a/packages/login-with-github/package.json +++ b/packages/login-with-github/package.json @@ -11,14 +11,11 @@ }, "devDependencies": { "@types/superagent": "^4.1.8", - "@types/superagent-proxy": "^2.0.0", - "hydrooj": "2.12.1" - }, - "peerDependencies": { - "hydrooj": "^2.12.1" + "@types/superagent-proxy": "^2.0.0" }, "dependencies": { + "hydrooj": "^2.12.1", "superagent": "^5.3.1", "superagent-proxy": "^2.0.0" } -} +} \ No newline at end of file diff --git a/packages/login-with-github/tsconfig.json b/packages/login-with-github/tsconfig.json index 481d0b5aa..aa7d73857 100644 --- a/packages/login-with-github/tsconfig.json +++ b/packages/login-with-github/tsconfig.json @@ -1,8 +1,16 @@ { - "extends": "../../tsconfig.base", "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "esModuleInterop": true, + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "composite": true, + "strictBindCallApply": true, + "experimentalDecorators": true, "outDir": ".", - "rootDir": ".", + "rootDir": "." }, "include": [ "*.ts" diff --git a/packages/login-with-google/lib.ts b/packages/login-with-google/lib.ts index dd7815331..eb7f9d0bb 100644 --- a/packages/login-with-google/lib.ts +++ b/packages/login-with-google/lib.ts @@ -21,7 +21,7 @@ async function callback({ const { UserFacingError } = global.Hydro.error; if (error) throw new UserFacingError(error); const [ - [appid, secret, url, proxy], + [appid, secret, url, proxyUrl], s, ] = await Promise.all([ system.getMany([ @@ -30,7 +30,7 @@ async function callback({ token.get(state, token.TYPE_OAUTH), ]); const res = await superagent.post('https://oauth2.googleapis.com/token') - .proxy(proxy) + .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 64ae81e79..62d4bd63e 100644 --- a/packages/login-with-google/package.json +++ b/packages/login-with-google/package.json @@ -11,14 +11,11 @@ }, "devDependencies": { "@types/superagent": "^4.1.8", - "@types/superagent-proxy": "^2.0.0", - "hydrooj": "2.12.1" - }, - "peerDependencies": { - "hydrooj": "^2.12.1" + "@types/superagent-proxy": "^2.0.0" }, "dependencies": { + "hydrooj": "^2.12.1", "superagent": "^5.3.1", "superagent-proxy": "^2.0.0" } -} +} \ No newline at end of file diff --git a/packages/login-with-google/tsconfig.json b/packages/login-with-google/tsconfig.json index 481d0b5aa..aa7d73857 100644 --- a/packages/login-with-google/tsconfig.json +++ b/packages/login-with-google/tsconfig.json @@ -1,8 +1,16 @@ { - "extends": "../../tsconfig.base", "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "esModuleInterop": true, + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "composite": true, + "strictBindCallApply": true, + "experimentalDecorators": true, "outDir": ".", - "rootDir": ".", + "rootDir": "." }, "include": [ "*.ts" diff --git a/packages/migrate-vijos/package.json b/packages/migrate-vijos/package.json index 8e715d55a..f79900bca 100644 --- a/packages/migrate-vijos/package.json +++ b/packages/migrate-vijos/package.json @@ -11,13 +11,10 @@ }, "devDependencies": { "@types/js-yaml": "^3.12.5", - "@types/mongodb": "^3.5.25", - "hydrooj": "2.11.5" - }, - "peerDependencies": { - "hydrooj": "^2.11.3" + "@types/mongodb": "^3.5.25" }, "dependencies": { + "hydrooj": "^2.12.3", "js-yaml": "^3.14.0", "mongodb": "^3.6.0" } diff --git a/packages/migrate-vijos/tsconfig.json b/packages/migrate-vijos/tsconfig.json index a458cef07..aa7d73857 100644 --- a/packages/migrate-vijos/tsconfig.json +++ b/packages/migrate-vijos/tsconfig.json @@ -1,6 +1,14 @@ { - "extends": "../../tsconfig.base", "compilerOptions": { + "target": "es2019", + "module": "commonjs", + "esModuleInterop": true, + "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "composite": true, + "strictBindCallApply": true, + "experimentalDecorators": true, "outDir": ".", "rootDir": "." }, diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 2523d8388..000000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.base", - "compilerOptions": { - "outDir": "build", - "rootDir": "build", - }, - "include": [ - "build" - ], - "exclude": [ - "packages" - ] -} \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index bf983303f..8d0cdb884 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -2,16 +2,20 @@ "compilerOptions": { "target": "es2019", "module": "commonjs", - "composite": true, + "esModuleInterop": true, "moduleResolution": "node", + "declaration": true, + "sourceMap": true, + "composite": true, + "strictBindCallApply": true, "experimentalDecorators": true, - "esModuleInterop": true }, "references": [ - { "path": "./tsconfig.build.json" }, - { "path": "./packages/hydrooj" }, - { "path": "./packages/login-with-github" }, - { "path": "./packages/login-with-google" }, - { "path": "./packages/migrate-vijos" }, + { "path": "packages/hydrooj" }, + { "path": "packages/geoip" }, + { "path": "packages/login-with-github" }, + { "path": "packages/login-with-google" }, + { "path": "packages/migrate-vijos" }, ], + "files": [], } \ No newline at end of file