mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 19:43:29 +01:00
fix: properly create index
This commit is contained in:
@@ -3,13 +3,9 @@ import { generateAllIndices } from '@discordjs/scripts';
|
|||||||
|
|
||||||
console.log('Generating all indices...');
|
console.log('Generating all indices...');
|
||||||
await generateAllIndices({
|
await generateAllIndices({
|
||||||
fetchPackageVersions: async (pkg) => {
|
|
||||||
console.log(`Fetching versions for ${pkg}...`);
|
|
||||||
return ['main'];
|
|
||||||
},
|
|
||||||
fetchPackageVersionDocs: async (pkg, version) => {
|
fetchPackageVersionDocs: async (pkg, version) => {
|
||||||
console.log(`Fetching data for ${pkg} ${version}...`);
|
console.log(`Fetching data for ${pkg} ${version}...`);
|
||||||
return JSON.parse(await readFile(`${process.cwd()}/../../packages/${pkg}/docs/docs.api.json`, 'utf8'));
|
return JSON.parse(await readFile(`${process.cwd()}/../../../docs/${pkg}/${version}.api.json`, 'utf8'));
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
console.log('Generated all indices.');
|
console.log('Generated all indices.');
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ try {
|
|||||||
await Promise.all(
|
await Promise.all(
|
||||||
indices.map(async (index) => {
|
indices.map(async (index) => {
|
||||||
console.log(`Uploading ${index.index}...`);
|
console.log(`Uploading ${index.index}...`);
|
||||||
return client.index(index.index).addDocuments(index.data);
|
await client.createIndex(index.index);
|
||||||
|
await client.index(index.index).addDocuments(index.data);
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
"description": "A set of scripts that we use for our workflows",
|
"description": "A set of scripts that we use for our workflows",
|
||||||
"private": true,
|
"private": true,
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc --noEmit && tsup",
|
"build": "tsc --noEmit --lib ESNext,DOM && tsup",
|
||||||
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src turbo/generators/config.ts",
|
"lint": "prettier --check . && cross-env TIMING=1 eslint --format=pretty src turbo/generators/config.ts",
|
||||||
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src turbo/generators/config.ts",
|
"format": "prettier --write . && cross-env TIMING=1 eslint --fix --format=pretty src turbo/generators/config.ts",
|
||||||
"fmt": "pnpm run format"
|
"fmt": "pnpm run format"
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ export async function generateAllIndices({
|
|||||||
fetchPackageVersions = fetchVersions,
|
fetchPackageVersions = fetchVersions,
|
||||||
fetchPackageVersionDocs = fetchVersionDocs,
|
fetchPackageVersionDocs = fetchVersionDocs,
|
||||||
writeToFile = true,
|
writeToFile = true,
|
||||||
}) {
|
} = {}) {
|
||||||
const indices: Record<any, any>[] = [];
|
const indices: Record<any, any>[] = [];
|
||||||
|
|
||||||
for (const pkg of PACKAGES) {
|
for (const pkg of PACKAGES) {
|
||||||
|
|||||||
@@ -1,6 +1,3 @@
|
|||||||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
|
||||||
/// <reference lib="dom" />
|
|
||||||
|
|
||||||
import { readFile } from 'node:fs/promises';
|
import { readFile } from 'node:fs/promises';
|
||||||
import process, { cwd } from 'node:process';
|
import process, { cwd } from 'node:process';
|
||||||
import { create } from '@actions/glob';
|
import { create } from '@actions/glob';
|
||||||
|
|||||||
Reference in New Issue
Block a user