mirror of
https://github.com/smogon/pokemon-showdown-loginserver.git
synced 2026-04-25 16:19:58 -05:00
Fix compiling
This commit is contained in:
parent
93e6bf862d
commit
462e6e6a3c
|
|
@ -12,24 +12,20 @@ import * as defaults from '../config/config-example';
|
|||
export type Configuration = typeof defaults & {[k: string]: any};
|
||||
|
||||
export function load(invalidate = false): Configuration {
|
||||
if (invalidate) delete require.cache[path.resolve(__dirname, '../config/config')];
|
||||
const config: typeof defaults & {[k: string]: any} = defaults;
|
||||
const configPath = path.resolve(__dirname, '../config/config.js');
|
||||
if (invalidate) delete require.cache[configPath];
|
||||
let config: typeof defaults & {[k: string]: any} = defaults;
|
||||
try {
|
||||
Object.assign(config, require('../config/config'));
|
||||
config = {...config, ...require(configPath)};
|
||||
} catch (err: any) {
|
||||
if (err.code !== 'MODULE_NOT_FOUND' && err.code !== 'ENOENT') throw err; // Should never happen
|
||||
if (err.code !== 'ENOENT') throw err; // Should never happen
|
||||
|
||||
console.log("config.js doesn't exist - creating one with default settings...");
|
||||
fs.writeFileSync(
|
||||
path.resolve(__dirname, '../config/config.js'),
|
||||
configPath,
|
||||
fs.readFileSync(path.resolve(__dirname, '../config/config-example.js'))
|
||||
);
|
||||
}
|
||||
// we really don't need to load from here afterwards since
|
||||
// the configuration in the new config will be the same as defaults.
|
||||
if (!config.routes) {
|
||||
config.routes = require('../config/routes');
|
||||
}
|
||||
if (!config.mainserver) {
|
||||
config.mainserver = 'showdown';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,18 +1,17 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"lib": ["es6"],
|
||||
"module": "commonjs",
|
||||
"lib": ["es2020"],
|
||||
"target": "es6",
|
||||
"module": "CommonJS",
|
||||
"moduleResolution": "node",
|
||||
"outDir": ".dist",
|
||||
"strict": true,
|
||||
"allowJs": true,
|
||||
"checkJs": true,
|
||||
"outDir": "./.dist",
|
||||
"incremental": true,
|
||||
"allowUnreachableCode": false,
|
||||
"skipLibCheck": true
|
||||
"esModuleInterop": true
|
||||
},
|
||||
"types": ["node"],
|
||||
"include": [
|
||||
"./src"
|
||||
"./src/*",
|
||||
],
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user