mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +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',
|
'guard-for-in': 'off',
|
||||||
'implicit-arrow-linebreak': 'off',
|
'implicit-arrow-linebreak': 'off',
|
||||||
'import/extensions': 'off',
|
'import/extensions': 'off',
|
||||||
|
'import/no-cycle': 'off',
|
||||||
'import/no-extraneous-dependencies': 'off',
|
'import/no-extraneous-dependencies': 'off',
|
||||||
'import/no-named-as-default-member': 'off',
|
'import/no-named-as-default-member': 'off',
|
||||||
'import/prefer-default-export': 'off',
|
'import/prefer-default-export': 'off',
|
||||||
|
|||||||
+8
-10
@@ -1,9 +1,3 @@
|
|||||||
# Base
|
|
||||||
node_modules/
|
|
||||||
!.gitkeep
|
|
||||||
!__mocks__
|
|
||||||
__*
|
|
||||||
|
|
||||||
# Built Files & Log
|
# Built Files & Log
|
||||||
.build/
|
.build/
|
||||||
dist/
|
dist/
|
||||||
@@ -25,12 +19,16 @@ yarn.lock
|
|||||||
tsconfig.json
|
tsconfig.json
|
||||||
|
|
||||||
# Project Rules
|
# Project Rules
|
||||||
!/build/prebuild.js
|
|
||||||
!**/bin/*.js
|
|
||||||
packages/**/*.js
|
packages/**/*.js
|
||||||
|
!/build/build.js
|
||||||
|
!**/bin/*.js
|
||||||
!packages/hydrojudge/service.js
|
!packages/hydrojudge/service.js
|
||||||
packages/**/*.js.map
|
|
||||||
packages/**/*.d.ts
|
|
||||||
|
|
||||||
# Data files
|
# Data files
|
||||||
*.mmdb
|
*.mmdb
|
||||||
|
|
||||||
|
# Base
|
||||||
|
node_modules/
|
||||||
|
__*
|
||||||
|
!__mocks__
|
||||||
|
!.gitkeep
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
const child = require('child_process');
|
||||||
|
const { argv } = require('yargs');
|
||||||
|
|
||||||
const compilerOptionsBase = {
|
const compilerOptionsBase = {
|
||||||
target: 'es2019',
|
target: 'es2019',
|
||||||
@@ -14,7 +16,10 @@ const compilerOptionsBase = {
|
|||||||
};
|
};
|
||||||
const config = {
|
const config = {
|
||||||
compilerOptions: compilerOptionsBase,
|
compilerOptions: compilerOptionsBase,
|
||||||
references: [{ path: 'tsconfig.build.json' }],
|
references: [
|
||||||
|
{ path: 'tsconfig.build.json' },
|
||||||
|
{ path: 'packages/hydrooj' },
|
||||||
|
],
|
||||||
files: [],
|
files: [],
|
||||||
};
|
};
|
||||||
const configSrc = {
|
const configSrc = {
|
||||||
@@ -47,7 +52,7 @@ const configFlat = {
|
|||||||
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'));
|
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'));
|
||||||
console.log(packages);
|
console.log(packages);
|
||||||
for (const package of 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));
|
const files = fs.readdirSync(path.resolve(process.cwd(), 'packages', package));
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
path.resolve(process.cwd(), 'packages', package, 'tsconfig.json'),
|
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));
|
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/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "node build/prebuild.js && tsc -b",
|
"build": "node build/build.js",
|
||||||
"build:watch": "node build/prebuild.js && tsc -b --watch",
|
"build:watch": "node build/build.js --watch",
|
||||||
"lint": "eslint packages --ext ts --fix",
|
"lint": "eslint packages --ext ts --fix",
|
||||||
"pub": "node build/publish",
|
"pub": "node build/publish",
|
||||||
"jest": "node build/jest",
|
"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\""
|
"clean": "zsh -c \"rm -r tsconfig.build.tsbuildinfo ./packages/*/tsconfig.tsbuildinfo ./packages/*/dist ./.coverage\""
|
||||||
},
|
},
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { inspect, InspectOptions, format } from 'util';
|
import { inspect, InspectOptions, format } from 'util';
|
||||||
import { argv } from 'yargs';
|
import { argv } from 'yargs';
|
||||||
import { stderr } from 'supports-color';
|
import { stderr } from 'supports-color';
|
||||||
|
import { } from './loader';
|
||||||
|
|
||||||
namespace Time {
|
namespace Time {
|
||||||
export const second = 1000;
|
export const second = 1000;
|
||||||
|
|||||||
Reference in new issue
Block a user