Skip to content

Commit

Permalink
Record feature dependencies in the lockfile
Browse files Browse the repository at this point in the history
  • Loading branch information
chrmarti committed Jul 14, 2023
1 parent 87e38d1 commit 35b4655
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions src/spec-configuration/lockfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,16 @@ export async function writeLockfile(params: ContainerFeatureInternalParams, conf
const lockfile: Lockfile = featuresConfig.featureSets
.map(f => [f, f.sourceInformation] as const)
.filter((tup): tup is [FeatureSet, OCISourceInformation] => tup[1].type === 'oci')
.map(([set, source]) => ({
id: source.userFeatureId,
version: set.features[0].version!,
resolved: `${source.featureRef.registry}/${source.featureRef.path}@${set.computedDigest}`,
integrity: set.computedDigest!,
}))
.map(([set, source]) => {
const dependsOn = Object.keys(set.features[0].dependsOn || {});
return {
id: source.userFeatureId,
version: set.features[0].version!,
resolved: `${source.featureRef.registry}/${source.featureRef.path}@${set.computedDigest}`,
integrity: set.computedDigest!,
dependsOn: dependsOn.length ? dependsOn : undefined,
};
})
.sort((a, b) => a.id.localeCompare(b.id))
.reduce((acc, cur) => {
const feature = { ...cur };
Expand Down

0 comments on commit 35b4655

Please sign in to comment.