I am new in typescript. I am currently trying to create a project structure with dependencies to each other. There are three projects core
, calculator
and tax-calculator
. The project tax-calculator
needs code from the calculator
project, which needs the content from the core
project. The core
and calculator
project should be libraries and the tax-calculator
should be an web interface. The reason why i split the code is, that i need the core
and calculator
in other projects too.
core
|--src
|--MathUtils.ts
|--...
|--dist
|--MathUtils.js
calculator
|--src
|--Calculator.ts // needs MathUtils.ts
|--dist
|--Calculator.js
tax-calculator
|--src
|--TaxCalculator.ts // needs Calculator.ts
|--dist
|--TaxCalculator.js
How can i provide that the sources are available in the other projects using npm
or webpack
? I am using VisualStudio Code, i want to use autocomplition and the other features while developing like when i using the @types/chrome
or other types.
Little late to the party, but I will provide different options available as of today, December 2018:
Setting up JavaScript Monorepo.
Many big projects including Babel, Marble.js, Material, Angular use Lerna for multi-package setup.
TypeScript 3.0 now provides a support for Project references.
Git submodules can be also used, though it is not just TypeScript. It can be used for sharing any type of code. Ghost blogging platform uses this approach. I would not really recommend this approach unless you know all the issues associated with this.
Also, if you are using Yarn, you can consider workspaces, though I am not sure how well it plays with TypeScript.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With