Making angular configuration easier to maintain #283
bgotink
started this conversation in
Show & Tell
Replies: 1 comment 1 reply
-
This is so cool! Have you published your Angular CLI fork anywhere? Thanks so much for sharing! |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The company I work at uses angular extensively. Angular projects are configured in a JSON file, which can become quite unwieldy for monorepositories. One of our repos contains > 100 projects, and while we have tried to limit the configuration per project by replacing many of the tools Angular provides with our own variants that require less config, we still end up with 4,000 lines of JSON configuration.
We've been experimenting for a while with how to make this file more maintainable, and KDL is allowing us to finally make some progress. An alternative implementation of the
@angular/cli
package can consume KDL configuration directly, but it also supports syncing configuration from KDL to JSON and back so we can continue using Angular unmodified.Example KDL file:
in JSON:
One of the big improvements that KDL gives us is the type/tag, which allows us to convey metadata as well as regular data. Angular expects all paths to be passed relative to the configuration file, so suppose we have two packages
"actions"
and"assets"
we have to configureBy introducing a
(project-relative)
tag we can align these configurations:And that quickly lead to adding support for inheritance
Using KDL we are able to improve the configurations in ways that simply were not possible with JSON:
We gain these improvements without losing any functionality, including the ability of the Angular CLI to modify the configuration programmatically via so-called "schematics".
Beta Was this translation helpful? Give feedback.
All reactions