@@ -33,20 +33,7 @@ function getSystemArch(): (typeof process)['arch'] {
33
33
: process . arch ;
34
34
}
35
35
36
- /**
37
- * Return an object with information about this mongosh instance,
38
- * in particular, when it was built and how.
39
- */
40
- // eslint-disable-next-line @typescript-eslint/require-await
41
- export async function buildInfo ( {
42
- withSegmentApiKey,
43
- } : {
44
- withSegmentApiKey ?: boolean ;
45
- } = { } ) : Promise < BuildInfo > {
46
- const dependencyVersionInfo : BuildInfo [ 'deps' ] = {
47
- ...CliServiceProvider . getVersionInformation ( ) ,
48
- } ;
49
-
36
+ export function baseBuildInfo ( ) : Omit < BuildInfo , 'deps' > {
50
37
const runtimeData = {
51
38
nodeVersion : process . version ,
52
39
opensslVersion : process . versions . openssl ,
@@ -57,15 +44,13 @@ export async function buildInfo({
57
44
// Runtime platform can differ e.g. because homebrew on macOS uses
58
45
// npm packages published from Linux
59
46
runtimePlatform : process . platform ,
60
- deps : { ...dependencyVersionInfo } ,
61
47
} ;
62
48
63
49
try {
64
- const buildInfo = { ...require ( './build-info.json' ) , ...runtimeData } ;
65
- if ( ! withSegmentApiKey ) {
66
- delete buildInfo . segmentApiKey ;
67
- }
68
- return buildInfo ;
50
+ return {
51
+ ...require ( './build-info.json' ) ,
52
+ ...runtimeData ,
53
+ } ;
69
54
} catch {
70
55
const { version } = require ( '../package.json' ) ;
71
56
return {
@@ -80,3 +65,24 @@ export async function buildInfo({
80
65
} ;
81
66
}
82
67
}
68
+
69
+ /**
70
+ * Return an object with information about this mongosh instance,
71
+ * in particular, when it was built and how.
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/require-await
74
+ export async function buildInfo ( {
75
+ withSegmentApiKey,
76
+ } : {
77
+ withSegmentApiKey ?: boolean ;
78
+ } = { } ) : Promise < BuildInfo > {
79
+ const dependencyVersionInfo : BuildInfo [ 'deps' ] = {
80
+ ...CliServiceProvider . getVersionInformation ( ) ,
81
+ } ;
82
+
83
+ const buildInfo = { ...baseBuildInfo ( ) , deps : { ...dependencyVersionInfo } } ;
84
+ if ( ! withSegmentApiKey ) {
85
+ delete buildInfo . segmentApiKey ;
86
+ }
87
+ return buildInfo ;
88
+ }
0 commit comments