mirror of
https://github.com/tauri-apps/tauri-search.git
synced 2026-02-04 02:41:20 +01:00
chore: removed refs to feature branch with TS AST
chore: added `anchor` property to consolidated index for consistency sake
This commit is contained in:
0
.github/actions/test-server/action.yml
vendored
Normal file
0
.github/actions/test-server/action.yml
vendored
Normal file
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@@ -8,8 +8,16 @@ on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
search-server:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Start Docker contained Search Server
|
||||
|
||||
testing:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
@@ -9,7 +9,6 @@ import { getEnv } from "~/utils/getEnv/node/getEnv";
|
||||
console.log(`- pushing Typescript API documents to Meilisearch [${o.stage}]`);
|
||||
const { errors, tasks } = await pushTypescriptDocs({
|
||||
...o,
|
||||
branch: "feat/generate-js-ast",
|
||||
});
|
||||
console.log();
|
||||
|
||||
|
||||
@@ -4,9 +4,7 @@ import { refreshTypescript } from "~/pipelines/refreshTypescript";
|
||||
|
||||
(async () => {
|
||||
console.log(`- refreshing Typescript ASTs and Docs cache`);
|
||||
const { docs, cacheFile, repo } = await refreshTypescript({
|
||||
branch: "feat/generate-js-ast",
|
||||
});
|
||||
const { docs, cacheFile, repo } = await refreshTypescript();
|
||||
console.log(`- completed caching of ${docs.length} TS API documents from ${repo}:`);
|
||||
console.log(` - Doc Cache: ${cacheFile}`);
|
||||
console.log();
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -12,6 +12,7 @@ export const ConsolidatedMapper: ModelMapper<
|
||||
IConsolidatedModel
|
||||
> = (i): IConsolidatedModel => ({
|
||||
objectID: i.id,
|
||||
anchor: i.id,
|
||||
hierarchy_lvl0: isRepoDocument(i)
|
||||
? i.name
|
||||
: isApiDocument(i)
|
||||
|
||||
@@ -3,6 +3,7 @@ import { IScrapeSelectorTargets } from "~/types";
|
||||
import { createModel } from "~/utils/createModel";
|
||||
|
||||
export type IConsolidatedModel = IScrapeSelectorTargets & {
|
||||
anchor: string;
|
||||
from: "prose" | "api" | "repo";
|
||||
rank: number;
|
||||
symbol: string | null;
|
||||
@@ -23,9 +24,9 @@ export const ConsolidatedModel = createModel<IConsolidatedModel>("consolidated",
|
||||
})
|
||||
.filterable("from", "language", "symbol")
|
||||
.searchable(
|
||||
"content",
|
||||
"hierarchy_lvl0",
|
||||
"hierarchy_lvl1",
|
||||
"content",
|
||||
"symbol",
|
||||
"tags",
|
||||
"rank",
|
||||
|
||||
@@ -10,7 +10,6 @@ export async function pushConsolidatedDocs(options: Partial<IEnv> = {}) {
|
||||
const docs: IConsolidatedModel[] = [
|
||||
...(await getCache(CacheKind.typescriptDocs, {
|
||||
...o,
|
||||
branch: "feat/generate-js-ast",
|
||||
}).then((c) => c.cache.map((c) => ConsolidatedMapper(c)))),
|
||||
...(await getCache(CacheKind.proseDocs, o).then((c) =>
|
||||
c.cache.map((c) => ConsolidatedMapper(c))
|
||||
|
||||
@@ -7,7 +7,7 @@ export async function rebuildCaches() {
|
||||
await Promise.all([
|
||||
refreshProse().then((c) => (prose = [c.cacheFile as string, c.docs?.length || 0])),
|
||||
refreshRepos().then((c) => (repos = [c.cacheFile as string, c.docs?.length || 0])),
|
||||
refreshTypescript({ branch: "feat/generate-js-ast" }).then(
|
||||
refreshTypescript().then(
|
||||
(c) => (typescript = [c.cacheFile as string, c.docs?.length || 0])
|
||||
),
|
||||
]);
|
||||
|
||||
@@ -13,8 +13,7 @@ describe.only("typescriptParser() - AST to List", () => {
|
||||
const { org, repo } = getEnv();
|
||||
const content = (await getRepoFile(
|
||||
`${org}/${repo}`,
|
||||
"docs/api/js/js-api.json",
|
||||
"feat/generate-js-ast"
|
||||
"docs/api/js/js-api.json"
|
||||
)) as TypescriptBlock;
|
||||
prj = await parseTypescriptAst(content);
|
||||
});
|
||||
|
||||
@@ -1,22 +1,13 @@
|
||||
import { readFile } from "fs/promises";
|
||||
import { LinkExists, linkExists, LinkMissing } from "../tools/linkExists";
|
||||
import { beforeAll, describe, expect, it } from "vitest";
|
||||
import { REPO_DOCS_CACHE, TS_DOCS_CACHE } from "~/constants";
|
||||
import { ConsolidatedMapper } from "~/mappers/ConsolidatedMapper";
|
||||
import { IApiModel, IProseModel, IRepoModel } from "~/models";
|
||||
import {
|
||||
proseDocsCacheFile,
|
||||
refreshProse,
|
||||
refreshRepos,
|
||||
refreshTypescript,
|
||||
} from "~/pipelines";
|
||||
import { getEnv } from "~/utils/getEnv";
|
||||
import { refreshProse, refreshRepos, refreshTypescript } from "~/pipelines";
|
||||
|
||||
import { CacheKind, getCache } from "~/utils/getCache";
|
||||
const { repo, branch } = getEnv();
|
||||
|
||||
describe("link testing of consolidated index", () => {
|
||||
beforeAll(async () => {
|
||||
await refreshTypescript({ branch: "feat/generate-js-ast" });
|
||||
await refreshTypescript();
|
||||
await refreshRepos();
|
||||
await refreshProse();
|
||||
});
|
||||
@@ -39,9 +30,9 @@ describe("link testing of consolidated index", () => {
|
||||
).toBeTruthy();
|
||||
});
|
||||
it("test links originating from Typescript API", async () => {
|
||||
const docs = (
|
||||
await getCache(CacheKind.typescriptDocs, { branch: "feat/generate-js-ast" })
|
||||
).cache.map((i) => ConsolidatedMapper(i));
|
||||
const docs = (await getCache(CacheKind.typescriptDocs)).cache.map((i) =>
|
||||
ConsolidatedMapper(i)
|
||||
);
|
||||
const links: Promise<LinkExists | LinkMissing>[] = [];
|
||||
for (const doc of docs) {
|
||||
links.push(linkExists(doc.url));
|
||||
|
||||
Reference in New Issue
Block a user