Skip to content

Commit

Permalink
Use multiple tsconfig files, otherwise it's a mess (#286)
Browse files Browse the repository at this point in the history
* Use multiple tsconfig files, otherwise it's a mess and we get tests in dist

* No need to do git add in lint-staged anymore
  • Loading branch information
kamilkisiela authored Feb 12, 2020
1 parent 25fb213 commit c420f37
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
5 changes: 5 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'node',
globals: {
'ts-jest': {
tsConfig: 'tsconfig.test.json',
},
},
};
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"yamljs": "0.3.0"
},
"scripts": {
"start": "ts-node -O \"{\\\"module\\\": \\\"commonjs\\\"}\" example/index.ts",
"start": "ts-node --project tsconfig.example.json example/index.ts",
"clean": "rm -rf dist",
"prebuild": "yarn clean",
"build": "bob",
Expand Down Expand Up @@ -88,8 +88,7 @@
},
"lint-staged": {
"*.{ts,js,md,json}": [
"prettier --write",
"git add"
"prettier --write"
]
},
"bundlesize": [
Expand Down
7 changes: 7 additions & 0 deletions tsconfig.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS"
},
"include": ["example"]
}
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
"importHelpers": true,
"resolveJsonModule": true
},
"exclude": ["node_modules", "dist"]
"include": ["src"]
}
7 changes: 7 additions & 0 deletions tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
"module": "CommonJS"
},
"include": ["tests"]
}

0 comments on commit c420f37

Please sign in to comment.