mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
ui: update build config
This commit is contained in:
3 files changed
+12
-5
No files matched your search
+7
-2
@@ -11,6 +11,7 @@ if (process.env.npm_execpath.includes('yarn')) {
|
|||||||
const dir = path.dirname(path.dirname(require.resolve('@types/node/package.json')));
|
const dir = path.dirname(path.dirname(require.resolve('@types/node/package.json')));
|
||||||
const types = fs.readdirSync(dir).filter((i) => !['sharedworker', 'serviceworker'].includes(i));
|
const types = fs.readdirSync(dir).filter((i) => !['sharedworker', 'serviceworker'].includes(i));
|
||||||
|
|
||||||
|
/** @type {import('typescript/lib/typescript').CompilerOptions} */
|
||||||
const compilerOptionsBase = {
|
const compilerOptionsBase = {
|
||||||
target: 'es2020',
|
target: 'es2020',
|
||||||
module: 'commonjs',
|
module: 'commonjs',
|
||||||
@@ -20,6 +21,7 @@ const compilerOptionsBase = {
|
|||||||
sourceMap: false,
|
sourceMap: false,
|
||||||
composite: true,
|
composite: true,
|
||||||
strictBindCallApply: true,
|
strictBindCallApply: true,
|
||||||
|
resolveJsonModule: true,
|
||||||
experimentalDecorators: true,
|
experimentalDecorators: true,
|
||||||
// emitDecoratorMetadata: true,
|
// emitDecoratorMetadata: true,
|
||||||
incremental: true,
|
incremental: true,
|
||||||
@@ -53,7 +55,7 @@ const configFlat = (name) => ({
|
|||||||
rootDir: '.',
|
rootDir: '.',
|
||||||
},
|
},
|
||||||
include: ['**/*.ts'],
|
include: ['**/*.ts'],
|
||||||
exclude: ['public'],
|
exclude: ['public', 'frontend'],
|
||||||
});
|
});
|
||||||
|
|
||||||
for (const name of ['plugins', 'modules']) {
|
for (const name of ['plugins', 'modules']) {
|
||||||
@@ -73,7 +75,10 @@ const UIConfig = {
|
|||||||
exclude: [
|
exclude: [
|
||||||
'packages/ui-default/public',
|
'packages/ui-default/public',
|
||||||
],
|
],
|
||||||
include: ['ts', 'tsx'].flatMap((ext) => [].map((name) => `${name}/**/public/**/*.${ext}`).concat(`packages/ui-default/**/*.${ext}`)),
|
include: ['ts', 'tsx']
|
||||||
|
.flatMap((ext) => ['plugins', 'modules']
|
||||||
|
.flatMap((name) => [`${name}/**/public/**/*.${ext}`, `${name}/**/frontend/**/*.${ext}`])
|
||||||
|
.concat(`packages/ui-default/**/*.${ext}`)),
|
||||||
compilerOptions: {
|
compilerOptions: {
|
||||||
experimentalDecorators: true,
|
experimentalDecorators: true,
|
||||||
esModuleInterop: true,
|
esModuleInterop: true,
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import { $, addPage, AutoloadPage } from '@hydrooj/ui-default';
|
import { $, addPage, AutoloadPage } from '@hydrooj/ui-default';
|
||||||
|
|
||||||
|
/* global DocsAPI */
|
||||||
|
|
||||||
let loaded = false;
|
let loaded = false;
|
||||||
async function load() {
|
async function load() {
|
||||||
if (loaded) return Promise.resolve();
|
if (loaded) return Promise.resolve();
|
||||||
@@ -21,7 +23,7 @@ const loader = (mode) => async (element) => {
|
|||||||
const t = new URL(url, window.location.href).pathname.split('.');
|
const t = new URL(url, window.location.href).pathname.split('.');
|
||||||
const n = new URL(url, window.location.href).pathname.split('/');
|
const n = new URL(url, window.location.href).pathname.split('/');
|
||||||
const lang = UserContext.viewLang.includes('_') ? UserContext.viewLang.split('_')[0] : UserContext.viewLang;
|
const lang = UserContext.viewLang.includes('_') ? UserContext.viewLang.split('_')[0] : UserContext.viewLang;
|
||||||
// eslint-disable-next-line no-undef
|
// @ts-ignore
|
||||||
window.editor = new DocsAPI.DocEditor(id, {
|
window.editor = new DocsAPI.DocEditor(id, {
|
||||||
document: {
|
document: {
|
||||||
fileType: t[t.length - 1],
|
fileType: t[t.length - 1],
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { hostname } from 'os';
|
import { hostname } from 'os';
|
||||||
import { AggregatorRegistry, metric } from 'prom-client';
|
import { AggregatorRegistry, Metric } from 'prom-client';
|
||||||
import { Context, Handler, SystemModel } from 'hydrooj';
|
import { Context, Handler, SystemModel } from 'hydrooj';
|
||||||
import { createRegistry } from './metrics';
|
import { createRegistry } from './metrics';
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@ declare module 'hydrooj' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const instances: Record<string, metric[]> = {};
|
const instances: Record<string, Metric[]> = {};
|
||||||
|
|
||||||
class MetricsHandler extends Handler {
|
class MetricsHandler extends Handler {
|
||||||
noCheckPermView = true;
|
noCheckPermView = true;
|
||||||
|
|||||||
Reference in new issue
Block a user