Skip to content

Commit

Permalink
Use tsconfig.json & make sure common types are included in packed build
Browse files Browse the repository at this point in the history
  • Loading branch information
whizkydee committed May 16, 2020
1 parent 5614b31 commit 324ddb8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
2 changes: 2 additions & 0 deletions common.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
declare type ValueOf<T> = T[keyof T]
declare type PlainObject<T = any> = { [key: string]: T }
2 changes: 0 additions & 2 deletions global.d.ts

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "@mrolaolu/helpers",
"license": "MIT",
"files": [
"dist"
"dist",
"common.d.ts"
],
"version": "0.3.0",
"main": "dist/cjs/index.js",
Expand Down
16 changes: 6 additions & 10 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import path from 'path'
import babel from 'rollup-plugin-babel'
import defaultTsConfig from './tsconfig.json'
import multiInput from 'rollup-plugin-multi-input'
import typescript from '@rollup/plugin-typescript'

Expand All @@ -10,16 +11,11 @@ export default {
plugins: [
multiInput(),
typescript({
lib: ['DOM'],
target: 'es5',
downlevelIteration: true,
outDir: isCommonJS ? 'dist/cjs' : 'dist/esm',
strict: true,
rootDir: 'src',
pretty: true,
declaration: true,
esModuleInterop: true,
exclude: ['node_modules', 'dist'],
...defaultTsConfig.compilerOptions,
...{
outDir: isCommonJS ? 'dist/cjs' : 'dist/esm',
exclude: defaultTsConfig.exclude,
},
}),
babel({
exclude: 'node_modules/**',
Expand Down
13 changes: 13 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"compilerOptions": {
"lib": ["DOM"],
"target": "es5",
"downlevelIteration": true,
"strict": true,
"rootDir": "src",
"pretty": true,
"declaration": true,
"esModuleInterop": true
},
"exclude": ["node_modules", "dist"]
}

0 comments on commit 324ddb8

Please sign in to comment.