Move to a multi-package / monorepo structure
Motivation
Many feature requests require additional dependencies (#292, possibly #405). While tree shaking is useful to remove unused code from a dependency, the dependency package itself is, to my knowledge still processed by the package managers: e.g even if an external user does not use the inspector, their project will still pull the lil-gui
and chart.js
dependencies.
Moving to a multi-package solution would simplify the isolation of dependencies in their own, optional package.
Structure proposal
@giro3d/core
)
The core package (With this goal in mind, we should strive to identify the minimal subset of dependencies required to run a barebone Giro3D application. To my knowledge, we only need two:
three
proj
Note: this minimal version would not display any entity, such as Map
. Those entities would be in their own package.
Optional packages
Optional packages include anything that is not strictly required. This mainly includes the entities, as well as the inspector.
@giro3d/inspector
)
The inspector (This one seems obvious, but it is not. Why ? Because if entities are in their own optional packages, the inspector package will not know them and will not be able to expose any meaningful information about them. For example, if the Map
is in its own package, then the inspector package should not depend on it, and thus cannot expose any map inspector. Conversely, the Map
package should not depend on anything else than @giro3d/core
(and its own dependencies, such as ol
), thus cannot implement any inspector.
@giro3d/core
, but the actual implementation in @giro3d/inspector
.
The entities
Here again, it seems to make sense, but it is not so clear. For example, if we put the Map
in its own package, should it also include layers and sources ? No, because layers and sources might be used elsewhere (to colorize point clouds for example).