From 7a39206d19307982b5e0ca63f788ee751f590d6f Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Sun, 8 Mar 2020 14:27:01 -0400 Subject: [PATCH] Prepare build as module. --- .gitignore | 3 ++- jest.config.js | 4 ++++ package.json | 6 ++++-- src/index.test.ts | 5 ----- src/index.ts | 7 ++++--- tsconfig.json | 4 +++- 6 files changed, 17 insertions(+), 12 deletions(-) delete mode 100644 src/index.test.ts diff --git a/.gitignore b/.gitignore index 25fbf5a..ef229ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ -node_modules/ coverage/ +dist/ +node_modules/ diff --git a/jest.config.js b/jest.config.js index 0384c17..2d41c1a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -3,4 +3,8 @@ module.exports = { testEnvironment: 'node', collectCoverage: true, collectCoverageFrom: ['src/**/*.ts'], + testPathIgnorePatterns: [ + '/node_modules/', + '/dist/' + ] }; diff --git a/package.json b/package.json index c25db78..faad98f 100644 --- a/package.json +++ b/package.json @@ -2,12 +2,14 @@ "name": "ustaxlib", "version": "0.1.0", "description": "A library for modeling individual US tax returns.", - "main": "src/index.js", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { "dev": "jest --watch", "test": "jest", "check": "tsc --noEmit", - "debug": "node --inspect-brk --stack-trace-limit=1000 node_modules/.bin/jest --coverage=false" + "debug": "node --inspect-brk --stack-trace-limit=1000 node_modules/.bin/jest --coverage=false", + "prepublish": "tsc" }, "author": "Robert Sesek", "license": "ISC", diff --git a/src/index.test.ts b/src/index.test.ts deleted file mode 100644 index f89b6bd..0000000 --- a/src/index.test.ts +++ /dev/null @@ -1,5 +0,0 @@ -import helloWorld from './index'; - -test('hello world', () => { - expect(helloWorld()).toBe('Hello World'); -}); diff --git a/src/index.ts b/src/index.ts index f5a5223..5f6298c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ -export default function helloWorld(): string { - return 'Hello World'; -} +import Person from './Person'; +import TaxReturn from './TaxReturn'; + +export { Person, TaxReturn }; diff --git a/tsconfig.json b/tsconfig.json index 7a77bf5..c1ffe4b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -5,6 +5,8 @@ ], "target": "es2019", "moduleResolution": "node", - "esModuleInterop": true + "esModuleInterop": true, + "declaration": true, + "outDir": "dist/" } } -- 2.43.5