Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(status), do not show the DeprecatedDependencies issue when undeprecated locally #8882

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions e2e/harmony/deprecate.e2e.1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,5 +211,13 @@ describe('bit deprecate and undeprecate commands', function () {
it('bit status should show the DeprecatedDependencies component-issue', () => {
helper.command.expectStatusToHaveIssue(IssuesClasses.DeprecatedDependencies.name);
});
describe('un-deprecating it', () => {
before(() => {
helper.command.undeprecateComponent('comp2');
});
it('bit status should not show the DeprecatedDependencies component-issue anymore', () => {
helper.command.expectStatusToNotHaveIssue(IssuesClasses.DeprecatedDependencies.name);
});
});
});
});
3 changes: 3 additions & 0 deletions scopes/component/deprecation/deprecation.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ export class DeprecationMain {
*/
private async isDeprecatedByIdWithoutLoadingComponent(componentId: ComponentID): Promise<boolean> {
if (!componentId.hasVersion()) return false;
const bitmapEntry = this.workspace.bitMap.getBitmapEntryIfExist(componentId);
if (bitmapEntry && bitmapEntry.isDeprecated()) return true;
if (bitmapEntry && bitmapEntry.isUndeprecated()) return false;
const modelComp = await this.workspace.scope.getBitObjectModelComponent(componentId);
if (!modelComp) return false;
const isDeprecated = await modelComp.isDeprecated(
Expand Down
10 changes: 10 additions & 0 deletions src/consumer/bit-map/component-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,16 @@ export default class ComponentMap {
if (!removeAspectConf) return false;
return removeAspectConf !== '-' && removeAspectConf.removed === false;
}
isDeprecated() {
const deprecationConf = this.config?.[Extensions.deprecation];
if (!deprecationConf) return false;
return deprecationConf !== '-' && deprecationConf.deprecate;
}
isUndeprecated() {
const deprecationConf = this.config?.[Extensions.deprecation];
if (!deprecationConf) return false;
return deprecationConf !== '-' && deprecationConf.deprecate === false;
}

sort() {
this.files = R.sortBy(R.prop('relativePath'), this.files);
Expand Down