From 50401453e75dfe367bc81b6a91a698cf6b36a4de Mon Sep 17 00:00:00 2001 From: iCrawl Date: Thu, 9 Jun 2022 16:14:37 +0200 Subject: [PATCH] fix(docgen): shorten output for path info --- packages/docgen/src/documentation.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/docgen/src/documentation.ts b/packages/docgen/src/documentation.ts index 985146b33..b880a4392 100644 --- a/packages/docgen/src/documentation.ts +++ b/packages/docgen/src/documentation.ts @@ -1,4 +1,4 @@ -import { dirname, join } from 'node:path'; +import { dirname, join, relative } from 'node:path'; import { Collection } from '@discordjs/collection'; import type { DeclarationReflection } from 'typedoc'; import type { ChildTypes, Class, Config, CustomDocs, RootTypes } from './interfaces/index.js'; @@ -158,7 +158,9 @@ export class Documentation { info.push(`member of "${memberOf}"`); } if (meta) { - info.push(`${join(meta.path, meta.file ?? '')}${meta.line ? `:${meta.line}` : ''}`); + info.push( + `${relative(this.config.root, join(meta.path, meta.file ?? ''))}${meta.line ? `:${meta.line}` : ''}`, + ); } console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`); @@ -222,7 +224,7 @@ export class Documentation { info.push(`member of "${memberof as string}"`); } if (meta) { - info.push(`${join(meta.path, meta.file)}${meta.line ? `:${meta.line}` : ''}`); + info.push(`${relative(this.config.root, join(meta.path, meta.file))}${meta.line ? `:${meta.line}` : ''}`); } console.warn(`- "${name}"${info.length ? ` (${info.join(', ')})` : ''} has no accessible parent.`);