Skip to content

Commit

Permalink
fix(status), do not show the DeprecatedDependencies issue when undepr…
Browse files Browse the repository at this point in the history
…ecated locally (#8882)
  • Loading branch information
davidfirst authored May 13, 2024
1 parent 87c3aa9 commit 8bdaf5c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
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

0 comments on commit 8bdaf5c

Please sign in to comment.