mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-03-22 01:35:31 -05:00
Emit .d.ts types for NPM package
This commit is contained in:
parent
72bd8baf9e
commit
62023bd299
|
|
@ -16,7 +16,7 @@ const CRASH_EMAIL_THROTTLE = 5 * 60 * 1000; // 5 minutes
|
|||
const logPath = path.resolve(
|
||||
// not sure why this is necessary, but in Windows testing it was
|
||||
__dirname, '../', __dirname.includes(`${path.sep}dist${path.sep}`) ? '..' : '',
|
||||
path.join(global.Config?.logsdir || 'logs', 'errors.txt')
|
||||
path.join((global as any).Config?.logsdir || 'logs', 'errors.txt')
|
||||
);
|
||||
let lastCrashLog = 0;
|
||||
let transport: any;
|
||||
|
|
@ -50,7 +50,7 @@ export function crashlogger(
|
|||
console.error(`\nSUBCRASH: ${err.stack}\n`);
|
||||
});
|
||||
|
||||
const emailOpts = emailConfig || global.Config?.crashguardemail;
|
||||
const emailOpts = emailConfig || (global as any).Config?.crashguardemail;
|
||||
if (emailOpts && ((datenow - lastCrashLog) > CRASH_EMAIL_THROTTLE)) {
|
||||
lastCrashLog = datenow;
|
||||
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ export class QueryProcessWrapper<T, U> implements ProcessWrapper {
|
|||
// it's also futureproofing in case other external modfules require this
|
||||
// we also specifically do not throw here because this json might be sensitive,
|
||||
// so we only want it to go to emails
|
||||
global.Monitor?.crashlog?.(e, `a ${path.basename(this.file)} process`, { result: obj });
|
||||
(global as any).Monitor?.crashlog?.(e, `a ${path.basename(this.file)} process`, { result: obj });
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -62,6 +62,8 @@ type ErrorHandler = (error: Error, data: DatabaseQuery, isParentProcess: boolean
|
|||
|
||||
function getModule() {
|
||||
try {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore does not exist while building NPM package???
|
||||
return require('better-sqlite3') as typeof sqlite.default;
|
||||
} catch {
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
"description": "The server for the Pokémon Showdown battle simulator",
|
||||
"version": "0.11.9",
|
||||
"main": "dist/sim/index.js",
|
||||
"types": "dist/sim/index.d.ts",
|
||||
"dependencies": {
|
||||
"esbuild": "^0.16.10",
|
||||
"mysql2": "^3.9.7",
|
||||
|
|
@ -34,6 +35,8 @@
|
|||
"scripts": {
|
||||
"start": "node pokemon-showdown start",
|
||||
"build": "node build",
|
||||
"build-npm": "npx tsc sim/global-types.ts sim/index.ts --declaration --emitDeclarationOnly --declarationDir dist/ --target es2020 --strict --moduleResolution node --types node --lib es2020",
|
||||
"test-npm": "npx tsc sim/global-types.ts sim/index.ts --noEmit --target es2020 --strict --moduleResolution node --types node --lib es2020",
|
||||
"tsc": "tsc",
|
||||
"lint": "eslint --cache",
|
||||
"fix": "eslint --cache --fix",
|
||||
|
|
@ -42,7 +45,7 @@
|
|||
"test": "mocha",
|
||||
"posttest": "npm run tsc",
|
||||
"full-test": "npm run lint && npm run tsc && mocha --timeout 8000 --forbid-only -g \".*\"",
|
||||
"full-test-ci": "eslint --max-warnings 0 && tsc && (([ \"$SKIPSIMTESTS\" = true ] && mocha --timeout 8000 --forbid-only -g \".*\" --exclude \"test/{sim,random-battles}/**\") || mocha --timeout 8000 --forbid-only -g \".*\")",
|
||||
"full-test-ci": "eslint --max-warnings 0 && tsc && (([ \"$SKIPSIMTESTS\" = true ] && mocha --timeout 8000 --forbid-only -g \".*\" --exclude \"test/{sim,random-battles}/**\") || mocha --timeout 8000 --forbid-only -g \".*\") && npm run test-npm",
|
||||
"postinstall": "npm run build postinstall"
|
||||
},
|
||||
"bin": "./pokemon-showdown",
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@
|
|||
"types": ["node"],
|
||||
"exclude": [
|
||||
"/Applications/Visual Studio Code.app/Contents/Resources/app/extensions/node_modules/typescript/lib/lib.dom.d.ts",
|
||||
"./.*-dist/**/*",
|
||||
"./dist/**/*",
|
||||
"./server/chat-plugins/private/*/*.d.ts"
|
||||
],
|
||||
"include": [
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user