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

View File

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

View File

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

View File

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

View File

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