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.
...
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.json
s 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.
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:
- 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. - We can't run
tsc --noEmit
across the project before building because it won't find the built dependencies. - 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.