@@ -10,6 +10,7 @@ import { randomUUID } from 'crypto';
10
10
import * as https from 'https' ;
11
11
import * as os from 'os' ;
12
12
import * as querystring from 'querystring' ;
13
+ import * as semver from 'semver' ;
13
14
import type { CommandContext } from '../command-builder/command-module' ;
14
15
import { ngDebug } from '../utilities/environment-options' ;
15
16
import { assertIsError } from '../utilities/error' ;
@@ -52,8 +53,7 @@ export class AnalyticsCollector {
52
53
53
54
this . requestParameterStringified = querystring . stringify ( requestParameters ) ;
54
55
55
- // Remove the `v` at the beginning.
56
- const nodeVersion = process . version . substring ( 1 ) ;
56
+ const parsedVersion = semver . parse ( process . version ) ;
57
57
const packageManagerVersion = context . packageManager . version ;
58
58
59
59
this . userParameters = {
@@ -62,8 +62,10 @@ export class AnalyticsCollector {
62
62
[ UserCustomDimension . OsArchitecture ] : os . arch ( ) ,
63
63
// While User ID is being collected by GA, this is not visible in reports/for filtering.
64
64
[ UserCustomDimension . UserId ] : userId ,
65
- [ UserCustomDimension . NodeVersion ] : nodeVersion ,
66
- [ UserCustomDimension . NodeMajorVersion ] : + nodeVersion . split ( '.' , 1 ) [ 0 ] ,
65
+ [ UserCustomDimension . NodeVersion ] : parsedVersion
66
+ ? `${ parsedVersion . major } .${ parsedVersion . minor } .${ parsedVersion . patch } `
67
+ : 'other' ,
68
+ [ UserCustomDimension . NodeMajorVersion ] : parsedVersion ?. major ,
67
69
[ UserCustomDimension . PackageManager ] : context . packageManager . name ,
68
70
[ UserCustomDimension . PackageManagerVersion ] : packageManagerVersion ,
69
71
[ UserCustomDimension . PackageManagerMajorVersion ] : packageManagerVersion
0 commit comments