mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-18 01:36:08 +08:00
fix: prepublish & record rejudge
This commit is contained in:
1 parent
4939b62b51
commit
7651b0a697
6 files changed
+13
-5
No files matched your search
+5
-1
@@ -2,6 +2,8 @@
|
||||
/* eslint-disable consistent-return */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { gt } from 'semver';
|
||||
import latest from 'latest-version';
|
||||
import ora from 'ora';
|
||||
@@ -21,7 +23,7 @@ if (CI && (GITHUB_REF !== 'refs/heads/master' || GITHUB_EVENT_NAME !== 'push'))
|
||||
(async () => {
|
||||
let folders = await getWorkspaces();
|
||||
if (process.argv[2]) {
|
||||
folders = folders.filter((path) => path.startsWith(process.argv[2]));
|
||||
folders = folders.filter((p) => p.startsWith(process.argv[2]));
|
||||
}
|
||||
|
||||
const spinner = ora();
|
||||
@@ -36,6 +38,8 @@ if (CI && (GITHUB_REF !== 'refs/heads/master' || GITHUB_EVENT_NAME !== 'push'))
|
||||
if (!meta.private) {
|
||||
const version = await latest(meta.name);
|
||||
if (gt(meta.version, version)) {
|
||||
const prepublish = path.resolve(process.cwd(), 'packages', name, 'prepublish.sh');
|
||||
if (fs.existsSync(prepublish)) await spawnAsync(prepublish);
|
||||
bumpMap[name] = meta.version;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import path from 'path';
|
||||
import globby from 'globby';
|
||||
import spawn from 'cross-spawn';
|
||||
@@ -38,5 +39,6 @@ export function spawnAsync(command: string) {
|
||||
const child = spawn(args[0], args.slice(1), { stdio: 'inherit' });
|
||||
return new Promise((resolve, reject) => {
|
||||
child.on('close', resolve);
|
||||
child.on('error', reject);
|
||||
});
|
||||
}
|
||||
@@ -19,6 +19,7 @@
|
||||
"@types/cross-spawn": "^6.0.2",
|
||||
"@types/jest": "^26.0.10",
|
||||
"@types/node": "^14.6.0",
|
||||
"@types/semver": "^7.3.3",
|
||||
"@typescript-eslint/eslint-plugin": "^3.9.1",
|
||||
"@typescript-eslint/parser": "^3.9.1",
|
||||
"cross-spawn": "^7.0.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hydrooj/geoip",
|
||||
"version": "1.1.6",
|
||||
"version": "1.1.7",
|
||||
"main": "package.json",
|
||||
"repository": "git@github.com:hydro-dev/Hydro.git",
|
||||
"author": "undefined <masnn0@outlook.com>",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"version": "2.0.5",
|
||||
"main": "package.json",
|
||||
"version": "2.0.6",
|
||||
"main": "dist/service.js",
|
||||
"author": "masnn",
|
||||
"os": [
|
||||
"linux"
|
||||
@@ -28,4 +28,4 @@
|
||||
"build": "tsc",
|
||||
"lint": "eslint . --ext ts --fix"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,7 @@ export async function judge(domainId: string, rid: ObjectID) {
|
||||
const pdoc = await problem.get(domainId, rdoc.pid);
|
||||
config = pdoc?.config || {};
|
||||
}
|
||||
delete rdoc._id;
|
||||
await task.add({
|
||||
...rdoc,
|
||||
type: 'judge',
|
||||
|
||||
Reference in new issue
Block a user