Skip to content

fix(generator): show actual env in bit templates output#10152

Merged
davidfirst merged 10 commits intomasterfrom
fix/templates-show-actual-env
Jan 13, 2026
Merged

fix(generator): show actual env in bit templates output#10152
davidfirst merged 10 commits intomasterfrom
fix/templates-show-actual-env

Conversation

@davidfirst
Copy link
Copy Markdown
Member

@davidfirst davidfirst commented Jan 12, 2026

Summary

Improves bit templates output to show friendly names for teambit aspects and display the actual env that components will use.

Before:

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

After:

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

Changes

  • Added env field to TemplateDescriptor type to pass through the template's env property
  • Show friendly names for teambit aspects (e.g., "teambit.react/react" → "React")
  • Non-teambit aspects display their full aspectId unchanged
  • Show the actual env(s) used by templates in each group as a suffix
  • When a group has templates using multiple envs, all are listed

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Copilot AI review requested due to automatic review settings January 13, 2026 14:55
Copy link
Copy Markdown
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 2 comments.


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

@davidfirst davidfirst merged commit 351b7b3 into master Jan 13, 2026
18 checks passed
@davidfirst davidfirst deleted the fix/templates-show-actual-env branch January 13, 2026 21:09
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.

3 participants