Skip to content

Commit 029098f

Browse files
committed
chore: improve build.ts and generate.ts
1 parent 3ae7fff commit 029098f

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

build.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { log } from '@stacksjs/cli'
2-
import { fs } from '@stacksjs/storage'
32
import { dts } from 'bun-plugin-dtsx'
3+
import fs from 'node:fs/promises'
44

55
log.info('Building...')
66

@@ -16,9 +16,9 @@ await Bun.build({
1616
})
1717

1818
// prepare dist for publishing
19-
await fs.move('./dist/bin/cli.js', './dist/cli.js')
20-
await fs.move('./dist/src/index.js', './dist/index.js')
21-
await fs.remove('./dist/src')
22-
await fs.remove('./dist/bin')
19+
await fs.rename('./dist/bin/cli.js', './dist/cli.js')
20+
await fs.rename('./dist/src/index.js', './dist/index.js')
21+
await fs.rm('./dist/src', { recursive: true, force: true })
22+
await fs.rm('./dist/bin', { recursive: true, force: true })
2323

2424
log.success('Built')

src/generate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ export async function generateDeclarationsFromFiles(options?: DtsGenerationConfi
5252
if (fileDeclarations) {
5353
const relativePath = relative(options?.root ?? './src', file)
5454
const parsedPath = parse(relativePath)
55-
const outputPath = join(options?.outdir ?? './dist', `${parsedPath.name}.d.ts`)
55+
const outputPath = join(options?.outdir ?? './dist', parsedPath.dir, `${parsedPath.name}.d.ts`)
5656

5757
await mkdir(dirname(outputPath), { recursive: true }) // Ensure the directory exists
5858
await writeToFile(outputPath, fileDeclarations) // Write the declarations without additional formatting

0 commit comments

Comments
 (0)