docs(nxdev): improve related documentation link matcher (#13982)

This commit is contained in:
Benjamin Cabanes 2022-12-22 11:06:04 -05:00 committed by GitHub
parent 02983d45e8
commit e5108b84df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 23 additions and 19 deletions

View File

@ -1333,7 +1333,7 @@
}, },
{ {
"name": "Nx Devkit", "name": "Nx Devkit",
"path": "/packages#devkit", "path": "/packages/devkit/index",
"id": "packages-devkit", "id": "packages-devkit",
"isExternal": true, "isExternal": true,
"children": [], "children": [],
@ -1400,7 +1400,7 @@
}, },
{ {
"name": "Nx Devkit", "name": "Nx Devkit",
"path": "/packages#devkit", "path": "/packages/devkit/index",
"id": "packages-devkit", "id": "packages-devkit",
"isExternal": true, "isExternal": true,
"children": [], "children": [],
@ -1543,7 +1543,7 @@
}, },
{ {
"name": "--skip-nx-cache flag", "name": "--skip-nx-cache flag",
"path": "/nx/affected#skip-nx-cache", "path": "/packages/nx/documents/affected#skip-nx-cache",
"id": "skip-nx-cache-flag", "id": "skip-nx-cache-flag",
"isExternal": true, "isExternal": true,
"children": [], "children": [],
@ -1602,7 +1602,7 @@
}, },
{ {
"name": "--skip-nx-cache flag", "name": "--skip-nx-cache flag",
"path": "/nx/affected#skip-nx-cache", "path": "/packages/nx/documents/affected#skip-nx-cache",
"id": "skip-nx-cache-flag", "id": "skip-nx-cache-flag",
"isExternal": true, "isExternal": true,
"children": [], "children": [],

View File

@ -1663,7 +1663,7 @@
"file": "", "file": "",
"itemList": [], "itemList": [],
"isExternal": true, "isExternal": true,
"path": "/packages#devkit", "path": "/packages/devkit/index",
"tags": ["create-your-own-plugin"] "tags": ["create-your-own-plugin"]
}, },
{ {
@ -1741,14 +1741,14 @@
"path": "/packages", "path": "/packages",
"tags": [] "tags": []
}, },
"/packages#devkit": { "/packages/devkit/index": {
"id": "packages-devkit", "id": "packages-devkit",
"name": "Nx Devkit", "name": "Nx Devkit",
"description": "", "description": "",
"file": "", "file": "",
"itemList": [], "itemList": [],
"isExternal": true, "isExternal": true,
"path": "/packages#devkit", "path": "/packages/devkit/index",
"tags": ["create-your-own-plugin"] "tags": ["create-your-own-plugin"]
}, },
"/reference/glossary": { "/reference/glossary": {
@ -1925,7 +1925,7 @@
"file": "", "file": "",
"itemList": [], "itemList": [],
"isExternal": true, "isExternal": true,
"path": "/nx/affected#skip-nx-cache", "path": "/packages/nx/documents/affected#skip-nx-cache",
"tags": ["cache-task-results"] "tags": ["cache-task-results"]
}, },
{ {
@ -1993,14 +1993,14 @@
"path": "/nx-cloud/intro/what-is-nx-cloud", "path": "/nx-cloud/intro/what-is-nx-cloud",
"tags": ["cache-task-results", "distribute-task-execution"] "tags": ["cache-task-results", "distribute-task-execution"]
}, },
"/nx/affected#skip-nx-cache": { "/packages/nx/documents/affected#skip-nx-cache": {
"id": "skip-nx-cache-flag", "id": "skip-nx-cache-flag",
"name": "--skip-nx-cache flag", "name": "--skip-nx-cache flag",
"description": "", "description": "",
"file": "", "file": "",
"itemList": [], "itemList": [],
"isExternal": true, "isExternal": true,
"path": "/nx/affected#skip-nx-cache", "path": "/packages/nx/documents/affected#skip-nx-cache",
"tags": ["cache-task-results"] "tags": ["cache-task-results"]
}, },
"/reference/nx-json#tasks-runner-options": { "/reference/nx-json#tasks-runner-options": {

View File

@ -91,7 +91,7 @@
"file": "", "file": "",
"id": "skip-nx-cache-flag", "id": "skip-nx-cache-flag",
"name": "--skip-nx-cache flag", "name": "--skip-nx-cache flag",
"path": "/nx/affected#skip-nx-cache" "path": "/packages/nx/documents/affected#skip-nx-cache"
}, },
{ {
"description": "", "description": "",
@ -620,7 +620,7 @@
"file": "", "file": "",
"id": "packages-devkit", "id": "packages-devkit",
"name": "Nx Devkit", "name": "Nx Devkit",
"path": "/packages#devkit" "path": "/packages/devkit/index"
}, },
{ {
"description": "", "description": "",

View File

@ -539,7 +539,7 @@
"id": "packages-devkit", "id": "packages-devkit",
"tags": ["create-your-own-plugin"], "tags": ["create-your-own-plugin"],
"file": "", "file": "",
"path": "/packages#devkit", "path": "/packages/devkit/index",
"isExternal": true "isExternal": true
}, },
{ {
@ -613,7 +613,7 @@
"id": "skip-nx-cache-flag", "id": "skip-nx-cache-flag",
"file": "", "file": "",
"tags": ["cache-task-results"], "tags": ["cache-task-results"],
"path": "/nx/affected#skip-nx-cache", "path": "/packages/nx/documents/affected#skip-nx-cache",
"isExternal": true "isExternal": true
}, },
{ {

View File

@ -2,10 +2,14 @@ import { RelatedDocument } from './documents.models';
interface RelatedDocumentsCategory { interface RelatedDocumentsCategory {
id: string; id: string;
name: string; /**
* Matcher that will be evaluated against a path.
*/
matchers: string[]; matchers: string[];
name: string;
relatedDocuments: RelatedDocument[]; relatedDocuments: RelatedDocument[];
} }
export function categorizeRelatedDocuments( export function categorizeRelatedDocuments(
items: RelatedDocument[] items: RelatedDocument[]
): RelatedDocumentsCategory[] { ): RelatedDocumentsCategory[] {
@ -13,25 +17,25 @@ export function categorizeRelatedDocuments(
{ {
id: 'concepts', id: 'concepts',
name: 'Concepts', name: 'Concepts',
matchers: ['concepts', 'more-concepts'], matchers: ['/concepts/', '/more-concepts/'],
relatedDocuments: [], relatedDocuments: [],
}, },
{ {
id: 'recipes', id: 'recipes',
name: 'Recipes', name: 'Recipes',
matchers: ['recipes'], matchers: ['/recipes/'],
relatedDocuments: [], relatedDocuments: [],
}, },
{ {
id: 'reference', id: 'reference',
name: 'Reference', name: 'Reference',
matchers: ['nx', 'workspace'], matchers: ['/workspace/', '/packages/'],
relatedDocuments: [], relatedDocuments: [],
}, },
{ {
id: 'see-also', id: 'see-also',
name: 'See also', name: 'See also',
matchers: ['see-also'], matchers: ['/see-also/'],
relatedDocuments: [], relatedDocuments: [],
}, },
]; ];