Skip to content

Commit

Permalink
fix(sign), do not throw a ComponentNotFound when a component is in up…
Browse files Browse the repository at this point in the history
…dateDependents prop (#9158)
  • Loading branch information
davidfirst authored Aug 30, 2024
1 parent 7c15bb1 commit 99390f3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 13 deletions.
6 changes: 6 additions & 0 deletions scopes/scope/scope/scope.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,7 @@ export class ScopeMain implements ComponentFactory {
useCache = true,
reFetchUnBuiltVersion = true,
preferDependencyGraph = true,
includeUpdateDependents = false,
lane,
reason,
}: {
Expand All @@ -674,6 +675,10 @@ export class ScopeMain implements ComponentFactory {
* if an external is missing and the remote has it with the dependency graph, don't fetch all its dependencies
*/
preferDependencyGraph?: boolean;
/**
* include the updateDependents components on a lane (generally, on a workspace, it's not needed)
*/
includeUpdateDependents?: boolean;
/**
* reason why this import is needed (to show in the terminal)
*/
Expand All @@ -690,6 +695,7 @@ export class ScopeMain implements ComponentFactory {
reFetchUnBuiltVersion,
lane,
preferDependencyGraph,
includeUpdateDependents,
reason,
});
}
Expand Down
6 changes: 5 additions & 1 deletion scopes/scope/sign/sign.main.runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,11 @@ export class SignMain {
this.scope.legacyScope.setCurrentLaneId(laneId);
this.scope.legacyScope.scopeImporter.shouldOnlyFetchFromCurrentLane = true;
}
await this.scope.import(ids, { lane, reason: 'which are the seeders for the sign process' });
await this.scope.import(ids, {
lane,
includeUpdateDependents: true,
reason: 'which are the seeders for the sign process',
});
longProcessLogger.end('success');
}
const { componentsToSkip, componentsToSign } = await this.getComponentIdsToSign(ids, rebuild);
Expand Down
37 changes: 25 additions & 12 deletions src/scope/component-ops/scope-components-importer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ export default class ScopeComponentsImporter {
ignoreMissingHead = false,
preferDependencyGraph = true,
includeUnexported = false,
includeUpdateDependents = false,
reason,
}: {
ids: ComponentIdList;
Expand All @@ -117,6 +118,7 @@ export default class ScopeComponentsImporter {
ignoreMissingHead?: boolean; // needed when fetching "main" objects when on a lane
preferDependencyGraph?: boolean; // if an external is missing and the remote has it with the dependency graph, don't fetch all its dependencies
includeUnexported?: boolean; // whether filter out new component-ids that were not exported yet (default), or not (for cases we want to fix out-of-sync scenarios)
includeUpdateDependents?: boolean; // whether to include the updateDependents components on a lane
reason?: string; // reason why this import is needed
}): Promise<VersionDependencies[]> {
if (!ids.length) return [];
Expand Down Expand Up @@ -165,16 +167,15 @@ export default class ScopeComponentsImporter {
logger.debug('importMany', `total missing externals: ${uniqExternals.length}`);
const remotes = await getScopeRemotes(this.scope);
// we don't care about the VersionDeps returned here as it may belong to the dependencies
await this.getExternalMany(
uniqExternals,
remotes,
await this.getExternalMany(uniqExternals, remotes, {
throwForDependencyNotFound,
lane,
throwForSeederNotFound,
throwOnUnavailableScope: throwForSeederNotFound,
preferDependencyGraph,
includeUnexported,
reason
);
includeUpdateDependents,
reason,
});

if (shouldRefetchIncompleteHistory) {
await this.warnForIncompleteVersionHistory(incompleteVersionHistory);
Expand Down Expand Up @@ -803,12 +804,23 @@ export default class ScopeComponentsImporter {
private async getExternalMany(
ids: ComponentID[],
remotes: Remotes,
throwForDependencyNotFound = false,
lane?: Lane,
throwOnUnavailableScope = true,
preferDependencyGraph = false,
includeUnexported = false,
reason?: string
{
throwForDependencyNotFound = false,
lane,
throwOnUnavailableScope = true,
preferDependencyGraph = false,
includeUnexported = false,
includeUpdateDependents = false,
reason,
}: {
throwForDependencyNotFound?: boolean;
lane?: Lane;
throwOnUnavailableScope?: boolean;
preferDependencyGraph?: boolean;
includeUnexported?: boolean;
includeUpdateDependents?: boolean;
reason?: string;
} = {}
): Promise<VersionDependencies[]> {
if (!ids.length) return [];
lane = await this.getLaneForFetcher(lane);
Expand All @@ -830,6 +842,7 @@ export default class ScopeComponentsImporter {
withoutDependencies: false, // backward compatibility. not needed for remotes > 0.0.900
includeDependencies: true,
includeVersionHistory: true,
includeUpdateDependents,
onlyIfBuilt,
preferDependencyGraph,
laneId: lane?.id(),
Expand Down

0 comments on commit 99390f3

Please sign in to comment.