Skip to content

Conversation

@davidfirst
Copy link
Member

Summary

When component templates specify an env property, bit templates now displays them grouped under that env instead of the registering aspect.

Before:

teambit.react/react
    react (create a React UI component)
    react-hook (create a React hook component)
    ...

After:

bitdev.react/react-env
    react (create a React UI component)
    react-hook (create a React hook component)
    ...

This gives users accurate information about which env their components will actually use, rather than showing the core aspect that registers the templates as a pass-through.

When templates specify an env (e.g., `bitdev.react/react-env`), display
them grouped under that env instead of the registering aspect. This
gives users accurate information about which env their components will use.
Copilot AI review requested due to automatic review settings January 12, 2026 17:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request fixes the bit templates command output to display component templates grouped under their actual environment (env) instead of the registering aspect. When a component template specifies an env property, the output now shows that env ID, providing users with more accurate information about which environment their components will use.

Changes:

  • Modified the getTemplateDescriptor method to use the template's env property as the aspectId when available
  • Added explanatory comments describing the purpose of the change

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Display templates with friendly names (e.g., "React" instead of
"teambit.react/react") and show the actual env(s) that will be used
(e.g., "env: bitdev.react/react-env").

When a group has templates targeting multiple envs, all envs are shown.
Copilot AI review requested due to automatic review settings January 12, 2026 20:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- improve env property documentation with expected format
- fix grammar: 'components templates' → 'component templates'
- improve getFriendlyName to handle kebab-case aspect names
@davidfirst
Copy link
Member Author

Addressing Copilot review comments:

  1. env property documentation - Fixed: added expected format to the documentation.

  2. Grammar: 'components templates' - Fixed: changed to 'component templates'.

  3. getFriendlyName kebab-case - Fixed: added kebab-case handling that capitalizes each word (e.g., 'react-env' → 'React Env').

  4. Inconsistency with PR description - This is intentional. The approach was changed after discussion - we keep the original grouping by aspectId but show a friendly name (e.g., 'React' instead of 'teambit.react/react') and display the actual env(s) as a suffix annotation. This provides the information users need without fragmenting templates into too many groups.

  5. Old comments about displayId/cast - These are outdated as we changed the approach. We no longer use displayId - we keep original grouping and pass env as a separate field.

Copilot AI review requested due to automatic review settings January 12, 2026 21:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@davidfirst
Copy link
Member Author

Addressing latest Copilot review comments:

  1. Cast without type guard - Accessing a non-existent property returns undefined, which is the expected fallback behavior. The cast is intentional to access the env property when available.

  2. Misleading env display - The current implementation is straightforward: show all envs used by templates in a group. Adding complexity to detect env-registered groups isn't necessary for this use case.

  3. Empty aspectId edge case - In practice, aspectIds are never empty as they come from registered aspects. Adding defensive checks for impossible cases would add unnecessary code.

  4. Hyphenated command names - Restored original description/extendedDescription - this PR only changes the output display logic, not the command descriptions.

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.

2 participants