Skip to content

Commit

Permalink
feat: add dts.banner and dts.footer options
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Nov 25, 2021
1 parent f7ed948 commit 557fcae
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -18,7 +18,7 @@
},
"scripts": {
"dev": "npm run build:simple -- --watch",
"build": "tsup src/cli-*.ts src/index.ts src/rollup.ts --clean --dts-resolve --splitting",
"build": "tsup src/cli-*.ts src/index.ts src/rollup.ts --clean --splitting",
"prepublishOnly": "npm run build",
"test": "npm run build:simple && jest",
"//": "Building without dts for speed",
Expand Down
4 changes: 4 additions & 0 deletions src/options.ts
Expand Up @@ -9,6 +9,10 @@ export type DtsConfig = {
resolve?: boolean | (string | RegExp)[]
/** Emit declaration files only */
only?: boolean
/** Insert at the top of each output .d.ts file */
banner?: string
/** Insert at the bottom */
footer?: string
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/rollup.ts
Expand Up @@ -162,6 +162,8 @@ const getRollupConfig = async (
dir: options.outDir || 'dist',
format: 'esm',
exports: 'named',
banner: dtsOptions.banner,
footer: dtsOptions.footer,
},
}
}
Expand Down
4 changes: 4 additions & 0 deletions tsup.config.ts
Expand Up @@ -3,6 +3,10 @@ import { defineConfig } from 'tsup'

export default defineConfig({
name: 'tsup',
dts: {
resolve: true,
banner: '// hehe',
},
esbuildPlugins: [
{
name: 'patch-rollup-plugin-dts',
Expand Down

1 comment on commit 557fcae

@vercel
Copy link

@vercel vercel bot commented on 557fcae Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.