Skip to content

Commit

Permalink
build(dts): rm redundant triple slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Feb 24, 2024
1 parent 9c17cd4 commit 924fd41
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/build-dts.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import fs from 'fs/promises'
import { generateDtsBundle } from 'dts-bundle-generator'
import glob from 'fast-glob'

const entry = {
filePath: './src/vendor.ts',
Expand Down Expand Up @@ -72,4 +73,15 @@ result = result

await fs.writeFile(entry.outFile, result, 'utf8')

// Replaces redundant triple-slash directives
for (const dts of await glob(['build/**/*.d.ts', '!build/vendor.d.ts'])) {
const contents =
(await fs.readFile(dts, 'utf8'))
.split('\n')
.filter(line => !line.startsWith('/// <reference types'))
.join('\n')

await fs.writeFile(dts, contents, 'utf8')
}

process.exit(0)

0 comments on commit 924fd41

Please sign in to comment.