From 3ec0234c29841f865372431126b72cb41bb5c2d6 Mon Sep 17 00:00:00 2001 From: David First Date: Mon, 13 May 2024 12:28:29 -0400 Subject: [PATCH] fix(status), do not show the DeprecatedDependencies issue when undeprecated locally --- e2e/harmony/deprecate.e2e.1.ts | 8 ++++++++ .../component/deprecation/deprecation.main.runtime.ts | 3 +++ src/consumer/bit-map/component-map.ts | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/e2e/harmony/deprecate.e2e.1.ts b/e2e/harmony/deprecate.e2e.1.ts index 9465b1d7b8e..1c30bcf658a 100644 --- a/e2e/harmony/deprecate.e2e.1.ts +++ b/e2e/harmony/deprecate.e2e.1.ts @@ -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); + }); + }); }); }); diff --git a/scopes/component/deprecation/deprecation.main.runtime.ts b/scopes/component/deprecation/deprecation.main.runtime.ts index 74e38bc8f5b..0031f7c1582 100644 --- a/scopes/component/deprecation/deprecation.main.runtime.ts +++ b/scopes/component/deprecation/deprecation.main.runtime.ts @@ -129,6 +129,9 @@ export class DeprecationMain { */ private async isDeprecatedByIdWithoutLoadingComponent(componentId: ComponentID): Promise { 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( diff --git a/src/consumer/bit-map/component-map.ts b/src/consumer/bit-map/component-map.ts index 0e41e3e672f..aaa532d3af9 100644 --- a/src/consumer/bit-map/component-map.ts +++ b/src/consumer/bit-map/component-map.ts @@ -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);