Skip to content

Commit 309d84c

Browse files
committed
improve site-dependencies.json structure
1 parent 18198fd commit 309d84c

1 file changed

Lines changed: 14 additions & 4 deletions

File tree

lib/site-dependencies.js

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
'use strict'
22

33
const cvs = {}
4+
const origins = {}
45

56
module.exports.register = function () {
67
// '8.0@docs-server' -> Set of '8.0@docs-devex'
@@ -9,18 +10,27 @@ module.exports.register = function () {
910
})
1011

1112
this.once('beforePublish', ({ siteCatalog }) => {
12-
const depsFile = createDependenciesFile(cvs)
13+
const depsFile = createDependenciesFile({ cvs, origins })
1314
siteCatalog.addFile(depsFile)
1415
})
1516

1617
this.once('contentAggregated', ({ contentAggregate }) => {
1718

1819
for (const cv of contentAggregate) {
1920
const cvKey = `${cv.name}@${cv.version}`
20-
const origins = Object.fromEntries(
21-
cv.origins.map(o => [repoKey(o), o.refhash || null]))
2221

23-
cvs[cvKey] = { origins, dependencies: new Set() }
22+
cvs[cvKey] = {
23+
dependencies: new Set(),
24+
origins: cv.origins.map(o => {
25+
const oKey = repoKey(o)
26+
// side-effect: populate origins map
27+
origins[oKey] = {
28+
refhash: o.refhash || null,
29+
cv: cvKey
30+
}
31+
return oKey
32+
})
33+
}
2434
}
2535

2636
// compare repos[].sha against your persisted previous-build record

0 commit comments

Comments
 (0)