Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/bone/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { define } from '@gunshi/definition'
import { defineWithTypes } from '@gunshi/definition'
import global, { pluginId as globalPluginId } from '@gunshi/plugin-global'
import renderer from '@gunshi/plugin-renderer'
import { describe, expect, test, vi } from 'vitest'
import { cli } from './index.ts'

import type { GlobalExtension, PluginId } from '@gunshi/plugin-global'

const entry = define<{ [K in PluginId]: GlobalExtension }>({
const entry = defineWithTypes<{ extensions: Record<PluginId, GlobalExtension> }>()({
name: 'entry',
args: {
say: {
Expand Down
2 changes: 1 addition & 1 deletion packages/definition/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bun add @gunshi/definition

## 🚀 Usage

You can define the gunshi command as JavaScript module with using `define` or `lazy`.
You can define the gunshi command as JavaScript module with using `define`, `defineWithTypes`, `lazy` and `lazyWithTypes`

The bellow example case which is using `define`:

Expand Down
10 changes: 4 additions & 6 deletions packages/definition/src/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { createCommandContext } from 'gunshi/context'
import { describe, expect, test } from 'vitest'
import { define, lazy } from './index.ts'

import type { CommandRunner } from './index.ts'
import { CommandRunner, define, lazy } from './index.ts'

describe('@gunshi/definition', () => {
test('define', async () => {
Expand All @@ -27,7 +25,7 @@ describe('@gunshi/definition', () => {

// test command execution
const ctx = await createCommandContext({
args: command.args!,
args: command.args,
Comment thread
kazupon marked this conversation as resolved.
values: { foo: 'bar' },
explicit: { foo: true },
positionals: [],
Expand All @@ -43,12 +41,12 @@ describe('@gunshi/definition', () => {
name: 'cmd1'
}
})
const result = await command.run!(ctx as Parameters<NonNullable<typeof command.run>>[0])
const result = await command.run(ctx)
expect(result).toBe('foo value: bar')
})

test('lazy', async () => {
const command = lazy(() => ctx => ctx.values.foo, {
const command = lazy(() => ctx => String(ctx.values.foo), {
name: 'lazy-test',
description: 'A lazy test command',
args: {
Expand Down
2 changes: 1 addition & 1 deletion packages/docs/src/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export default withMermaid({
? {
debug: path.resolve(
__dirname,
'../../../../node_modules/.pnpm/debug@4.4.1/node_modules/debug/src/browser.js'
'../../../../node_modules/.pnpm/debug@4.4.3/node_modules/debug/src/browser.js'
),
'@braintree/sanitize-url': path.resolve(
__dirname,
Expand Down
Loading
Loading