Skip to content

Replace gobuffalo/meta dependency with minimal internal/meta package#2425

Merged
paganotoni merged 5 commits intomainfrom
replace-meta-with-internal
Mar 20, 2026
Merged

Replace gobuffalo/meta dependency with minimal internal/meta package#2425
paganotoni merged 5 commits intomainfrom
replace-meta-with-internal

Conversation

@paganotoni
Copy link
Member

This change removes the external gobuffalo/meta dependency and replaces it
with a minimal internal implementation. The internal package contains only
the functionality Buffalo actually uses:

  • App.Root - project root directory
  • App.WithPop - detects database.yml presence
  • BuildTags - type alias for plugin build tags

Benefits:

  • Removes transitive dependency on gobuffalo/envy
  • Smaller dependency tree (meta -> envy -> flect + go-internal)
  • ~38 lines of internal code vs 400+ lines of external dependencies
  • Same API, zero external dependencies

This change removes the external gobuffalo/meta dependency and replaces it
with a minimal internal implementation. The internal package contains only
the functionality Buffalo actually uses:

- App.Root - project root directory
- App.WithPop - detects database.yml presence
- BuildTags - type alias for plugin build tags

Benefits:
- Removes transitive dependency on gobuffalo/envy
- Smaller dependency tree (meta -> envy -> flect + go-internal)
- ~38 lines of internal code vs 400+ lines of external dependencies
- Same API, zero external dependencies
@paganotoni paganotoni requested a review from a team as a code owner March 20, 2026 22:42
The internal/meta package now fully replicates the behavior of the
original gobuffalo/meta package:

- First attempts to load metadata from config/buffalo-app.toml
- Falls back to auto-detection if the file doesn't exist
- Auto-detection checks for database.yml to set WithPop
- App struct now includes all fields from the original: Name, Bin,
  VCS, WithPop, WithSQLite, WithWebpack, WithNodeJs, WithYarn,
  WithDocker, WithGrifts, AsWeb, AsAPI
Reduced App struct from 12 fields to only the 2 fields actually used:
- Root: for locating config files and plugins folder
- WithPop: for auto-adding buffalo-pop plugin

The TOML decoder ignores extra fields in buffalo-app.toml, so parsing
still works correctly with the minimal struct. This keeps the package
focused on its single purpose: supporting the plugin system.
The fileExists helper was only used once, so inline it to reduce
the package to a single exported function. The logic is clearer:
- Check for TOML config file
- If WithPop not set from TOML, check for database.yml
- Added comprehensive tests for New() function
- Added TOML struct tags for snake_case field names (with_pop)
- Fixed TOML priority logic to return early when config exists
- TOML config now takes full precedence over auto-detection
@paganotoni paganotoni merged commit e40c0ed into main Mar 20, 2026
8 checks passed
@paganotoni paganotoni deleted the replace-meta-with-internal branch March 20, 2026 23:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant