Skip to content

Commit

Permalink
fix(templates) - resolve env id set by template to add env version to…
Browse files Browse the repository at this point in the history
… generated component (#8787)
  • Loading branch information
GiladShoham committed Apr 15, 2024
1 parent f2775bf commit ca73801
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion scopes/generator/generator/component-generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,15 @@ export class ComponentGenerator {
setBy: hasEnvConfiguredOriginally ? 'workspace variants' : '<default>',
};
};
const { envId, setBy } = getEnvData();
// eslint-disable-next-line prefer-const
let { envId, setBy } = getEnvData();
if (envId) {
const isInWorkspace = this.workspace.exists(envId);
const isSameAsThisEnvId = envId === this.envId?.toString() || envId === this.envId?.toStringWithoutVersion();
if (isSameAsThisEnvId && this.envId) {
envId = isInWorkspace ? this.envId.toStringWithoutVersion() : this.envId.toString();
}
}
return {
id: componentId,
dir: componentPath,
Expand Down

0 comments on commit ca73801

Please sign in to comment.