Skip to content

Commit

Permalink
feat(build): finalize tsup setup with multiple options for build
Browse files Browse the repository at this point in the history
  • Loading branch information
Danil Tarasov authored and norskeld committed Oct 8, 2022
1 parent e803455 commit d9a54a8
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 190 deletions.
106 changes: 0 additions & 106 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 2 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@
"node": ">=14.17.0"
},
"scripts": {
"build": "tsup && npm run build:rollup",
"build:rollup": "node --loader @esbuild-kit/esm-loader scripts/compile.ts",
"fmt:prettier": "prettier --write \"**/*.{js,ts,tsx,json}\"",
"build": "tsup",
"fmt:lint": "eslint --fix --ext .js,.ts,.tsx .",
"fmt:prettier": "prettier --write \"**/*.{js,ts,tsx,json}\"",
"postversion": "node --loader @esbuild-kit/esm-loader scripts/release.ts restore",
"prepare": "is-ci || husky install",
"prerelease": "node --loader @esbuild-kit/esm-loader scripts/release.ts prepare",
Expand Down Expand Up @@ -88,10 +87,6 @@
"is-ci": "^3.0.1",
"lint-staged": "^12.4.1",
"prettier": "^2.6.2",
"rimraf": "^3.0.2",
"rollup": "^2.74.1",
"rollup-plugin-dts": "^4.2.1",
"rollup-plugin-tsconfig-paths": "^1.3.0",
"semantic-release": "^19.0.2",
"tsup": "^6.2.3",
"typescript": "^4.8.4",
Expand Down
63 changes: 0 additions & 63 deletions scripts/compile.ts

This file was deleted.

10 changes: 0 additions & 10 deletions tsconfig.types.json

This file was deleted.

24 changes: 20 additions & 4 deletions tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,31 @@
import { defineConfig } from 'tsup'
import { defineConfig, type Options } from 'tsup'

const entry = ['src/index.ts', 'src/parsers.ts', 'src/combinators.ts']

export default defineConfig({
entry,
const sharedConfig = defineConfig({
splitting: false,
sourcemap: true,
clean: true,
format: ['esm', 'cjs'],
treeshake: true,
dts: true,
minify: false,
bundle: true
})

const mainConfig = defineConfig({
...sharedConfig,
entry,
dts: false
}) as Options

const createDTSConfig = (e: string): Options =>
defineConfig({
...sharedConfig,
entry,
dts: {
entry: e,
only: true
}
}) as Options

export default defineConfig([mainConfig, ...entry.map(createDTSConfig)])

0 comments on commit d9a54a8

Please sign in to comment.