Skip to content

Instantly share code, notes, and snippets.

@danwbyrne
Created October 10, 2019 19:38
Show Gist options
  • Save danwbyrne/397c58e44119a7897bc92ffc7cdb7fed to your computer and use it in GitHub Desktop.
Save danwbyrne/397c58e44119a7897bc92ffc7cdb7fed to your computer and use it in GitHub Desktop.
Rush Migration Thoughts

Repo Structure

Instead of building the package directory into a dist directory we now build every packages/*/src folder into a packages/*/lib folder.

This has some major benefits, mainly in that we can point main in packages/*/package.json to lib/index.js, then down-stream packages importing an upstream package will get the built version.

To help mimic our previous setup I've added a tsconfig.dev.json to @neo-one/build-tools which adds a path mapping for neo-one/* to ../neo-one-* which ideally is only used FOR THE EDITOR.

Build tools

...

Tsconfigs

I think we have too many tsconfigs and its a bit overwhelming. Trying to trace why a tsc issue happened only to be stuck following a tree of 6 tsconfig.jsons can be quite frustrating. I think there is a more elegant solution to compiling different formats and mapping paths appropriately for our editor + the 3+ other custom configs we have for editor/website/tools etc.

CI Workflow

Because of the changes to importing built files vs importing source files for linting/tsc we run into a few caveats in how our CI flow can operate:

  1. we can't lint before building unless we opt to add a path compiler flag but this takes longer since we would lint all of a packages source code AND the source code of @neo-one packages it depends on.
  2. We can't run tsc --noEmit across the project before building because it won't find the built dependencies.
  3. Unit tests and E2E tests can essentially be run at the same time since both require upstream dependencies to already be built. I think ideally we enable Unit tests to still use un-built files but its not clear to me what the solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment