mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: change build script to plain javascript
This commit is contained in:
1 parent
6c5532e298
commit
b0df7024e6
8 files changed
+27
-59
No files matched your search
+1
-1
@@ -24,7 +24,7 @@ tsconfig.json
|
||||
# Project Rules
|
||||
## Core
|
||||
packages/**/*.js
|
||||
!/build/build.js
|
||||
!/build/*.js
|
||||
!**/bin/*.js
|
||||
!*.page.js
|
||||
!/install/jssh.d.ts
|
||||
|
||||
@@ -18,7 +18,6 @@ const compilerOptionsBase = {
|
||||
const config = {
|
||||
compilerOptions: compilerOptionsBase,
|
||||
references: [
|
||||
{ path: 'tsconfig.build.json' },
|
||||
{ path: 'packages/hydrooj' },
|
||||
],
|
||||
files: [],
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import spawn from 'cross-spawn';
|
||||
const spawn = require('cross-spawn');
|
||||
|
||||
const args = ['jest', '--coverage'];
|
||||
|
||||
const [, , argv2, argv3] = process.argv;
|
||||
|
||||
if (argv2 && !argv2.startsWith('-')) {
|
||||
@@ -3,12 +3,11 @@
|
||||
/* eslint-disable consistent-return */
|
||||
/* eslint-disable no-await-in-loop */
|
||||
/* eslint-disable import/no-dynamic-require */
|
||||
import { gt } from 'semver';
|
||||
import latest from 'latest-version';
|
||||
import ora from 'ora';
|
||||
import {
|
||||
PackageJson, getWorkspaces, spawnAsync,
|
||||
} from './utils';
|
||||
|
||||
const { gt } = require('semver');
|
||||
const latest = require('latest-version');
|
||||
const ora = require('ora');
|
||||
const { getWorkspaces, spawnAsync } = require('./utils');
|
||||
|
||||
const {
|
||||
CI, GITHUB_EVENT_NAME, GITHUB_REF,
|
||||
@@ -28,12 +27,12 @@ if (CI && (!tag || GITHUB_EVENT_NAME !== 'push')) {
|
||||
}
|
||||
|
||||
const spinner = ora();
|
||||
const bumpMap: Record<string, string> = {};
|
||||
const bumpMap = {};
|
||||
|
||||
let progress = 0;
|
||||
spinner.start(`Loading workspaces (0/${folders.length})`);
|
||||
await Promise.all(folders.map(async (name) => {
|
||||
let meta: PackageJson;
|
||||
let meta;
|
||||
try {
|
||||
meta = require(`../${name}/package.json`);
|
||||
if (!meta.private) {
|
||||
@@ -1,13 +1,12 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import os from 'os';
|
||||
import path from 'path';
|
||||
import cluster from 'cluster';
|
||||
import fs from 'fs-extra';
|
||||
import { filter } from 'lodash';
|
||||
import { argv } from 'yargs';
|
||||
// @ts-ignore
|
||||
import * as hydro from 'hydrooj';
|
||||
const os = require('os');
|
||||
const path = require('path');
|
||||
const cluster = require('cluster');
|
||||
const fs = require('fs-extra');
|
||||
const { filter } = require('lodash');
|
||||
const { argv } = require('yargs');
|
||||
const hydro = require('hydrooj');
|
||||
|
||||
if (!cluster.isMaster) {
|
||||
// Forked by hydro
|
||||
@@ -25,7 +24,7 @@ if (!cluster.isMaster) {
|
||||
fs.writeFileSync(addonPath, JSON.stringify(addons, null, 2));
|
||||
|
||||
try {
|
||||
const ui = argv.ui as string || '@hydrooj/ui-default';
|
||||
const ui = argv.ui || '@hydrooj/ui-default';
|
||||
require.resolve(ui);
|
||||
addons = [ui, ...addons];
|
||||
} catch (e) {
|
||||
@@ -1,11 +1,11 @@
|
||||
/* eslint-disable no-console */
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
import globby from 'globby';
|
||||
import spawn from 'cross-spawn';
|
||||
const globby = require('globby');
|
||||
const spawn = require('cross-spawn');
|
||||
|
||||
export const cwd = process.cwd();
|
||||
const cwd = process.cwd();
|
||||
|
||||
export function getWorkspaces() {
|
||||
function getWorkspaces() {
|
||||
return globby(require('../package').workspaces, {
|
||||
cwd,
|
||||
deep: 0,
|
||||
@@ -14,15 +14,7 @@ export function getWorkspaces() {
|
||||
});
|
||||
}
|
||||
|
||||
export type DependencyType = 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies';
|
||||
|
||||
export interface PackageJson extends Partial<Record<DependencyType, Record<string, string>>> {
|
||||
name?: string
|
||||
private?: boolean
|
||||
version?: string
|
||||
}
|
||||
|
||||
export function spawnSync(command: string, silent?: boolean) {
|
||||
function spawnSync(command: string, silent?: boolean) {
|
||||
if (!silent) console.log(`$ ${command}`);
|
||||
const args = command.split(/\s+/);
|
||||
const result = spawn.sync(args[0], [...args.slice(1), '--color'], { cwd, encoding: 'utf8' });
|
||||
@@ -34,7 +26,7 @@ export function spawnSync(command: string, silent?: boolean) {
|
||||
}
|
||||
}
|
||||
|
||||
export function spawnAsync(command: string) {
|
||||
function spawnAsync(command: string) {
|
||||
const args = command.split(/\s+/);
|
||||
const child = spawn(args[0], args.slice(1), { stdio: 'inherit' });
|
||||
return new Promise((resolve, reject) => {
|
||||
@@ -42,3 +34,7 @@ export function spawnAsync(command: string) {
|
||||
child.on('error', reject);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
cwd, spawnSync, spawnAsync, getWorkspaces,
|
||||
};
|
||||
@@ -2,9 +2,6 @@
|
||||
"name": "@hydrooj/hydrojudge",
|
||||
"bin": "bin/hydrojudge.js",
|
||||
"version": "2.5.1",
|
||||
"os": [
|
||||
"linux"
|
||||
],
|
||||
"main": "package.json",
|
||||
"author": "undefined <i@undefined.moe>",
|
||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2019",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"moduleResolution": "node",
|
||||
"declaration": true,
|
||||
"sourceMap": true,
|
||||
"composite": true,
|
||||
"strictBindCallApply": true,
|
||||
"experimentalDecorators": true,
|
||||
"outDir": "build",
|
||||
"rootDir": "build"
|
||||
},
|
||||
"include": [
|
||||
"build"
|
||||
],
|
||||
"exclude": [
|
||||
"packages"
|
||||
]
|
||||
}
|
||||
Reference in new issue
Block a user