Allow ROPM modules to declare a preferredPrefix in their package.json ropm config block. When ROPM installs such a module, it should use the declared prefix instead of deriving one from the package name or scope — unless the user has explicitly provided an alias at install time.
Currently, ROPM derives a module's prefix from its package name or npm scope (e.g. @rokucommunity/promises → rokucommunity_promises). This works fine for most cases, but module authors often know a cleaner, shorter, or more idiomatic prefix that downstream consumers should use. Without a way to declare this preference, every consumer ends up with verbose, auto-derived prefixes — and namespace rewrites inside .brs files reflect those verbose names.
Desired Behavior
When a module author wants to suggest a prefix, they add a preferredPrefix field to the ropm config in their package.json:
{
"name": "@rokucommunity/promises",
"ropm": {
"preferredPrefix": "promises"
}
}
During ropm copy, ROPM should:
- Detect the
preferredPrefix field in the installed module's package.json.
- Use that value as the module's prefix instead of the auto-derived one.
- Apply the prefix consistently: folder naming under
roku_modules/, and all namespace rewrites inside copied .brs and .xml files.
- Log clearly that the preferred prefix was found and is being used.
Alias Override Rule
If the user provided an explicit alias at install time, the preferredPrefix must be ignored entirely. The user-supplied alias always takes precedence.
Example — alias wins:
npm install mypkg@npm:@rokucommunity/promises
# ropm should use "mypkg", not "promises"
Example — preferredPrefix wins (no alias):
npm install @rokucommunity/promises
# ropm should use "promises" (from preferredPrefix), not "rokucommunity_promises"
The alias detection logic should compare the local package name against the resolved package name to determine whether an alias was explicitly provided.
Logging
ROPM should emit informative output during copy so users understand why a non-default prefix is being used:
- When
preferredPrefix is found and used: indicate that the default prefix was overridden by the module's declared preference.
- When an alias is present: use the alias silently (current behavior — no change needed).
Acceptance Criteria
Allow ROPM modules to declare a
preferredPrefixin theirpackage.jsonropm config block. When ROPM installs such a module, it should use the declared prefix instead of deriving one from the package name or scope — unless the user has explicitly provided an alias at install time.Currently, ROPM derives a module's prefix from its package name or npm scope (e.g.
@rokucommunity/promises→rokucommunity_promises). This works fine for most cases, but module authors often know a cleaner, shorter, or more idiomatic prefix that downstream consumers should use. Without a way to declare this preference, every consumer ends up with verbose, auto-derived prefixes — and namespace rewrites inside.brsfiles reflect those verbose names.Desired Behavior
When a module author wants to suggest a prefix, they add a
preferredPrefixfield to theropmconfig in theirpackage.json:{ "name": "@rokucommunity/promises", "ropm": { "preferredPrefix": "promises" } }During
ropm copy, ROPM should:preferredPrefixfield in the installed module'spackage.json.roku_modules/, and all namespace rewrites inside copied.brsand.xmlfiles.Alias Override Rule
If the user provided an explicit alias at install time, the
preferredPrefixmust be ignored entirely. The user-supplied alias always takes precedence.Example — alias wins:
npm install mypkg@npm:@rokucommunity/promises # ropm should use "mypkg", not "promises"Example — preferredPrefix wins (no alias):
npm install @rokucommunity/promises # ropm should use "promises" (from preferredPrefix), not "rokucommunity_promises"The alias detection logic should compare the local package name against the resolved package name to determine whether an alias was explicitly provided.
Logging
ROPM should emit informative output during copy so users understand why a non-default prefix is being used:
preferredPrefixis found and used: indicate that the default prefix was overridden by the module's declared preference.Acceptance Criteria
preferredPrefixin a module'spackage.jsonropm config is respected duringropm copy.roku_modules/<preferredPrefix>/whenpreferredPrefixis active..brsfiles are rewritten to use the resolved prefix.preferredPrefix.preferredPrefixis absent, existing default/scoped prefix behavior is unchanged.