Skip to content

Commit fdc88f8

Browse files
authored
Merge pull request #207 from owncloud/update_comp_version.js
Update the component-version counting extension
2 parents 4e892c8 + 724c9fc commit fdc88f8

File tree

1 file changed

+21
-6
lines changed

1 file changed

+21
-6
lines changed

Diff for: ext-antora/comp-version.js

+21-6
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
11
'use strict'
22

3-
// Extension to print the component, version and number of files that will be processed
4-
3+
/**
4+
* Print a table of Component - Version - Number of Files + total.
5+
* Only the number of files in the modules directory are counted
6+
* Version 1.1.0
7+
*
8+
* ┌─────────┬────────┬─────────┬───────┐
9+
* │ (index) │ Name │ Version │ Files │
10+
* ├─────────┼────────┼─────────┼───────┤
11+
* │ 0 │ 'ROOT' │ '~' │ 14 │
12+
* │ 3 │ │ │ 14 │
13+
* └─────────┴────────┴─────────┴───────┘
14+
*/
15+
516
module.exports.register = function () {
617
this.once('contentAggregated', ({ contentAggregate }) => {
718
console.log('\nProcessing the following components, versions and number of files\n')
819
var total_files = 0
920
const component_table = []
1021
contentAggregate.forEach((bucket) => {
11-
component_table.push ({Name: bucket.name, Version: bucket.version || '~', Files: bucket.files.length})
12-
total_files += parseInt(bucket.files.length)
22+
var count = 0
23+
bucket.files.forEach((file) => {
24+
if (file.src.path.startsWith('modules')) {
25+
count += 1
26+
}
27+
})
28+
component_table.push ({Name: bucket.name, Version: bucket.version || '~', Files: count})
29+
total_files += count
1330
})
14-
component_table.length++
15-
component_table.length++
1631
component_table.push ({Files: total_files})
1732
console.table(component_table)
1833
console.log() // do not delete, else we get a double empty line

0 commit comments

Comments
 (0)