Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(templates): introduce alternative folders #3897

Merged
merged 3 commits into from
Jan 20, 2024

Conversation

tbruyelle
Copy link
Contributor

@tbruyelle tbruyelle commented Jan 19, 2024

Continuing @julienrbrt's work with the minimal chain feat (#3835), this change updates a little bit the way some template can be overrided.

Initially, there was an alternate file app_config_minimal.go that existed belong to the other files, and this file had to be excluded by default.

I suggest to introduce an alternative using folders, aside the initial files. So for the minimal chain, there's now a new files-minimal folder that contains all the files that will override from the ones in files, when a minimal chain is scaffolded.

This simplify the include/exclude logic, which could become very cumbersome if we need to introduce a second alternative like for the consumer chain. This also avoid conflicts.

The rule to follow in my opinion is, when the templates contains too many <%= if IsCondition >, then you should probably introduce an alternative files-* folder. This is exactly what I'm going to do for the consumer chain (see #3660).

Continuing @julienrbrt's work with the minimal chain feat, this change
updates a little bit the way some template can be overrided.

Initially, there was an alternate file `app_config_minimal.go` that
existed belong to the other files, and this file had to be excluded by
default.

I suggest to introduce an alternative using folders, aside the initial
`files`. So for the minimal chain, there's now a new `files-minimal`
folder that contains all the files that will be overrided from the ones
in `files`, when a minimal chain is scaffolded.

This simplify the include/exclude logic, which could become very
cumbersome if we need to introduce a second alternative like for the
consumer chain. This also avoid conflicts.

The rule to follow in my opinion is, when the templates contains too
many `<%= if IsCondition >`, then you should probably introduce an
alternative `files-*` folder. This is exactly what I'm going to do for
the consumer chain (see #3660).
@julienrbrt julienrbrt changed the title refac(templates): introduce alternative folders refactor(templates): introduce alternative folders Jan 19, 2024
julienrbrt
julienrbrt previously approved these changes Jan 19, 2024
Copy link
Member

@julienrbrt julienrbrt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tACK.

@julienrbrt julienrbrt enabled auto-merge (squash) January 19, 2024 17:19
Copy link
Member

@salmad3 salmad3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice and thanks!

@julienrbrt julienrbrt merged commit ae99bf0 into main Jan 20, 2024
43 checks passed
@julienrbrt julienrbrt deleted the tbruyelle/refac/minimal-app branch January 20, 2024 23:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants