diff --git a/dts.config.ts b/dts.config.ts index ed17a96..71bad2d 100644 --- a/dts.config.ts +++ b/dts.config.ts @@ -5,10 +5,10 @@ const config: DtsGenerationOption = { root: './src', entrypoints: ['**/*.ts'], outdir: './dist', - keepComments: true, clean: true, verbose: false, + // keepComments: true, // bundle: true, // minify: true, } diff --git a/src/generate.ts b/src/generate.ts index bd36752..871cb8b 100644 --- a/src/generate.ts +++ b/src/generate.ts @@ -21,10 +21,10 @@ export async function generateDeclarationsFromFiles(options?: DtsGenerationConfi let files: string[] if (options?.entrypoints) { - files = await glob(options.entrypoints, { cwd: options.root ?? options.cwd, absolute: true }) + files = await glob(options.entrypoints, { cwd: options.root ?? `${options.cwd}/src`, absolute: true }) } else { - files = await getAllTypeScriptFiles(options?.root) + files = await getAllTypeScriptFiles(options?.root ?? `${options?.cwd}/src`) } for (const file of files) { diff --git a/src/utils.ts b/src/utils.ts index 1475f7e..ac0c488 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,7 +1,6 @@ import type { DtsGenerationConfig } from './types' import { readdir } from 'node:fs/promises' import { extname, join } from 'node:path' -import process from 'node:process' import { config } from './config' export async function writeToFile(filePath: string, content: string): Promise { @@ -22,7 +21,7 @@ export async function getAllTypeScriptFiles(directory?: string): Promise { try { - const tsconfigPath = options?.tsconfigPath || join(options?.root ?? process.cwd(), 'tsconfig.json') + const tsconfigPath = options?.tsconfigPath || join(options?.cwd ?? './', 'tsconfig.json') const tsconfig = await import(tsconfigPath) return tsconfig.compilerOptions?.isolatedDeclarations === true