From c493ad2dabd2e8db837d6f48405ad5f4b2dd8f50 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Mon, 9 Mar 2020 17:55:46 -0400 Subject: [PATCH] Restructuring in prep for being a usable package. Moves file modules out of src/*.ts and into src/core, which is now peer to src/fed2019. This also adds index.ts re-exports for the modules. --- jest.config.js | 5 ++++- package.json | 2 -- src/{ => core}/Errors.ts | 0 src/{ => core}/Form.test.ts | 0 src/{ => core}/Form.ts | 0 src/{ => core}/Line.test.ts | 0 src/{ => core}/Line.ts | 0 src/{ => core}/Math.test.ts | 0 src/{ => core}/Math.ts | 0 src/{ => core}/Person.test.ts | 0 src/{ => core}/Person.ts | 0 src/{ => core}/TaxReturn.test.ts | 0 src/{ => core}/TaxReturn.ts | 0 src/core/index.ts | 4 ++++ src/fed2019/Form1040.test.ts | 6 +++--- src/fed2019/Form1040.ts | 10 +++++----- src/fed2019/Form1099B.ts | 8 ++++---- src/fed2019/Form1099DIV.ts | 6 +++--- src/fed2019/Form1099INT.ts | 6 +++--- src/fed2019/Form1099R.ts | 8 ++++---- src/fed2019/Form1116.test.ts | 6 +++--- src/fed2019/Form1116.ts | 12 ++++++------ src/fed2019/Form8606.test.ts | 4 ++-- src/fed2019/Form8606.ts | 10 +++++----- src/fed2019/Form8949.test.ts | 4 ++-- src/fed2019/Form8949.ts | 8 ++++---- src/fed2019/Form8959.test.ts | 4 ++-- src/fed2019/Form8959.ts | 8 ++++---- src/fed2019/Form8960.test.ts | 4 ++-- src/fed2019/Form8960.ts | 8 ++++---- src/fed2019/FormW2.test.ts | 4 ++-- src/fed2019/FormW2.ts | 6 +++--- src/fed2019/Schedule1.test.ts | 6 +++--- src/fed2019/Schedule1.ts | 10 +++++----- src/fed2019/Schedule2.ts | 8 ++++---- src/fed2019/Schedule3.test.ts | 6 +++--- src/fed2019/Schedule3.ts | 8 ++++---- src/fed2019/ScheduleD.ts | 12 ++++++------ src/fed2019/index.ts | 22 ++++++++++++++++++++++ src/index.ts | 6 ++---- 40 files changed, 118 insertions(+), 93 deletions(-) rename src/{ => core}/Errors.ts (100%) rename src/{ => core}/Form.test.ts (100%) rename src/{ => core}/Form.ts (100%) rename src/{ => core}/Line.test.ts (100%) rename src/{ => core}/Line.ts (100%) rename src/{ => core}/Math.test.ts (100%) rename src/{ => core}/Math.ts (100%) rename src/{ => core}/Person.test.ts (100%) rename src/{ => core}/Person.ts (100%) rename src/{ => core}/TaxReturn.test.ts (100%) rename src/{ => core}/TaxReturn.ts (100%) create mode 100644 src/core/index.ts create mode 100644 src/fed2019/index.ts diff --git a/jest.config.js b/jest.config.js index 2d41c1a..c131434 100644 --- a/jest.config.js +++ b/jest.config.js @@ -2,7 +2,10 @@ module.exports = { preset: 'ts-jest', testEnvironment: 'node', collectCoverage: true, - collectCoverageFrom: ['src/**/*.ts'], + collectCoverageFrom: [ + '**/*.ts', + '!dist/**/*' + ], testPathIgnorePatterns: [ '/node_modules/', '/dist/' diff --git a/package.json b/package.json index faad98f..a503be2 100644 --- a/package.json +++ b/package.json @@ -2,8 +2,6 @@ "name": "ustaxlib", "version": "0.1.0", "description": "A library for modeling individual US tax returns.", - "main": "dist/index.js", - "types": "dist/index.d.ts", "scripts": { "dev": "jest --watch", "test": "jest", diff --git a/src/Errors.ts b/src/core/Errors.ts similarity index 100% rename from src/Errors.ts rename to src/core/Errors.ts diff --git a/src/Form.test.ts b/src/core/Form.test.ts similarity index 100% rename from src/Form.test.ts rename to src/core/Form.test.ts diff --git a/src/Form.ts b/src/core/Form.ts similarity index 100% rename from src/Form.ts rename to src/core/Form.ts diff --git a/src/Line.test.ts b/src/core/Line.test.ts similarity index 100% rename from src/Line.test.ts rename to src/core/Line.test.ts diff --git a/src/Line.ts b/src/core/Line.ts similarity index 100% rename from src/Line.ts rename to src/core/Line.ts diff --git a/src/Math.test.ts b/src/core/Math.test.ts similarity index 100% rename from src/Math.test.ts rename to src/core/Math.test.ts diff --git a/src/Math.ts b/src/core/Math.ts similarity index 100% rename from src/Math.ts rename to src/core/Math.ts diff --git a/src/Person.test.ts b/src/core/Person.test.ts similarity index 100% rename from src/Person.test.ts rename to src/core/Person.test.ts diff --git a/src/Person.ts b/src/core/Person.ts similarity index 100% rename from src/Person.ts rename to src/core/Person.ts diff --git a/src/TaxReturn.test.ts b/src/core/TaxReturn.test.ts similarity index 100% rename from src/TaxReturn.test.ts rename to src/core/TaxReturn.test.ts diff --git a/src/TaxReturn.ts b/src/core/TaxReturn.ts similarity index 100% rename from src/TaxReturn.ts rename to src/core/TaxReturn.ts diff --git a/src/core/index.ts b/src/core/index.ts new file mode 100644 index 0000000..510da88 --- /dev/null +++ b/src/core/index.ts @@ -0,0 +1,4 @@ +export { Line } from './Line'; +export { default as Form } from './Form'; +export { default as Person } from './Person'; +export { default as TaxReturn } from './TaxReturn'; diff --git a/src/fed2019/Form1040.test.ts b/src/fed2019/Form1040.test.ts index 6549ac6..6653c46 100644 --- a/src/fed2019/Form1040.test.ts +++ b/src/fed2019/Form1040.test.ts @@ -1,6 +1,6 @@ -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; -import { NotFoundError } from '../Errors'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; +import { NotFoundError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Form1099DIV from './Form1099DIV'; diff --git a/src/fed2019/Form1040.ts b/src/fed2019/Form1040.ts index 13de9cd..a6f865b 100644 --- a/src/fed2019/Form1040.ts +++ b/src/fed2019/Form1040.ts @@ -1,8 +1,8 @@ -import Form, { FormClass } from '../Form'; -import TaxReturn from '../TaxReturn'; -import { Line, AccumulatorLine, ComputedLine, ReferenceLine, sumLineOfForms } from '../Line'; -import { UnsupportedFeatureError } from '../Errors'; -import { reduceBySum } from '../Math'; +import Form, { FormClass } from '../core/Form'; +import { TaxReturn } from '../core'; +import { Line, AccumulatorLine, ComputedLine, ReferenceLine, sumLineOfForms } from '../core/Line'; +import { UnsupportedFeatureError } from '../core/Errors'; +import { reduceBySum } from '../core/Math'; import Form8606 from './Form8606'; import Form8959 from './Form8959'; diff --git a/src/fed2019/Form1099B.ts b/src/fed2019/Form1099B.ts index 7eb1af8..ba3d2eb 100644 --- a/src/fed2019/Form1099B.ts +++ b/src/fed2019/Form1099B.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; -import { InputLine } from '../Line'; +import { Form } from '../core'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; +import { InputLine } from '../core/Line'; export enum GainType { ShortTerm = 'ST', diff --git a/src/fed2019/Form1099DIV.ts b/src/fed2019/Form1099DIV.ts index 4f575df..53ee8cd 100644 --- a/src/fed2019/Form1099DIV.ts +++ b/src/fed2019/Form1099DIV.ts @@ -1,6 +1,6 @@ -import Form from '../Form'; -import { InputLine } from '../Line'; -import Person from '../Person'; +import { Form } from '../core'; +import { InputLine } from '../core/Line'; +import { Person } from '../core'; export interface Form1099DIVInput { payer: string; diff --git a/src/fed2019/Form1099INT.ts b/src/fed2019/Form1099INT.ts index 5721cda..1e93e56 100644 --- a/src/fed2019/Form1099INT.ts +++ b/src/fed2019/Form1099INT.ts @@ -1,6 +1,6 @@ -import Form from '../Form'; -import { InputLine } from '../Line'; -import Person from '../Person'; +import { Form } from '../core'; +import { InputLine } from '../core/Line'; +import { Person } from '../core'; export interface Form1099INTInput { payer: string; diff --git a/src/fed2019/Form1099R.ts b/src/fed2019/Form1099R.ts index 631a7df..cfe2f37 100644 --- a/src/fed2019/Form1099R.ts +++ b/src/fed2019/Form1099R.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; -import { InputLine } from '../Line'; +import { Form } from '../core'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; +import { InputLine } from '../core/Line'; export enum Box7Code { _1 = '1', // Early distribution, no known exception diff --git a/src/fed2019/Form1116.test.ts b/src/fed2019/Form1116.test.ts index 99ada28..6a4d705 100644 --- a/src/fed2019/Form1116.test.ts +++ b/src/fed2019/Form1116.test.ts @@ -1,6 +1,6 @@ -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; -import { UnsupportedFeatureError } from '../Errors'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; +import { UnsupportedFeatureError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Form1116, { ForeignIncomeCategory } from './Form1116'; diff --git a/src/fed2019/Form1116.ts b/src/fed2019/Form1116.ts index 5d82466..e9c0aae 100644 --- a/src/fed2019/Form1116.ts +++ b/src/fed2019/Form1116.ts @@ -1,9 +1,9 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; -import { ComputedLine, InputLine, ReferenceLine } from '../Line'; -import { UnsupportedFeatureError } from '../Errors'; -import { reduceBySum } from '../Math'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; +import { ComputedLine, InputLine, ReferenceLine } from '../core/Line'; +import { UnsupportedFeatureError } from '../core/Errors'; +import { reduceBySum } from '../core/Math'; import Form1040 from './Form1040'; import Form8949 from './Form8949'; diff --git a/src/fed2019/Form8606.test.ts b/src/fed2019/Form8606.test.ts index 90047a1..2e276d4 100644 --- a/src/fed2019/Form8606.test.ts +++ b/src/fed2019/Form8606.test.ts @@ -1,5 +1,5 @@ -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; import Form1040, { FilingStatus } from './Form1040'; import Form8606 from './Form8606'; diff --git a/src/fed2019/Form8606.ts b/src/fed2019/Form8606.ts index 6149084..95fde54 100644 --- a/src/fed2019/Form8606.ts +++ b/src/fed2019/Form8606.ts @@ -1,8 +1,8 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; -import { Line, AccumulatorLine, ComputedLine, InputLine, ReferenceLine } from '../Line'; -import { clampToZero } from '../Math'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; +import { Line, AccumulatorLine, ComputedLine, InputLine, ReferenceLine } from '../core/Line'; +import { clampToZero } from '../core/Math'; export interface Form8606Input { person: Person; diff --git a/src/fed2019/Form8949.test.ts b/src/fed2019/Form8949.test.ts index d966e33..ffc82b7 100644 --- a/src/fed2019/Form8949.test.ts +++ b/src/fed2019/Form8949.test.ts @@ -1,5 +1,5 @@ -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; import Form1040, { FilingStatus } from './Form1040'; import Form1099B, { GainType } from './Form1099B'; diff --git a/src/fed2019/Form8949.ts b/src/fed2019/Form8949.ts index 944061f..1c581c3 100644 --- a/src/fed2019/Form8949.ts +++ b/src/fed2019/Form8949.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; -import { Line, InputLine, ComputedLine, sumLineOfForms } from '../Line'; +import { Form } from '../core'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; +import { Line, InputLine, ComputedLine, sumLineOfForms } from '../core/Line'; import Form1099B, { GainType } from './Form1099B'; diff --git a/src/fed2019/Form8959.test.ts b/src/fed2019/Form8959.test.ts index ed55f94..a17117e 100644 --- a/src/fed2019/Form8959.test.ts +++ b/src/fed2019/Form8959.test.ts @@ -1,5 +1,5 @@ -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; import FormW2 from './FormW2'; import Form8959 from './Form8959'; diff --git a/src/fed2019/Form8959.ts b/src/fed2019/Form8959.ts index 2c3e768..b4e3889 100644 --- a/src/fed2019/Form8959.ts +++ b/src/fed2019/Form8959.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import { Line, AccumulatorLine, ComputedLine, ReferenceLine } from '../Line'; -import { clampToZero } from '../Math'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { Line, AccumulatorLine, ComputedLine, ReferenceLine } from '../core/Line'; +import { clampToZero } from '../core/Math'; import Form1040, { FilingStatus } from './Form1040'; import FormW2 from './FormW2'; diff --git a/src/fed2019/Form8960.test.ts b/src/fed2019/Form8960.test.ts index d77ceba..3eebf66 100644 --- a/src/fed2019/Form8960.test.ts +++ b/src/fed2019/Form8960.test.ts @@ -1,5 +1,5 @@ -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; import FormW2 from './FormW2'; import Form1040, { FilingStatus } from './Form1040'; diff --git a/src/fed2019/Form8960.ts b/src/fed2019/Form8960.ts index 9d73220..6bd1e0c 100644 --- a/src/fed2019/Form8960.ts +++ b/src/fed2019/Form8960.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import { ComputedLine, ReferenceLine } from '../Line'; -import { clampToZero } from '../Math'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { ComputedLine, ReferenceLine } from '../core/Line'; +import { clampToZero } from '../core/Math'; import Form1040, { FilingStatus } from './Form1040'; import Schedule1 from './Schedule1'; diff --git a/src/fed2019/FormW2.test.ts b/src/fed2019/FormW2.test.ts index 5b02b26..5b260d2 100644 --- a/src/fed2019/FormW2.test.ts +++ b/src/fed2019/FormW2.test.ts @@ -1,6 +1,6 @@ import W2 from './FormW2'; -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; test('input', () => { const p = Person.self('Bob'); diff --git a/src/fed2019/FormW2.ts b/src/fed2019/FormW2.ts index b9558e4..a554c5b 100644 --- a/src/fed2019/FormW2.ts +++ b/src/fed2019/FormW2.ts @@ -1,6 +1,6 @@ -import Form from '../Form'; -import { Line, InputLine } from '../Line'; -import Person from '../Person'; +import { Form } from '../core'; +import { Line, InputLine } from '../core/Line'; +import { Person } from '../core'; export enum Box13 { StatutoryEmployee, diff --git a/src/fed2019/Schedule1.test.ts b/src/fed2019/Schedule1.test.ts index 117ef92..88fd60b 100644 --- a/src/fed2019/Schedule1.test.ts +++ b/src/fed2019/Schedule1.test.ts @@ -1,6 +1,6 @@ -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; -import { UnsupportedFeatureError } from '../Errors'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; +import { UnsupportedFeatureError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Schedule1, { Schedule1Input } from './Schedule1'; diff --git a/src/fed2019/Schedule1.ts b/src/fed2019/Schedule1.ts index 4d0bb0e..7bd817e 100644 --- a/src/fed2019/Schedule1.ts +++ b/src/fed2019/Schedule1.ts @@ -1,8 +1,8 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import { ComputedLine, InputLine } from '../Line'; -import { NotFoundError, UnsupportedFeatureError } from '../Errors'; -import { undefinedToZero } from '../Math'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { ComputedLine, InputLine } from '../core/Line'; +import { NotFoundError, UnsupportedFeatureError } from '../core/Errors'; +import { undefinedToZero } from '../core/Math'; import Form1040 from './Form1040'; diff --git a/src/fed2019/Schedule2.ts b/src/fed2019/Schedule2.ts index 58863b4..ec0103c 100644 --- a/src/fed2019/Schedule2.ts +++ b/src/fed2019/Schedule2.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import { ComputedLine } from '../Line'; -import { UnsupportedFeatureError } from '../Errors'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { ComputedLine } from '../core/Line'; +import { UnsupportedFeatureError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Form1099DIV from './Form1099DIV'; diff --git a/src/fed2019/Schedule3.test.ts b/src/fed2019/Schedule3.test.ts index a22507c..25b2ecd 100644 --- a/src/fed2019/Schedule3.test.ts +++ b/src/fed2019/Schedule3.test.ts @@ -1,6 +1,6 @@ -import TaxReturn from '../TaxReturn'; -import Person from '../Person'; -import { NotFoundError } from '../Errors'; +import { TaxReturn } from '../core'; +import { Person } from '../core'; +import { NotFoundError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Form1099DIV from './Form1099DIV'; diff --git a/src/fed2019/Schedule3.ts b/src/fed2019/Schedule3.ts index c9fed01..1e36975 100644 --- a/src/fed2019/Schedule3.ts +++ b/src/fed2019/Schedule3.ts @@ -1,7 +1,7 @@ -import Form from '../Form'; -import TaxReturn from '../TaxReturn'; -import { AccumulatorLine, ComputedLine, InputLine, ReferenceLine } from '../Line'; -import { NotFoundError, UnsupportedFeatureError } from '../Errors'; +import { Form } from '../core'; +import { TaxReturn } from '../core'; +import { AccumulatorLine, ComputedLine, InputLine, ReferenceLine } from '../core/Line'; +import { NotFoundError, UnsupportedFeatureError } from '../core/Errors'; import Form1040, { FilingStatus } from './Form1040'; import Form1099DIV from './Form1099DIV'; diff --git a/src/fed2019/ScheduleD.ts b/src/fed2019/ScheduleD.ts index f36e47f..748ce5a 100644 --- a/src/fed2019/ScheduleD.ts +++ b/src/fed2019/ScheduleD.ts @@ -1,9 +1,9 @@ -import Form from '../Form'; -import Person from '../Person'; -import TaxReturn from '../TaxReturn'; -import { Line, AccumulatorLine, ComputedLine, ReferenceLine, sumLineOfForms } from '../Line'; -import { clampToZero } from '../Math'; -import { UnsupportedFeatureError } from '../Errors'; +import { Form } from '../core'; +import { Person } from '../core'; +import { TaxReturn } from '../core'; +import { Line, AccumulatorLine, ComputedLine, ReferenceLine, sumLineOfForms } from '../core/Line'; +import { clampToZero } from '../core/Math'; +import { UnsupportedFeatureError } from '../core/Errors'; import Form8949, { Form8949Box } from './Form8949'; import Form1099DIV from './Form1099DIV'; diff --git a/src/fed2019/index.ts b/src/fed2019/index.ts new file mode 100644 index 0000000..e972492 --- /dev/null +++ b/src/fed2019/index.ts @@ -0,0 +1,22 @@ +export { default as Form1040 } from './Form1040'; +export { default as Form1099B } from './Form1099B'; +export { default as Form1099DIV } from './Form1099DIV'; +export { default as Form1099INT } from './Form1099INT'; +export { default as Form1099R } from './Form1099R'; +export { default as Form1116 } from './Form1116'; +export { default as Form8606 } from './Form8606'; +export { default as Form8949 } from './Form8949'; +export { default as Form8959 } from './Form8959'; +export { default as Form8960 } from './Form8960'; +export { default as Schedule1 } from './Schedule1'; +export { default as Schedule2 } from './Schedule2'; +export { default as Schedule3 } from './Schedule3'; +export { default as ScheduleD } from './ScheduleD'; +export { default as W2 } from './FormW2'; + +export * from './Form1040'; +export * from './Form1099B'; +export * from './Form1099R'; +export * from './Form1116'; +export * from './Form8949'; +export * from './FormW2'; diff --git a/src/index.ts b/src/index.ts index 5f6298c..21f09e2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,4 +1,2 @@ -import Person from './Person'; -import TaxReturn from './TaxReturn'; - -export { Person, TaxReturn }; +import './core'; +import './fed2019'; -- 2.22.5