core: 支持修改tags & workspace: upgrade to js-yaml@4

This commit is contained in:
undefined committed 2021-01-09 23:58:06 +08:00
1 parent 87a4bc8bfa
commit 3d9acf2c1a
18 files changed
+38 -36

No files matched your search

@@ -15,7 +15,7 @@ function convert(ini: string) {
if (!Number.isNaN(parseInt(memory, 10))) cur.memory = `${Math.floor(parseInt(memory, 10) / 1024)}m`;
res.subtasks.push(cur);
}
return yaml.safeDump(res);
return yaml.dump(res);
}
global.Hydro.lib['testdata.convert.ini'] = convert;
+2 -2
View File
@@ -1,5 +1,5 @@
import Zip from 'adm-zip';
import { safeLoad } from 'js-yaml';
import { load } from 'js-yaml';
import { LocalProblemConfig } from '../interface';
export async function readConfig(file: string | Buffer) {
@@ -37,7 +37,7 @@ export async function parseConfig(config: string | LocalProblemConfig) {
let cfg: LocalProblemConfig = {};
if (typeof config === 'string') {
// TODO should validate here?
cfg = safeLoad(config) as LocalProblemConfig;
cfg = load(config) as LocalProblemConfig;
} else cfg = config;
if (cfg.cases) {
for (const c of cfg.cases) {