Skip to content

Commit

Permalink
chore: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisbbreuer committed Nov 7, 2024
1 parent 4c1f0d1 commit 00fb715
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion dts.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
Expand Down
4 changes: 2 additions & 2 deletions src/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 1 addition & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
@@ -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<void> {
Expand All @@ -22,7 +21,7 @@ export async function getAllTypeScriptFiles(directory?: string): Promise<string[

export async function checkIsolatedDeclarations(options?: DtsGenerationConfig): Promise<boolean> {
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
Expand Down

0 comments on commit 00fb715

Please sign in to comment.