Skip to content

Commit bd04ac3

Browse files
committed
docs: 📝 add TSDoc comments for components and functions
* Added JSDoc comments to `DetailItem`, `ProjectInfo`, and `index.tsx` for better documentation. * Improved code readability and maintainability by providing clear descriptions of parameters and return values. * Enhanced understanding of the codebase for future developers.
1 parent 970b374 commit bd04ac3

File tree

4 files changed

+25
-2
lines changed

4 files changed

+25
-2
lines changed

src/components/DetailItem.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
import { Text } from 'ink'
22

3+
/**
4+
* Display a detail item.
5+
*
6+
* @param label The label.
7+
* @param children The children.
8+
*
9+
* @example
10+
* ```tsx
11+
* <DetailItem label="🔖 Version">1.0.0</DetailItem>
12+
* // 🔖 Version: 1.0.0
13+
* ```
14+
*
15+
* @returns The detail item.
16+
*/
317
const DetailItem = ({
418
label,
519
children,

src/components/ProjectInfo.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package'
22
import { Box, Newline, Text } from 'ink'
33
import Divider from 'ink-divider'
4-
import Link from 'ink-link'
54
import DetailItem from './DetailItem'
65

6+
/**
7+
* Display information about the project.
8+
*
9+
* @param pkg The `package.json`.
10+
*/
711
const ProjectInfo = ({ pkg }: { pkg: JSONSchemaForNPMPackageJsonFiles }) => (
812
<Box
913
borderStyle="round"

src/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ import ProjectInfo from './components/ProjectInfo'
33

44
import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package'
55

6+
/**
7+
* Load the package.json file from the current working directory.
8+
*/
69
const pkg: JSONSchemaForNPMPackageJsonFiles = await import(
710
`${process.cwd()}/package.json`,
811
{

tests/apr.test.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import type { JSONSchemaForNPMPackageJsonFiles } from '@schemastore/package'
33
import { render } from 'ink-testing-library'
44
import ProjectInfo from '../src/components/ProjectInfo'
55

6-
// @ts-expect-error
6+
/**
7+
* The dummy package.json file from the playground directory.
8+
*/ // @ts-expect-error
79
const pkg: JSONSchemaForNPMPackageJsonFiles = await import(
810
'./playground/package.json',
911
{

0 commit comments

Comments
 (0)