Skip to content

Commit

Permalink
feat(@molt/command)!: zod as extension (#249)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Nov 19, 2023
1 parent f35fdc7 commit 5fe8c0f
Show file tree
Hide file tree
Showing 93 changed files with 1,706 additions and 1,800 deletions.
240 changes: 152 additions & 88 deletions packages/@molt/command/README.md

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions packages/@molt/command/examples/intro.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Zod } from '../src/extensions/zod/zod.js'
import { Command } from '../src/index.js'
import { z } from 'zod'

const args = await Command.create()
.use(Zod)
.parameter(`filePath`, z.string().describe(`Path to the file to convert.`))
.parameter(`to`, z.enum([`json`, `yaml`, `toml`]).describe(`Format to convert to.`))
.parameter(`from`, {
schema: z.enum([`json`, `yaml`, `toml`]).optional(),
})
.parameter(`from`, z.enum([`json`, `yaml`, `toml`]).optional())
.parameter(
`verbose v`,
z.boolean().default(false).describe(`Log detailed progress as conversion executes.`),
Expand Down
2 changes: 2 additions & 0 deletions packages/@molt/command/examples/kitchen-sink.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Zod } from '../src/_entrypoints/extensions.js'
import { Command } from '../src/index.js'
import { z } from 'zod'

const args = Command.create()
.use(Zod)
.description(
`This is a so-called "kitchen-sink" Molt Command example. Many features are demonstrated here though the overall CLI itself makes no sense. Take a look around, see how the help renders, try running with different inputs, etc.`,
)
Expand Down
2 changes: 2 additions & 0 deletions packages/@molt/command/examples/prompt.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { Zod } from '../src/_entrypoints/extensions.js'
import { Command } from '../src/index.js'
import { z } from 'zod'

const args = await Command.create()
.use(Zod)
// required
.parameter(`alpha`, z.string())
.parameter(`bravo`, z.number())
Expand Down
2 changes: 2 additions & 0 deletions packages/@molt/command/examples/publish.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Zod } from '../src/_entrypoints/extensions.js'
import { Command } from '../src/index.js'
import semverRegex from 'semver-regex'
import { z } from 'zod'

const args = Command.create()
.use(Zod)
.parameter(`githubToken`, z.string())
.parameter(`publish`, z.boolean().default(true))
.parameter(`githubRelease`, z.boolean().default(true))
Expand Down
2 changes: 1 addition & 1 deletion packages/@molt/command/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
},
"./types": {
"import": {
"types": "./build/esm/entrypoints/types.d.ts"
"types": "./build/esm/_entrypoints/types.d.ts"
}
}
},
Expand Down
173 changes: 0 additions & 173 deletions packages/@molt/command/src/Command/State.ts

This file was deleted.

34 changes: 0 additions & 34 deletions packages/@molt/command/src/Command/exclusive/constructor.ts

This file was deleted.

65 changes: 0 additions & 65 deletions packages/@molt/command/src/Command/exclusive/types.ts

This file was deleted.

Loading

0 comments on commit 5fe8c0f

Please sign in to comment.