vendredi 5 mai 2017

Up-to-date recommendations for structuring a complex multi-app modular typescript codebase?

We know there are a lot of previous similar questions on SO, but Typescript's module systems and stuff have evolved a lot over time, and most of the answers are variously out-of-date. This question pertains to modern (currently 2.3) Typescript.

We're coming from a .NET background and by FAR the hardest part of working out Typescript so far has been navigating the world of modules and dependencies and build-tools.

We have a very modular codebase planned out. We have:

  • Dependencies on NPM modules in every part, some common across multiple parts
  • A library containing common data-model code
  • A library containing common React components that depends on the data-model
  • A Chrome Extension app that depends on the common libraries
  • A desktop site app that depends on the common libraries
  • A mobile site app that depends on the common libraries
  • Tests for each of the above

Each of these parts should be built using Typescript, and be a separately isolated and versioned project.

Ideally, each app should be able to depend on a specific version of the common libraries, and smoothly handle these dependencies during local development.

We're leaning towards a Webpack solution but it's really hard to evaluate without practical experience, Gulp is also an option, as is mixing the two.

Where possible (perhaps this is an inappropriate .NET hangover) we want to control and minimise the public interface of each of these parts, while still using multiple (many) files in each, with project-internal imports using the Typescript export/import features.

We're currently developing with Webstorm, but also have access to VS.

What's the modern (May 2017, TS 2.3) recommended way to structure and build all of this?

Which Typescript module system should be used in each of these projects?




Aucun commentaire:

Enregistrer un commentaire