You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[config] Refactor config to prepare for imports (#1817)
## Summary
Currently we use config fields on the Config struct directly. This makes
it really hard to track what we use to modify the file vs what we are
using as the representation of the config. This was not a problem in the
past because the config and the `devbox.json` file are one in the same.
Since we are hoping to introduce imports, we need to make it more clear
what each field/function refers to.
In this PR, I split config into 2 structs:
* `configFile` which represents a single JSON file and is not exported
directly.
* `Config` a wrapper around a `Root` `configFile` and in the future
possible imports. The root is exported so that we don't have to wrap
every `configFile` field.
Note: `Config` has a bunch of functions that will need to be
re-implemented in order to support imports.
Other changes:
* Rename `Packages` struct to `PackagesMutator` and removed all
non-mutating functions. This makes the struct more purposeful.
* Made a few structs not-exported.
* Moved some tests around.
Note: Github diff UI doesn't do a great job with file name changes in
this PR so to make this PR easier to read I named the new Config file
`config2.go` while keeping the previous `config.go`. Before merging I'll
rename `config.go file.go` and `config2.go -> config.go`.
This code change should have no functional change on devbox.
## How was it tested?
builds, tests
0 commit comments