Added scripts
This commit is contained in:
parent
f6f14c493c
commit
5dbb551e15
3 changed files with 69 additions and 0 deletions
15
scripts/run-tsd.mjs
Normal file
15
scripts/run-tsd.mjs
Normal file
|
@ -0,0 +1,15 @@
|
|||
/* eslint-disable @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
|
||||
// @ts-nocheck
|
||||
|
||||
import tsd from 'tsd';
|
||||
import formatter from 'tsd/dist/lib/formatter.js';
|
||||
|
||||
const diagnostics = await tsd.default({
|
||||
cwd: process.cwd(),
|
||||
typingsFile: './v9.d.ts',
|
||||
});
|
||||
|
||||
if (diagnostics.length > 0) {
|
||||
console.error(formatter.default(diagnostics));
|
||||
process.exit(1);
|
||||
}
|
11
scripts/tsconfig.json
Normal file
11
scripts/tsconfig.json
Normal file
|
@ -0,0 +1,11 @@
|
|||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"checkJs": true
|
||||
},
|
||||
"include": ["./**/*"]
|
||||
}
|
43
scripts/versions.mjs
Normal file
43
scripts/versions.mjs
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { exec } from 'node:child_process';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { promisify } from 'node:util';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = dirname(__filename);
|
||||
const rootDir = join(__dirname, '..');
|
||||
const execAsync = promisify(exec);
|
||||
|
||||
/**
|
||||
* @param {string} path
|
||||
* @param {string} version
|
||||
*/
|
||||
const fileToESMWrapperCall = (path, version) =>
|
||||
execAsync(`npx gen-esm-wrapper "${join(rootDir, path, `${version}.js`)}" "${join(rootDir, path, `${version}.mjs`)}"`);
|
||||
|
||||
await Promise.allSettled(
|
||||
[
|
||||
'v9',
|
||||
|
||||
// Voice
|
||||
'v4',
|
||||
]
|
||||
.map((version) => [
|
||||
fileToESMWrapperCall('gateway', version),
|
||||
fileToESMWrapperCall(`payloads/${version}`, 'index'),
|
||||
fileToESMWrapperCall(`rest/${version}`, 'index'),
|
||||
|
||||
// Voice
|
||||
fileToESMWrapperCall('voice', version),
|
||||
|
||||
// RPC
|
||||
fileToESMWrapperCall('rpc', version),
|
||||
|
||||
// Utils
|
||||
fileToESMWrapperCall('utils', version),
|
||||
|
||||
// Shortcuts
|
||||
fileToESMWrapperCall('', version),
|
||||
])
|
||||
.flat(),
|
||||
);
|
Loading…
Reference in a new issue