Skip to content

Commit

Permalink
Improve bundle size
Browse files Browse the repository at this point in the history
  • Loading branch information
FDiskas committed Mar 2, 2020
1 parent fa3e4e2 commit 54b9df7
Show file tree
Hide file tree
Showing 6 changed files with 415 additions and 794 deletions.
8 changes: 8 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
coverage
src
tslint.json
tsconfig.json
jest.config.js
codecov.yml
.travis.yml
.editorconfig
18 changes: 2 additions & 16 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
module.exports = {
transform: {
'^.+\\.tsx?$': 'ts-jest'
},
preset: 'ts-jest',
testEnvironment: 'node',
testMatch: ['**/*.spec.ts'],
moduleFileExtensions: [
'ts',
'js',
'json'
],
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.json',
}
},
moduleNameMapper: require('./dist')(),
};
};
22 changes: 13 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "0.1.2",
"description": "Synchronization tsconfig paths with Jest (module name mapper)",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"repository": "https://github.com/sebastianmusial/jest-module-name-mapper",
"author": "Sebastian Musiał",
"license": "MIT",
Expand All @@ -20,8 +21,10 @@
"tests"
],
"scripts": {
"clear": "rimraf dist",
"build": "yarn clear && tsc",
"clear": "tsc -b --clean",
"prebuild": "yarn clear && yarn generate",
"build": "tsc -b --force",
"generate": "dts-generator --name jest-module-name-mapper --project ./tsconfig.json --out dist/index.d.ts --main jest-module-name-mapper/index --prefix jest-module-name-mapper",
"start": "nodemon --watch src --ext ts --ignore '*.spec.ts' --exec ts-node src/index.ts",
"lint": "tslint --config tslint.json --project tsconfig.json",
"pretest": "yarn lint",
Expand All @@ -44,15 +47,16 @@
"chalk": "^2.4.2"
},
"devDependencies": {
"@types/jest": "^23.3.12",
"@types/jest": "^25.1.3",
"@types/node": "^10.12.18",
"tslib": "^1.11.1",
"dts-generator": "^3.0.0",
"husky": "^1.3.1",
"nodemon": "^1.18.9",
"jest": "^25.1.0",
"ts-jest": "^23.10.5",
"ts-node": "^7.0.1",
"tslint": "^5.12.0",
"typescript": "^3.2.2"
"nodemon": "^2.0.2",
"ts-jest": "^25.2.1",
"ts-node": "^8.6.2",
"tslib": "^1.11.1",
"tslint": "^6.0.0",
"typescript": "^3.8.3"
}
}
4 changes: 1 addition & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { moduleNameMapper } from './path.factory';

const bootstrap = (path?: string) => moduleNameMapper(path);

module.exports = bootstrap;
export const bootstrap = (path?: string) => moduleNameMapper(path);
20 changes: 11 additions & 9 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
{
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/",
"rootDir": "src",
"outDir": "dist",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"esModuleInterop": true,
"module": "commonjs",
"resolveJsonModule": true,
"moduleResolution": "node",
"sourceMap": true,
"sourceMap": false,
"noImplicitAny": false,
"noEmitOnError": true,
"forceConsistentCasingInFileNames": true,
Expand All @@ -24,15 +26,15 @@
"dom",
"es2017"
],
"typeRoots": [
"./node_modules/@types"
],
"paths": {
"@src/*": ["src/*"]
"@src/*": [
"src/*"
]
}
},
"include": [
"./node_modules/@types",
"./src/**/*.ts"
"exclude": [
"dist",
"src/**/*.spec.ts",
"src/mocks/*"
]
}
Loading

0 comments on commit 54b9df7

Please sign in to comment.