mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: fix js-yaml options
This commit is contained in:
1 parent
2f99407669
commit
591dbd31c0
9 files changed
+25
-29
No files matched your search
@@ -10,12 +10,12 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hydrooj/utils": "workspace:^",
|
"@hydrooj/utils": "workspace:^",
|
||||||
"@koa/router": "^15.7.0",
|
"@koa/router": "^15.7.0",
|
||||||
"@mongodb-js/saslprep": "^1.4.12",
|
"@mongodb-js/saslprep": "^1.4.13",
|
||||||
"emoji-regex": "^10.6.0",
|
"emoji-regex": "^10.6.0",
|
||||||
"fs-extra": "^11.3.6",
|
"fs-extra": "^11.4.0",
|
||||||
"koa": "^3.2.1",
|
"koa": "^3.2.1",
|
||||||
"koa-body": "^8.0.0",
|
"koa-body": "^8.0.0",
|
||||||
"koa-compress": "5.2.1",
|
"koa-compress": "5.2.2",
|
||||||
"path-to-regexp": "^8.4.2",
|
"path-to-regexp": "^8.4.2",
|
||||||
"sanitize-filename": "^1.6.4",
|
"sanitize-filename": "^1.6.4",
|
||||||
"schemastery": "^3.18.0",
|
"schemastery": "^3.18.0",
|
||||||
|
|||||||
@@ -15,11 +15,11 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@hydrooj/register": "workspace:^",
|
"@hydrooj/register": "workspace:^",
|
||||||
"cac": "^7.0.0",
|
"cac": "^7.0.0",
|
||||||
"fs-extra": "^11.3.6",
|
"fs-extra": "^11.4.0",
|
||||||
"js-yaml": "^5.2.1",
|
"js-yaml": "^5.2.2",
|
||||||
"reggol": "^2.1.0",
|
"reggol": "^2.1.0",
|
||||||
"search-query-parser": "^1.6.0",
|
"search-query-parser": "^1.6.0",
|
||||||
"systeminformation": "^5.33.0"
|
"systeminformation": "^5.33.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/fs-extra": "^11.0.4"
|
"@types/fs-extra": "^11.0.4"
|
||||||
|
|||||||
+1
-1
@@ -48,7 +48,7 @@
|
|||||||
"eslint": "^9.39.5",
|
"eslint": "^9.39.5",
|
||||||
"eslint-import-resolver-typescript": "^4.4.5",
|
"eslint-import-resolver-typescript": "^4.4.5",
|
||||||
"eslint-import-resolver-webpack": "^0.13.11",
|
"eslint-import-resolver-webpack": "^0.13.11",
|
||||||
"fs-extra": "^11.3.6",
|
"fs-extra": "^11.4.0",
|
||||||
"globals": "^17.7.0",
|
"globals": "^17.7.0",
|
||||||
"globby": "~14.0.2",
|
"globby": "~14.0.2",
|
||||||
"inspectpack": "^4.7.1",
|
"inspectpack": "^4.7.1",
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"allotment": "^1.20.5",
|
"allotment": "^1.20.5",
|
||||||
"diff": "^9.0.0",
|
"diff": "^9.0.0",
|
||||||
"js-yaml": "^5.2.1",
|
"js-yaml": "^5.2.2",
|
||||||
"lodash": "^4.18.1",
|
"lodash": "^4.18.1",
|
||||||
"react-dnd": "^16.0.1",
|
"react-dnd": "^16.0.1",
|
||||||
"react-dnd-html5-backend": "^16.0.1",
|
"react-dnd-html5-backend": "^16.0.1",
|
||||||
@@ -21,7 +21,7 @@
|
|||||||
"@types/diff": "^8.0.0",
|
"@types/diff": "^8.0.0",
|
||||||
"@types/js-yaml": "^4.0.9",
|
"@types/js-yaml": "^4.0.9",
|
||||||
"@types/lodash": "^4.17.24",
|
"@types/lodash": "^4.17.24",
|
||||||
"sass": "^1.101.4"
|
"sass": "^1.101.7"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"react": "*",
|
"react": "*",
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
"@hydrooj/common": "workspace:^",
|
"@hydrooj/common": "workspace:^",
|
||||||
"@hydrooj/framework": "workspace:^",
|
"@hydrooj/framework": "workspace:^",
|
||||||
"@hydrooj/utils": "workspace:^",
|
"@hydrooj/utils": "workspace:^",
|
||||||
"@mongodb-js/saslprep": "^1.4.12",
|
"@mongodb-js/saslprep": "^1.4.13",
|
||||||
"@simplewebauthn/server": "13.2.2",
|
"@simplewebauthn/server": "13.2.2",
|
||||||
"@undefined-moe/require-resolve-hook": "^1.1.0",
|
"@undefined-moe/require-resolve-hook": "^1.1.0",
|
||||||
"@zip.js/zip.js": "^2.8.34",
|
"@zip.js/zip.js": "^2.8.34",
|
||||||
@@ -32,8 +32,8 @@
|
|||||||
"csv-stringify": "^6.8.1",
|
"csv-stringify": "^6.8.1",
|
||||||
"emoji-regex": "^10.6.0",
|
"emoji-regex": "^10.6.0",
|
||||||
"emojis-list": "2.1.0",
|
"emojis-list": "2.1.0",
|
||||||
"fs-extra": "^11.3.6",
|
"fs-extra": "^11.4.0",
|
||||||
"js-yaml": "^5.2.1",
|
"js-yaml": "^5.2.2",
|
||||||
"koa-proxies": "^0.12.4",
|
"koa-proxies": "^0.12.4",
|
||||||
"koa-static-cache": "^5.1.4",
|
"koa-static-cache": "^5.1.4",
|
||||||
"lodash": "^4.18.1",
|
"lodash": "^4.18.1",
|
||||||
|
|||||||
@@ -113,10 +113,10 @@ ${padEnd(formatSeconds(Math.floor((Date.now() - i.pm2_env.pm_uptime) / 1000), fa
|
|||||||
infoDetails['now'] = new Date().toISOString();
|
infoDetails['now'] = new Date().toISOString();
|
||||||
infos['now'] = new Date().toISOString();
|
infos['now'] = new Date().toISOString();
|
||||||
logger.info('System info:');
|
logger.info('System info:');
|
||||||
console.log(yaml.dump(infos, { noCompatMode: true, noArrayIndent: true, lineWidth: process.stdout.columns || 80 }));
|
console.log(yaml.dump(infos, { schema: yaml.CORE_SCHEMA, seqNoIndent: true, lineWidth: process.stdout.columns || 80 }));
|
||||||
logger.info('Uploading detail to pastebin...');
|
logger.info('Uploading detail to pastebin...');
|
||||||
const tmpFile = path.join(tmpdir(), 'report.yaml');
|
const tmpFile = path.join(tmpdir(), 'report.yaml');
|
||||||
fs.writeFileSync(tmpFile, yaml.dump(infoDetails, { noArrayIndent: true, lineWidth: 300 }));
|
fs.writeFileSync(tmpFile, yaml.dump(infoDetails, { seqNoIndent: true, lineWidth: 300 }));
|
||||||
if (process.env.VSCODE_INJECTION) {
|
if (process.env.VSCODE_INJECTION) {
|
||||||
try {
|
try {
|
||||||
child.exec(`code ${tmpFile}`);
|
child.exec(`code ${tmpFile}`);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { dump } from 'js-yaml';
|
import { dump } from 'js-yaml';
|
||||||
|
import { cloneDeepWith } from 'lodash';
|
||||||
import superagent from 'superagent';
|
import superagent from 'superagent';
|
||||||
import type { StatusUpdate } from '@hydrooj/utils/lib/sysinfo';
|
import type { StatusUpdate } from '@hydrooj/utils/lib/sysinfo';
|
||||||
import * as sysinfo from '@hydrooj/utils/lib/sysinfo';
|
import * as sysinfo from '@hydrooj/utils/lib/sysinfo';
|
||||||
@@ -55,12 +56,7 @@ export async function feedback(): Promise<[string, StatusUpdate]> {
|
|||||||
info.dbVersion = status.version;
|
info.dbVersion = status.version;
|
||||||
} catch (e) { }
|
} catch (e) { }
|
||||||
await bus.serial('monitor/collect', info);
|
await bus.serial('monitor/collect', info);
|
||||||
const payload = dump(info, {
|
const payload = dump(cloneDeepWith(info, (value) => typeof value === 'function' ? '' : undefined));
|
||||||
replacer: (key, value) => {
|
|
||||||
if (typeof value === 'function') return '';
|
|
||||||
return value;
|
|
||||||
},
|
|
||||||
});
|
|
||||||
if (process.env.CI) return [mid, $update];
|
if (process.env.CI) return [mid, $update];
|
||||||
superagent.post(`${system.get('server.center')}/report`)
|
superagent.post(`${system.get('server.center')}/report`)
|
||||||
.send({ installId, payload })
|
.send({ installId, payload })
|
||||||
|
|||||||
@@ -98,7 +98,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
|
|||||||
async componentDidMount() {
|
async componentDidMount() {
|
||||||
const { monaco } = await load(['yaml']);
|
const { monaco } = await load(['yaml']);
|
||||||
const uri = monaco.Uri.parse('hydro://problem/file/config.yaml');
|
const uri = monaco.Uri.parse('hydro://problem/file/config.yaml');
|
||||||
this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { noArrayIndent: true }), 'yaml', uri);
|
this.model = monaco.editor.createModel(yaml.dump(configYamlFormat(this.props.config), { seqNoIndent: true }), 'yaml', uri);
|
||||||
this.vjEditor = Editor.getOrConstruct($(this.containerElement), {
|
this.vjEditor = Editor.getOrConstruct($(this.containerElement), {
|
||||||
language: 'yaml',
|
language: 'yaml',
|
||||||
model: this.model,
|
model: this.model,
|
||||||
@@ -114,7 +114,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
|
|||||||
|
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (this.__preventUpdate || !this.model || !this.props.config.__valid) return;
|
if (this.__preventUpdate || !this.model || !this.props.config.__valid) return;
|
||||||
if (yaml.dump(prevProps.config, { noArrayIndent: true }) === yaml.dump(this.props.config, { noArrayIndent: true })) return;
|
if (yaml.dump(prevProps.config, { seqNoIndent: true }) === yaml.dump(this.props.config, { seqNoIndent: true })) return;
|
||||||
const curValue = this.model.getValue();
|
const curValue = this.model.getValue();
|
||||||
const pending = configYamlFormat(this.props.config);
|
const pending = configYamlFormat(this.props.config);
|
||||||
try {
|
try {
|
||||||
@@ -122,7 +122,7 @@ export default connect(mapStateToProps, mapDispatchToProps)(class MonacoEditor e
|
|||||||
if (isEqual(curConfig, pending)) return;
|
if (isEqual(curConfig, pending)) return;
|
||||||
} catch { }
|
} catch { }
|
||||||
this.__preventFormat = true;
|
this.__preventFormat = true;
|
||||||
const diff = diffLines(curValue, yaml.dump(pending, { noArrayIndent: true }));
|
const diff = diffLines(curValue, yaml.dump(pending, { seqNoIndent: true }));
|
||||||
const ops = [];
|
const ops = [];
|
||||||
let cursor = 1;
|
let cursor = 1;
|
||||||
for (const line of diff) {
|
for (const line of diff) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
"@mantine/core": "^9.4.2",
|
"@mantine/core": "^9.4.2",
|
||||||
"@mantine/hooks": "^9.4.2",
|
"@mantine/hooks": "^9.4.2",
|
||||||
"@mantine/notifications": "^9.4.2",
|
"@mantine/notifications": "^9.4.2",
|
||||||
"@sentry/browser": "^10.67.0",
|
"@sentry/browser": "^10.68.0",
|
||||||
"@sentry/webpack-plugin": "^5.4.0",
|
"@sentry/webpack-plugin": "^5.4.0",
|
||||||
"@simplewebauthn/browser": "13.2.2",
|
"@simplewebauthn/browser": "13.2.2",
|
||||||
"@svgr/webpack": "^8.1.0",
|
"@svgr/webpack": "^8.1.0",
|
||||||
@@ -60,7 +60,7 @@
|
|||||||
"echarts": "^6.1.0",
|
"echarts": "^6.1.0",
|
||||||
"emojis-keywords": "2.0.0",
|
"emojis-keywords": "2.0.0",
|
||||||
"emojis-list": "2.1.0",
|
"emojis-list": "2.1.0",
|
||||||
"esbuild-loader": "^4.4.3",
|
"esbuild-loader": "^4.5.0",
|
||||||
"flatpickr": "^4.6.13",
|
"flatpickr": "^4.6.13",
|
||||||
"idb": "^8.0.3",
|
"idb": "^8.0.3",
|
||||||
"jquery": "^3.7.1",
|
"jquery": "^3.7.1",
|
||||||
@@ -99,7 +99,7 @@
|
|||||||
"redux-promise-middleware": "^6.2.0",
|
"redux-promise-middleware": "^6.2.0",
|
||||||
"redux-thunk": "^3.1.0",
|
"redux-thunk": "^3.1.0",
|
||||||
"rupture": "^0.7.1",
|
"rupture": "^0.7.1",
|
||||||
"sass": "^1.101.4",
|
"sass": "^1.101.7",
|
||||||
"sass-loader": "^16.0.8",
|
"sass-loader": "^16.0.8",
|
||||||
"schemastery": "^3.18.0",
|
"schemastery": "^3.18.0",
|
||||||
"shorty.js": "^1.0.1",
|
"shorty.js": "^1.0.1",
|
||||||
@@ -114,7 +114,7 @@
|
|||||||
"timeago.js": "^4.0.2",
|
"timeago.js": "^4.0.2",
|
||||||
"ts-loader": "^9.6.2",
|
"ts-loader": "^9.6.2",
|
||||||
"web-streams-polyfill": "^4.3.0",
|
"web-streams-polyfill": "^4.3.0",
|
||||||
"webpack": "^5.108.4",
|
"webpack": "^5.109.0",
|
||||||
"webpack-bundle-analyzer": "^5.3.1",
|
"webpack-bundle-analyzer": "^5.3.1",
|
||||||
"webpack-dev-server": "^6.0.0",
|
"webpack-dev-server": "^6.0.0",
|
||||||
"webpack-manifest-plugin": "^6.0.1",
|
"webpack-manifest-plugin": "^6.0.1",
|
||||||
@@ -125,9 +125,9 @@
|
|||||||
"ansi_up": "^6.0.6",
|
"ansi_up": "^6.0.6",
|
||||||
"cssfilter": "^0.0.11",
|
"cssfilter": "^0.0.11",
|
||||||
"esbuild": "0.25.2",
|
"esbuild": "0.25.2",
|
||||||
"fs-extra": "^11.3.6",
|
"fs-extra": "^11.4.0",
|
||||||
"html-to-text": "^10.0.0",
|
"html-to-text": "^10.0.0",
|
||||||
"js-yaml": "^5.2.1",
|
"js-yaml": "^5.2.2",
|
||||||
"jsesc": "^3.1.0",
|
"jsesc": "^3.1.0",
|
||||||
"katex": "^0.18.1",
|
"katex": "^0.18.1",
|
||||||
"lodash": "^4.18.1",
|
"lodash": "^4.18.1",
|
||||||
|
|||||||
Reference in new issue
Block a user