mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
auto generate tsconfig
This commit is contained in:
1 parent
829cbac937
commit
ce0357d9bd
14 files changed
+80
-238
No files matched your search
+21
-15
@@ -1,30 +1,36 @@
|
|||||||
|
# Base
|
||||||
node_modules/
|
node_modules/
|
||||||
config.yaml
|
!.gitkeep
|
||||||
config.json
|
!__mocks__
|
||||||
|
__*
|
||||||
|
|
||||||
|
# Built Files & Log
|
||||||
.build/
|
.build/
|
||||||
dist/
|
dist/
|
||||||
.cache/
|
|
||||||
*.cache
|
*.cache
|
||||||
__*
|
/build/*.js
|
||||||
ui/misc/.iconfont
|
.cache/
|
||||||
ui/static/locale
|
|
||||||
*.log
|
*.log
|
||||||
*.d.ts
|
*.d.ts
|
||||||
build/*.js
|
|
||||||
*.js.map
|
*.js.map
|
||||||
*.hydro
|
|
||||||
!.gitkeep
|
|
||||||
*.tsbuildinfo
|
*.tsbuildinfo
|
||||||
yarn.lock
|
*.hydro
|
||||||
|
.coverage
|
||||||
|
globalConfig.json
|
||||||
|
|
||||||
|
# Config Files
|
||||||
|
config.yaml
|
||||||
|
config.json
|
||||||
|
yarn.lock
|
||||||
|
tsconfig.json
|
||||||
|
|
||||||
|
# Project Rules
|
||||||
|
!/build/prebuild.js
|
||||||
|
!**/bin/*.js
|
||||||
packages/**/*.js
|
packages/**/*.js
|
||||||
!packages/hydrojudge/service.js
|
!packages/hydrojudge/service.js
|
||||||
!**/bin/*.js
|
|
||||||
packages/**/*.js.map
|
packages/**/*.js.map
|
||||||
packages/**/*.d.ts
|
packages/**/*.d.ts
|
||||||
|
|
||||||
|
# Data files
|
||||||
*.mmdb
|
*.mmdb
|
||||||
|
|
||||||
.coverage
|
|
||||||
!__mocks__
|
|
||||||
globalConfig.json
|
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
const fs = require('fs');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const compilerOptionsBase = {
|
||||||
|
target: 'es2019',
|
||||||
|
module: 'commonjs',
|
||||||
|
esModuleInterop: true,
|
||||||
|
moduleResolution: 'node',
|
||||||
|
declaration: true,
|
||||||
|
sourceMap: true,
|
||||||
|
composite: true,
|
||||||
|
strictBindCallApply: true,
|
||||||
|
experimentalDecorators: true,
|
||||||
|
};
|
||||||
|
const config = {
|
||||||
|
compilerOptions: compilerOptionsBase,
|
||||||
|
references: [{ path: 'tsconfig.build.json' }],
|
||||||
|
files: [],
|
||||||
|
};
|
||||||
|
const configSrc = {
|
||||||
|
compilerOptions: {
|
||||||
|
...compilerOptionsBase,
|
||||||
|
outDir: 'dist',
|
||||||
|
rootDir: 'src',
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
'src',
|
||||||
|
],
|
||||||
|
exclude: [
|
||||||
|
'**/__mocks__',
|
||||||
|
'bin',
|
||||||
|
'dist',
|
||||||
|
],
|
||||||
|
};
|
||||||
|
const configFlat = {
|
||||||
|
compilerOptions: {
|
||||||
|
...compilerOptionsBase,
|
||||||
|
outDir: '.',
|
||||||
|
rootDir: '.',
|
||||||
|
},
|
||||||
|
include: [
|
||||||
|
'*.ts',
|
||||||
|
],
|
||||||
|
exclude: [],
|
||||||
|
};
|
||||||
|
|
||||||
|
const packages = fs.readdirSync(path.resolve(process.cwd(), 'packages'));
|
||||||
|
console.log(packages);
|
||||||
|
for (const package of packages) {
|
||||||
|
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'),
|
||||||
|
files.includes('src') ? JSON.stringify(configSrc) : JSON.stringify(configFlat),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
fs.writeFileSync(path.resolve(process.cwd(), 'tsconfig.json'), JSON.stringify(config));
|
||||||
+2
-2
@@ -5,8 +5,8 @@
|
|||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc -b",
|
"build": "node build/prebuild.js && tsc -b",
|
||||||
"build:watch": "tsc -b --watch",
|
"build:watch": "node build/prebuild.js && tsc -b --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",
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2018",
|
|
||||||
"module": "commonjs",
|
|
||||||
"outDir": "dist",
|
|
||||||
"rootDir": "src",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"allowJs": false,
|
|
||||||
"resolveJsonModule": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"composite": true,
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": "dist",
|
|
||||||
"rootDir": "src"
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"src"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/__mocks__",
|
|
||||||
"bin",
|
|
||||||
"dist"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"outDir": ".",
|
|
||||||
"rootDir": "."
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"*.ts"
|
|
||||||
],
|
|
||||||
"exclude": []
|
|
||||||
}
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"target": "es2019",
|
|
||||||
"module": "commonjs",
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"declaration": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"composite": true,
|
|
||||||
"strictBindCallApply": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
},
|
|
||||||
"references": [
|
|
||||||
{ "path": "packages/hydrooj" },
|
|
||||||
{ "path": "packages/hydrojudge" },
|
|
||||||
{ "path": "packages/geoip" },
|
|
||||||
{ "path": "packages/better-search" },
|
|
||||||
{ "path": "packages/fps-importer" },
|
|
||||||
{ "path": "packages/login-with-github" },
|
|
||||||
{ "path": "packages/login-with-google" },
|
|
||||||
{ "path": "packages/login-with-osu" },
|
|
||||||
{ "path": "packages/login-with-qq" },
|
|
||||||
{ "path": "packages/migrate-vijos" },
|
|
||||||
{ "path": "tsconfig.build.json" },
|
|
||||||
],
|
|
||||||
"files": [],
|
|
||||||
}
|
|
||||||
Reference in new issue
Block a user