mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
chore: update deps & search indice action refactor (#11339)
* chore: update deps & search indice action refactor - Updated pnpm, dependencies and regenerated the lockfile - Removed immer and some eslint plugins that weren't being used - Updated the version of `@types/node` to v24 on internal packages as that's the version that is being used on github actions - Refactored the uploadSearchIndices action slightly and upgraded the meilisearch dependency * chore: remove more deps
This commit is contained in:
@@ -48,7 +48,7 @@
|
||||
"@discordjs/scripts": "workspace:^",
|
||||
"cloudflare": "^5.2.0",
|
||||
"commander": "^14.0.2",
|
||||
"meilisearch": "^0.38.0",
|
||||
"meilisearch": "^0.54.0",
|
||||
"p-limit": "^7.2.0",
|
||||
"p-queue": "^9.0.1",
|
||||
"tslib": "^2.8.1",
|
||||
@@ -56,8 +56,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@npm/types": "^2.1.0",
|
||||
"@types/bun": "^1.3.3",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/bun": "^1.3.4",
|
||||
"@types/node": "^24.10.1",
|
||||
"@vitest/coverage-v8": "^4.0.15",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
|
||||
@@ -2,33 +2,35 @@ import process from 'node:process';
|
||||
import { setFailed } from '@actions/core';
|
||||
import { generateAllIndices } from '@discordjs/scripts';
|
||||
import Cloudflare from 'cloudflare';
|
||||
import { MeiliSearch } from 'meilisearch';
|
||||
import { type EnqueuedTask, MeiliSearch } from 'meilisearch';
|
||||
import pLimit from 'p-limit';
|
||||
import { fetch } from 'undici';
|
||||
|
||||
if (!(process.env.CF_D1_DOCS_API_KEY && process.env.CF_D1_DOCS_ID && process.env.CF_ACCOUNT_ID)) {
|
||||
if (!process.env.CF_D1_DOCS_API_KEY || !process.env.CF_D1_DOCS_ID || !process.env.CF_ACCOUNT_ID) {
|
||||
setFailed('Missing Cloudflare D1 environment variables.');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!process.env.SEARCH_API_URL) {
|
||||
setFailed('SEARCH_API_URL is not set');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
if (!process.env.SEARCH_API_KEY) {
|
||||
setFailed('SEARCH_API_KEY is not set');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const cf = new Cloudflare({
|
||||
apiToken: process.env.CF_D1_DOCS_API_KEY!,
|
||||
apiToken: process.env.CF_D1_DOCS_API_KEY,
|
||||
});
|
||||
|
||||
const client = new MeiliSearch({
|
||||
host: process.env.SEARCH_API_URL!,
|
||||
apiKey: process.env.SEARCH_API_KEY!,
|
||||
host: process.env.SEARCH_API_URL,
|
||||
apiKey: process.env.SEARCH_API_KEY,
|
||||
});
|
||||
|
||||
const limit = pLimit(10);
|
||||
let promises: Promise<any>[] = [];
|
||||
|
||||
try {
|
||||
console.log('Generating all indices...');
|
||||
@@ -62,35 +64,31 @@ try {
|
||||
|
||||
console.log('Uploading indices...');
|
||||
|
||||
try {
|
||||
promises = indices.map(async (index) =>
|
||||
limit(async () => {
|
||||
console.log(`Uploading ${index.index}...`);
|
||||
let task;
|
||||
try {
|
||||
task = await client.createIndex(index.index);
|
||||
} catch {}
|
||||
const promises = indices.map(async (index) =>
|
||||
limit(async () => {
|
||||
console.log(`Uploading ${index.index}...`);
|
||||
let task: EnqueuedTask | undefined;
|
||||
try {
|
||||
task = await client.createIndex(index.index);
|
||||
} catch {}
|
||||
|
||||
if (task) {
|
||||
await client.waitForTask(task.taskUid);
|
||||
}
|
||||
if (task) {
|
||||
await client.tasks.waitForTask(task);
|
||||
}
|
||||
|
||||
const searchIndex = client.index(index.index);
|
||||
await searchIndex.updateSettings({ sortableAttributes: ['type'] });
|
||||
const searchIndex = client.index(index.index);
|
||||
await searchIndex.updateSettings({ sortableAttributes: ['type'] });
|
||||
|
||||
await searchIndex.addDocuments(index.data);
|
||||
}),
|
||||
);
|
||||
} catch {}
|
||||
await searchIndex.addDocuments(index.data);
|
||||
}),
|
||||
);
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
console.log('Uploaded all indices.');
|
||||
} catch (error) {
|
||||
const err = error as Error;
|
||||
console.error(err);
|
||||
setFailed(err.message);
|
||||
}
|
||||
|
||||
try {
|
||||
await Promise.all(promises);
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
"@rushstack/node-core-library": "5.13.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-neon": "^0.2.9",
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
"@microsoft/tsdoc": "~0.15.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-neon": "^0.2.9",
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/lodash": "^4.17.21",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"@types/resolve": "^1.20.6",
|
||||
"@types/semver": "^7.7.1",
|
||||
"cpy-cli": "^6.0.0",
|
||||
|
||||
@@ -92,8 +92,6 @@
|
||||
"eslint-config-neon": "^0.2.9",
|
||||
"eslint-formatter-compact": "^9.0.1",
|
||||
"eslint-formatter-pretty": "^7.0.0",
|
||||
"eslint-plugin-import": "^2.32.0",
|
||||
"eslint-plugin-jsdoc": "^54.7.0",
|
||||
"prettier": "^3.7.4",
|
||||
"tsd": "^0.33.0",
|
||||
"turbo": "^2.6.3",
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jsdoc-to-markdown": "^7.0.6",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-neon": "^0.2.9",
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@turbo/gen": "^2.6.3",
|
||||
"@types/node": "^22.19.1",
|
||||
"@types/node": "^24.10.1",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
"eslint-config-neon": "^0.2.9",
|
||||
|
||||
@@ -167,7 +167,10 @@ export async function generateAllIndices({
|
||||
fetchPackageVersionDocs = fetchVersionDocs,
|
||||
writeToFile = true,
|
||||
} = {}) {
|
||||
const indices: Record<any, any>[] = [];
|
||||
const indices: {
|
||||
data: ReturnType<typeof visitNodes>;
|
||||
index: string;
|
||||
}[] = [];
|
||||
|
||||
for (const pkg of PACKAGES) {
|
||||
const versions = await fetchPackageVersions(pkg);
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
"@types/react-dom": "^19.2.3",
|
||||
"@unocss/eslint-plugin": "^66.5.10",
|
||||
"@unocss/reset": "^66.5.10",
|
||||
"@vitejs/plugin-react": "^5.1.1",
|
||||
"@vitejs/plugin-react": "^5.1.2",
|
||||
"chromatic": "^13.3.4",
|
||||
"cross-env": "^10.1.0",
|
||||
"eslint": "^9.39.1",
|
||||
@@ -84,7 +84,7 @@
|
||||
"turbo": "^2.6.3",
|
||||
"typescript": "~5.9.3",
|
||||
"unocss": "^66.5.10",
|
||||
"vite": "^7.2.6",
|
||||
"vite": "^7.2.7",
|
||||
"vite-plugin-dts": "^4.5.4"
|
||||
},
|
||||
"engines": {
|
||||
|
||||
Reference in New Issue
Block a user