mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
Hello yarn berry
This commit is contained in:
1 parent
04a4306895
commit
782f334a27
62 files changed
+448
-239
No files matched your search
@@ -4,20 +4,21 @@ const yaml = require('js-yaml');
|
||||
const serialize = require('serialize-javascript');
|
||||
const nunjucks = require('nunjucks');
|
||||
const { filter } = require('lodash');
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
const { findFileSync } = require('@hydrooj/utils/lib/utils');
|
||||
const status = require('@hydrooj/utils/lib/status');
|
||||
const markdown = require('./markdown');
|
||||
|
||||
const { misc, buildContent, avatar } = global.Hydro.lib;
|
||||
|
||||
if (argv.template && argv.template !== 'string') argv.template = findFileSync('@hydrooj/ui-default/templates');
|
||||
else if (argv.template) argv.template = findFileSync(argv.template);
|
||||
let template = argv.options.template;
|
||||
if (template && typeof template !== 'string') template = findFileSync('@hydrooj/ui-default/templates');
|
||||
else if (template) template = findFileSync(template);
|
||||
|
||||
class Loader extends nunjucks.Loader {
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
getSource(name) {
|
||||
if (!argv.template) {
|
||||
if (!template) {
|
||||
if (!global.Hydro.ui.template[name]) throw new Error(`Cannot get template ${name}`);
|
||||
return {
|
||||
src: global.Hydro.ui.template[name],
|
||||
@@ -26,7 +27,7 @@ class Loader extends nunjucks.Loader {
|
||||
};
|
||||
}
|
||||
let fullpath = null;
|
||||
const p = path.resolve(argv.template, name);
|
||||
const p = path.resolve(template, name);
|
||||
if (fs.existsSync(p)) fullpath = p;
|
||||
if (!fullpath) {
|
||||
if (global.Hydro.ui.template[name]) {
|
||||
@@ -147,7 +148,7 @@ async function render(name, state) {
|
||||
...state,
|
||||
formatJudgeTexts: (texts) => texts.map((text) => {
|
||||
if (typeof text === 'string') return text;
|
||||
return state._(text.message).format(...text.params || []) + ((argv.debug && text.stack) ? `\n${text.stack}` : '');
|
||||
return state._(text.message).format(...text.params || []) + ((process.env.DEV && text.stack) ? `\n${text.stack}` : '');
|
||||
}).join('\n'),
|
||||
perm: global.Hydro.model.builtin.PERM,
|
||||
PRIV: global.Hydro.model.builtin.PRIV,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import { argv } from 'yargs';
|
||||
import cac from 'cac';
|
||||
import webpack from 'webpack';
|
||||
import WebpackDevServer from 'webpack-dev-server';
|
||||
import gulp from 'gulp';
|
||||
@@ -9,6 +9,8 @@ import root from './utils/root';
|
||||
import gulpConfig from './config/gulp';
|
||||
import webpackConfig from './config/webpack';
|
||||
|
||||
const argv = cac().parse();
|
||||
|
||||
function runWebpack({
|
||||
watch, production, measure, dev,
|
||||
}) {
|
||||
@@ -35,7 +37,7 @@ function runWebpack({
|
||||
if (err.details) console.error(err.details);
|
||||
reject(err);
|
||||
}
|
||||
if (argv.detail) console.log(stats.toString());
|
||||
if (argv.options.detail) console.log(stats.toString());
|
||||
if (!watch && (!stats || stats.hasErrors())) process.exitCode = 1;
|
||||
resolve();
|
||||
}
|
||||
@@ -70,7 +72,7 @@ async function main() {
|
||||
const dir = process.cwd();
|
||||
process.chdir(root());
|
||||
await runGulp();
|
||||
await runWebpack(argv);
|
||||
await runWebpack(argv.options);
|
||||
process.chdir(dir);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
const { writeFileSync } = require('fs');
|
||||
const { argv } = require('yargs');
|
||||
const argv = require('cac')().parse();
|
||||
const pkg = require('../package.json');
|
||||
|
||||
if (argv.dev) pkg.version = `${pkg.version}-dev`;
|
||||
if (argv.options.dev) pkg.version = `${pkg.version}-dev`;
|
||||
else pkg.version = pkg.version.replace('-dev', '');
|
||||
|
||||
writeFileSync(`${process.cwd()}/package.json`, JSON.stringify(pkg, null, 2));
|
||||
@@ -1,30 +1,31 @@
|
||||
{
|
||||
"name": "@hydrooj/ui-default",
|
||||
"version": "4.10.3",
|
||||
"version": "4.10.4",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"license": "AGPL-3.0",
|
||||
"main": "hydro.js",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
"preferUnplugged": true,
|
||||
"devDependencies": {
|
||||
"@babel/cli": "^7.13.14",
|
||||
"@babel/core": "^7.14.0",
|
||||
"@babel/eslint-parser": "7.14.2",
|
||||
"@babel/cli": "^7.14.3",
|
||||
"@babel/core": "^7.14.3",
|
||||
"@babel/eslint-parser": "7.14.3",
|
||||
"@babel/plugin-proposal-class-properties": "^7.13.0",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.12.13",
|
||||
"@babel/plugin-proposal-export-namespace-from": "^7.14.2",
|
||||
"@babel/plugin-proposal-function-sent": "^7.12.13",
|
||||
"@babel/plugin-proposal-json-strings": "^7.13.8",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.12.13",
|
||||
"@babel/plugin-proposal-json-strings": "^7.14.2",
|
||||
"@babel/plugin-proposal-numeric-separator": "^7.14.2",
|
||||
"@babel/plugin-proposal-throw-expressions": "^7.12.13",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
|
||||
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
||||
"@babel/plugin-syntax-import-meta": "^7.10.4",
|
||||
"@babel/plugin-transform-runtime": "^7.13.10",
|
||||
"@babel/preset-env": "^7.14.1",
|
||||
"@babel/plugin-transform-runtime": "^7.14.3",
|
||||
"@babel/preset-env": "^7.14.2",
|
||||
"@babel/preset-react": "^7.13.13",
|
||||
"@babel/register": "^7.13.14",
|
||||
"@babel/register": "^7.13.16",
|
||||
"@babel/runtime-corejs3": "^7.14.0",
|
||||
"@blueprintjs/core": "^3.44.2",
|
||||
"@blueprintjs/icons": "^3.26.0",
|
||||
"@blueprintjs/select": "^3.16.2",
|
||||
"@blueprintjs/core": "^3.44.3",
|
||||
"@blueprintjs/icons": "^3.26.1",
|
||||
"@blueprintjs/select": "^3.16.3",
|
||||
"@hydrooj/utils": "^1.0.15",
|
||||
"@undefined-moe/monaco-yaml": "^2.5.0",
|
||||
"ansi_up": "^5.0.1",
|
||||
@@ -35,18 +36,18 @@
|
||||
"chalk": "^4.1.1",
|
||||
"classnames": "^2.3.1",
|
||||
"clipboard": "^2.0.8",
|
||||
"copy-webpack-plugin": "^6.1.1",
|
||||
"css-loader": "^4.2.2",
|
||||
"copy-webpack-plugin": "^6.4.1",
|
||||
"css-loader": "^4.3.0",
|
||||
"diff-dom": "^4.2.2",
|
||||
"echarts": "^5.1.1",
|
||||
"emojify.js": "^1.1.0",
|
||||
"eslint": "^7.26.0",
|
||||
"eslint": "^7.27.0",
|
||||
"eslint-config-airbnb": "^18.2.1",
|
||||
"eslint-import-resolver-webpack": "^0.13.0",
|
||||
"eslint-import-resolver-webpack": "^0.13.1",
|
||||
"eslint-plugin-babel": "^5.3.1",
|
||||
"eslint-plugin-import": "^2.23.2",
|
||||
"eslint-plugin-import": "^2.23.3",
|
||||
"eslint-plugin-jsx-a11y": "^6.4.1",
|
||||
"eslint-plugin-react": "^7.23.1",
|
||||
"eslint-plugin-react": "^7.23.2",
|
||||
"fancy-log": "^1.3.3",
|
||||
"file-loader": "^6.2.0",
|
||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||
@@ -65,11 +66,11 @@
|
||||
"mini-css-extract-plugin": "^1.6.0",
|
||||
"moment": "^2.29.1",
|
||||
"monaco-editor": "^0.24.0",
|
||||
"monaco-editor-webpack-plugin": "^3.0.1",
|
||||
"monaco-editor-webpack-plugin": "^3.1.0",
|
||||
"nanoid": "^3.1.23",
|
||||
"normalize.css": "^8.0.1",
|
||||
"nprogress": "^0.2.0",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.4",
|
||||
"optimize-css-assets-webpack-plugin": "^5.0.6",
|
||||
"pickadate": "^3.6.4",
|
||||
"plugin-error": "^1.0.1",
|
||||
"postcss-loader": "^3.0.0",
|
||||
@@ -80,10 +81,10 @@
|
||||
"react-dom": "^17.0.2",
|
||||
"react-redux": "^7.2.4",
|
||||
"react-split-pane": "^0.1.92",
|
||||
"redux": "^4.0.5",
|
||||
"redux": "^4.1.0",
|
||||
"redux-logger": "^3.0.6",
|
||||
"redux-promise-middleware": "^6.1.2",
|
||||
"redux-thunk": "^2.2.0",
|
||||
"redux-thunk": "^2.3.0",
|
||||
"rupture": "^0.7.1",
|
||||
"slideout": "^1.0.1",
|
||||
"sockjs-client": "^1.5.1",
|
||||
@@ -92,34 +93,33 @@
|
||||
"style-loader": "^2.0.0",
|
||||
"stylus": "^0.54.8",
|
||||
"stylus-loader": "^3.0.2",
|
||||
"tether": "^1.4.6",
|
||||
"tether": "^1.4.7",
|
||||
"tether-drop": "^1.4.2",
|
||||
"through2": "^4.0.2",
|
||||
"timeago-react": "^3.0.2",
|
||||
"timeago.js": "^4.0.2",
|
||||
"vditor": "^3.8.4",
|
||||
"vditor": "^3.8.5",
|
||||
"vinyl-buffer": "^1.0.1",
|
||||
"wastyle": "^0.0.5",
|
||||
"web-streams-polyfill": "^3.0.2",
|
||||
"webpack": "^4.44.2",
|
||||
"web-streams-polyfill": "^3.0.3",
|
||||
"webpack": "^4.46.0",
|
||||
"webpack-bundle-analyzer": "^4.4.2",
|
||||
"webpack-dev-server": "^3.11.2",
|
||||
"webpackbar": "^5.0.0-3"
|
||||
},
|
||||
"dependencies": {
|
||||
"js-yaml": "^4.0.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"katex": "^0.13.11",
|
||||
"lodash": "^4.17.21",
|
||||
"markdown-it": "^12.0.6",
|
||||
"markdown-it-anchor": "^7.1.0",
|
||||
"markdown-it-footnote": "^3.0.2",
|
||||
"markdown-it-footnote": "^3.0.3",
|
||||
"markdown-it-imsize": "^2.0.1",
|
||||
"markdown-it-mark": "^3.0.1",
|
||||
"markdown-it-merge-cells": "^1.0.1",
|
||||
"markdown-it-table-of-contents": "^0.5.2",
|
||||
"nunjucks": "^3.2.3",
|
||||
"streamsaver": "^2.0.5",
|
||||
"xss": "^1.0.9",
|
||||
"yargs": "^17.0.1"
|
||||
"xss": "^1.0.9"
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user