6
6
*/
7
7
import * as fs from 'node:fs' ;
8
8
import * as path from 'node:path' ;
9
- import { Logger , SfProject , SfProjectJson } from '@salesforce/core' ;
9
+ import { Logger , SfProject , SfProjectJson , Lifecycle } from '@salesforce/core' ;
10
10
import { deepFreeze } from '../utils/collections' ;
11
11
import { MetadataRegistry } from './types' ;
12
12
import * as registryData from './metadataRegistry.json' ;
@@ -16,7 +16,6 @@ export type RegistryLoadInput = {
16
16
* will default to the current working directory
17
17
* if no project file is found, the standard registry will be returned without modifications
18
18
*/
19
- // TODO: this might be a string instead of an object if no other props are needed
20
19
projectDir ?: string ;
21
20
} ;
22
21
@@ -49,6 +48,16 @@ const loadVariants = ({ projectDir }: RegistryLoadInput = {}): MetadataRegistry
49
48
( prev , curr ) => firstLevelMerge ( prev , loadPreset ( curr ) ) ,
50
49
emptyRegistry
51
50
) ;
51
+ if ( presets . length > 0 || Object . keys ( customizations . types ) . length > 0 ) {
52
+ void Lifecycle . getInstance ( ) . emitTelemetry ( {
53
+ library : 'SDR' ,
54
+ eventName : 'RegistryVariants' ,
55
+ presetCount : presets . length ,
56
+ presets : presets . join ( ',' ) ,
57
+ customizationsCount : Object . keys ( customizations . types ) . length ,
58
+ customizationsTypes : Object . keys ( customizations . types ) . join ( ',' ) ,
59
+ } ) ;
60
+ }
52
61
return firstLevelMerge ( registryFromPresets , customizations ) ;
53
62
} ;
54
63
@@ -60,13 +69,6 @@ const maybeGetProject = (projectDir?: string): SfProjectJson | undefined => {
60
69
}
61
70
} ;
62
71
63
- // TODO: this type should maybe live somewhere else and be part of the sfdx-project schema
64
- // but we don't want circular dependency from sfdx-core to SDR
65
- // type CustomRegistry = {
66
- // registryCustomizations: MetadataRegistry;
67
- // registryPresets: string[];
68
- // };
69
-
70
72
const loadPreset = ( preset : string ) : MetadataRegistry => {
71
73
const pathToCheck = path . join ( __dirname , 'presets' , `${ preset } .json` ) ;
72
74
0 commit comments