From d037560f912254d51dfe61de5f75f1b89f186dd5 Mon Sep 17 00:00:00 2001 From: undefined Date: Fri, 22 Jan 2021 13:47:45 +0800 Subject: [PATCH] =?UTF-8?q?w:=20=E7=BC=96=E8=AF=91=E6=8F=90=E9=80=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/build.js | 3 ++- packages/fps-importer/handler.ts | 4 ++-- packages/fps-importer/package.json | 2 +- packages/import-qduoj/handler.ts | 4 ++-- packages/import-qduoj/package.json | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/build/build.js b/build/build.js index 3074f4e6c..cca990a77 100644 --- a/build/build.js +++ b/build/build.js @@ -58,9 +58,10 @@ for (const package of packages) { } fs.writeFileSync(path.resolve(process.cwd(), 'tsconfig.json'), JSON.stringify(config)); +child.execSync('./node_modules/.bin/tsc -b packages/hydrooj', { stdio: 'inherit' }); + if (argv.watch) { child.execSync('./node_modules/.bin/tsc -b --watch', { stdio: 'inherit' }); } else { - child.execSync('cd packages/hydrooj && yarn build', { stdio: 'inherit' }); child.execSync('./node_modules/.bin/tsc -b', { stdio: 'inherit' }); } \ No newline at end of file diff --git a/packages/fps-importer/handler.ts b/packages/fps-importer/handler.ts index 81df7d527..7dc51d7d1 100644 --- a/packages/fps-importer/handler.ts +++ b/packages/fps-importer/handler.ts @@ -4,7 +4,7 @@ import xml2js from 'xml2js'; import fs from 'fs-extra'; import { filter } from 'lodash'; import decodeHTML from 'decode-html'; -import { LocalProblemConfig } from 'hydrooj'; +import type { ProblemConfig } from 'hydrooj'; import { Route, Handler, param, Types, } from 'hydrooj/dist/service/server'; @@ -31,7 +31,7 @@ class FpsProblemImportHandler extends Handler { : [], hint: p.hint, }, 'html', this.translate.bind(this)); - const config: LocalProblemConfig = { + const config: ProblemConfig = { time: p.time_limit[0]._ + p.time_limit[0].$.unit, memory: p.memory_limit[0]._ + p.memory_limit[0].$.unit, }; diff --git a/packages/fps-importer/package.json b/packages/fps-importer/package.json index 7b7b16d81..3c63250d2 100644 --- a/packages/fps-importer/package.json +++ b/packages/fps-importer/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/fps-importer", - "version": "1.1.4", + "version": "1.1.5", "description": "Import FPS problems", "main": "package.json", "repository": "https://github.com/hydro-dev/Hydro.git", diff --git a/packages/import-qduoj/handler.ts b/packages/import-qduoj/handler.ts index cac77aea8..c8bdcecc9 100644 --- a/packages/import-qduoj/handler.ts +++ b/packages/import-qduoj/handler.ts @@ -4,7 +4,7 @@ import os from 'os'; import fs from 'fs-extra'; import AdmZip from 'adm-zip'; import yaml from 'js-yaml'; -import { ContentNode, LocalProblemConfig } from 'hydrooj'; +import type { ContentNode, ProblemConfig } from 'hydrooj'; import { Route, Handler } from 'hydrooj/dist/service/server'; import storage from 'hydrooj/dist/service/storage'; import { BadRequestError, ValidationError } from 'hydrooj/dist/error'; @@ -76,7 +76,7 @@ class ImportQduojHandler extends Handler { const n = await problem.get(domainId, pdoc.display_id); if (n) pdoc.display_id = null; const pid = await problem.add(domainId, pdoc.display_id, pdoc.title, content, this.user._id, pdoc.tags); - const config: LocalProblemConfig = { + const config: ProblemConfig = { time: `${pdoc.time_limit}ms`, memory: `${pdoc.memory_limit}m`, subtasks: [], diff --git a/packages/import-qduoj/package.json b/packages/import-qduoj/package.json index 2c50300f7..7be195479 100644 --- a/packages/import-qduoj/package.json +++ b/packages/import-qduoj/package.json @@ -1,6 +1,6 @@ { "name": "@hydrooj/import-qduoj", - "version": "1.1.2", + "version": "1.1.3", "description": "Import QDUOJ problem export", "main": "package.json", "repository": "https://github.com/hydro-dev/Hydro.git",