|
1 | 1 | 'use strict'
|
2 | 2 |
|
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 | + |
5 | 16 | module.exports.register = function () {
|
6 | 17 | this.once('contentAggregated', ({ contentAggregate }) => {
|
7 | 18 | console.log('\nProcessing the following components, versions and number of files\n')
|
8 | 19 | var total_files = 0
|
9 | 20 | const component_table = []
|
10 | 21 | 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 |
13 | 30 | })
|
14 |
| - component_table.length++ |
15 |
| - component_table.length++ |
16 | 31 | component_table.push ({Files: total_files})
|
17 | 32 | console.table(component_table)
|
18 | 33 | console.log() // do not delete, else we get a double empty line
|
|
0 commit comments