Skip to content

Commit

Permalink
chore: improve the pnpm add-function command
Browse files Browse the repository at this point in the history
Include a boilerplate comment block with @see and @example tags filled in.
  • Loading branch information
aleclarson committed Jul 12, 2024
1 parent 024f88f commit 2154f96
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 1 deletion.
9 changes: 9 additions & 0 deletions benchmarks/test/test.bench.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as _ from 'radashi'
import { bench } from 'vitest'

describe('test', () => {
bench('with no arguments', () => {
_.test()
})
})

14 changes: 14 additions & 0 deletions docs/test/test.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: test
description: Test
---

### Usage

Does a thing. Returns a value.

```ts
import * as _ from 'radashi'

_.test()
```
2 changes: 1 addition & 1 deletion scripts/add-function.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ fi

if [ ! -f "$SRC_FILE" ]; then
mkdir -p "$SRC_DIR"
echo -e "export function $FUNC_NAME(): void {}\n" > "$SRC_FILE"
echo -e "/**\n * Does a thing.\n *\n * @see https://radashi-org.github.io/reference/$GROUP_NAME/$FUNC_NAME\n * @example\n * \`\`\`ts\n * $FUNC_NAME()\n * \`\`\`\n */\nexport function $FUNC_NAME(): void {}\n" > "$SRC_FILE"
else
echo "Warning: $SRC_FILE already exists. Skipping."
fi
Expand Down
12 changes: 12 additions & 0 deletions src/test/test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Does a thing.
*
* @see https://radashi-org.github.io/reference/test/test
* @example
*
* ```ts
* test()
* ```
*/
export function test(): void {}

8 changes: 8 additions & 0 deletions tests/test/test.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import * as _ from 'radashi'

describe('test', () => {
test('does a thing', () => {
expect(_.test()).toBe(undefined)
})
})

0 comments on commit 2154f96

Please sign in to comment.