Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Oct 17, 2024
1 parent ea6b0a0 commit 77daa03
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions bin/cli.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { CAC } from '@stacksjs/cli'
import { version } from '../package.json'
import { generate } from '../src/generate'
import type { DtsGenerationOption } from '../src/types'
import type { DtsGenerationOption, DtsGenerationConfig } from '../src/types'
import { resolve } from 'node:path'

const cli = new CAC('dtsx')

const defaultOptions: DtsGenerationOption = {
const defaultOptions: DtsGenerationConfig = {
cwd: process.cwd(),
root: './src',
entrypoints: ['**/*.ts'],
Expand All @@ -33,21 +33,21 @@ cli
.example('dtsx generate --entrypoints src/index.ts,src/utils.ts --outdir dist/types')
.action(async (options: DtsGenerationOption) => {
try {
const mergedOptions: DtsGenerationOption = {
...defaultOptions,
...options,
entrypoints: options.entrypoints ? options.entrypoints.split(',') : defaultOptions.entrypoints,
const config: DtsGenerationConfig = {
entrypoints: options.entrypoints ? options.entrypoints : defaultOptions.entrypoints,
cwd: resolve(options.cwd || defaultOptions.cwd),
root: resolve(options.root || defaultOptions.root),
outdir: resolve(options.outdir || defaultOptions.outdir),
tsconfigPath: resolve(options.tsconfigPath || defaultOptions.tsconfigPath),
keepComments: options.keepComments || defaultOptions.keepComments,
clean: options.clean || defaultOptions.clean,
}

// if (options.verbose) {
// console.log('Using options:', mergedOptions)
// }

await generate(mergedOptions)
await generate(config)
} catch (error) {
console.error('Error generating .d.ts files:', error)
process.exit(1)
Expand Down

0 comments on commit 77daa03

Please sign in to comment.