mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
update: use build.js
This commit is contained in:
1 parent
15d2ecaf54
commit
50952050f8
5 files changed
+32
-15
No files matched your search
@@ -21,6 +21,7 @@ module.exports = {
|
||||
'guard-for-in': 'off',
|
||||
'implicit-arrow-linebreak': 'off',
|
||||
'import/extensions': 'off',
|
||||
'import/no-cycle': 'off',
|
||||
'import/no-extraneous-dependencies': 'off',
|
||||
'import/no-named-as-default-member': 'off',
|
||||
'import/prefer-default-export': 'off',
|
||||
|
||||
+8
-10
@@ -1,9 +1,3 @@
|
||||
# Base
|
||||
node_modules/
|
||||
!.gitkeep
|
||||
!__mocks__
|
||||
__*
|
||||
|
||||
# Built Files & Log
|
||||
.build/
|
||||
dist/
|
||||
@@ -25,12 +19,16 @@ yarn.lock
|
||||
tsconfig.json
|
||||
|
||||
# Project Rules
|
||||
!/build/prebuild.js
|
||||
!**/bin/*.js
|
||||
packages/**/*.js
|
||||
!/build/build.js
|
||||
!**/bin/*.js
|
||||
!packages/hydrojudge/service.js
|
||||
packages/**/*.js.map
|
||||
packages/**/*.d.ts
|
||||
|
||||
# Data files
|
||||
*.mmdb
|
||||
|
||||
# Base
|
||||
node_modules/
|
||||
__*
|
||||
!__mocks__
|
||||
!.gitkeep
|
||||
@@ -1,5 +1,7 @@
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const child = require('child_process');
|
||||
const { argv } = require('yargs');
|
||||
|
||||
const compilerOptionsBase = {
|
||||
target: 'es2019',
|
||||
@@ -14,7 +16,10 @@ const compilerOptionsBase = {
|
||||
};
|
||||
const config = {
|
||||
compilerOptions: compilerOptionsBase,
|
||||
references: [{ path: 'tsconfig.build.json' }],
|
||||
references: [
|
||||
{ path: 'tsconfig.build.json' },
|
||||
{ path: 'packages/hydrooj' },
|
||||
],
|
||||
files: [],
|
||||
};
|
||||
const configSrc = {
|
||||
@@ -47,7 +52,7 @@ const configFlat = {
|
||||
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'));
|
||||
console.log(packages);
|
||||
for (const package of packages) {
|
||||
config.references.push({ path: `packages/${package}` });
|
||||
if (package !== 'hydrooj') config.references.push({ path: `packages/${package}` });
|
||||
const files = fs.readdirSync(path.resolve(process.cwd(), 'packages', package));
|
||||
fs.writeFileSync(
|
||||
path.resolve(process.cwd(), 'packages', package, 'tsconfig.json'),
|
||||
@@ -55,3 +60,14 @@ for (const package of packages) {
|
||||
);
|
||||
}
|
||||
fs.writeFileSync(path.resolve(process.cwd(), 'tsconfig.json'), JSON.stringify(config));
|
||||
|
||||
if (argv.watch) {
|
||||
child.spawnSync('../node_modules/.bin/tsc -b --watch', { stdio: 'inherit' });
|
||||
} else {
|
||||
let result = child.spawnSync('../node_modules/.bin/tsc -b', { stdio: 'inherit' });
|
||||
if (result.status != 0) {
|
||||
result = child.spawnSync('../node_modules/.bin/tsc -b', { stdio: 'inherit' });
|
||||
}
|
||||
console.log(result);
|
||||
process.exit(result.status);
|
||||
}
|
||||
+4
-3
@@ -5,12 +5,13 @@
|
||||
"packages/*"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "node build/prebuild.js && tsc -b",
|
||||
"build:watch": "node build/prebuild.js && tsc -b --watch",
|
||||
"build": "node build/build.js",
|
||||
"build:watch": "node build/build.js --watch",
|
||||
"lint": "eslint packages --ext ts --fix",
|
||||
"pub": "node build/publish",
|
||||
"jest": "node build/jest",
|
||||
"start": "node --async-stack-traces --trace-deprecation --enable-source-maps build/start",
|
||||
"debug": "node --async-stack-traces --trace-deprecation --enable-source-maps build/start",
|
||||
"start": "node build/start",
|
||||
"clean": "zsh -c \"rm -r tsconfig.build.tsbuildinfo ./packages/*/tsconfig.tsbuildinfo ./packages/*/dist ./.coverage\""
|
||||
},
|
||||
"version": "1.0.0",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { inspect, InspectOptions, format } from 'util';
|
||||
import { argv } from 'yargs';
|
||||
import { stderr } from 'supports-color';
|
||||
import { } from './loader';
|
||||
|
||||
namespace Time {
|
||||
export const second = 1000;
|
||||
|
||||
Reference in new issue
Block a user