refactor: use builder in build#18432
Conversation
|
@patak-dev @bluwy What do you think about this one? |
| if (selectedEnvironmentName && selectedEnvironmentName !== environmentName) | ||
| continue |
There was a problem hiding this comment.
Maybe this would be more clear with a condition out of the for loop:
function setupEnvironment(environmentName, environmentConfig) {
const environment = await environmentConfig.build.createEnvironment(
environmentName,
environmentConfig,
)
await environment.init()
environments[environmentName] = environment
}
if (selectedEnvironmentName) {
setupEnvironment(selectedEnvironmentName, config)
}
else {
// ... current for loop using setupEnvironment(environmentName, environmentConfig)
}|
This approach looks good to me! Thanks Sapphi for exploring this option. I was thinking we could move some props later on from |
|
I like this approach too, so IIUC the programmatic API to reflect Once |
Yes.
I think yes. |
patak-cat
left a comment
There was a problem hiding this comment.
Thanks again Sapphi! I prefer this option to just removing entireApp. Just a note again that if we go with this one, we are already deciding that at one point we would like to remove build() and being able to "build a part of an app". Or we can still change our mind and accept a small breaking change for people that used builder: {} if we need to introduce entireApp. I'm fine with this.
Description
Alternative to #18028
builder.entireAppand usebuilder: {}/builder: undefined(this one can be discussed separately if needed)buildand use that from the CLIThis makes the
createBuildera bit complicated but the overall code size is smaller and improves CLI-JS API symmetry.Migration Plans
This PR does not change any behavior. Later on we make
builder: { sharedConfigBuild: true }to be the default and remove the codes related to the legacy builder.--appor settingbuilder: {}in the config--appbut that change is not necessary (we should just ignore the flag)buildcommandcreateBuildercreateBuilderfrombuild