File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11const targetSpecified = process . argv [ 2 ] !== 'none' ;
22
3- let isNode18OrElectron20AndUp = false ;
3+ let cxxStandard = '14' ;
44if ( targetSpecified ) {
55 // Assume electron if target is specified.
66 // If building node 18 / 19 via target, will need to specify C++ standard manually
7- const majorVersion = process . argv [ 2 ] . split ( '.' ) [ 0 ] ;
8- isNode18OrElectron20AndUp = majorVersion >= 20 ;
7+ const majorVersion = Number . parseInt ( process . argv [ 2 ] . split ( '.' ) [ 0 ] ) ;
8+ if ( majorVersion >= 20 ) {
9+ cxxStandard = '17' ;
10+ }
911} else {
10- // Node 18 === 108
11- isNode18OrElectron20AndUp = Number . parseInt ( process . versions . modules ) >= 108 ;
12+ // Node 18 === 108, Node 24 === 137 (V8 headers require C++20)
13+ const moduleVersion = Number . parseInt ( process . versions . modules ) ;
14+ if ( moduleVersion >= 137 ) {
15+ cxxStandard = '20' ;
16+ } else if ( moduleVersion >= 108 ) {
17+ cxxStandard = '17' ;
18+ }
1219}
1320
14- const defaultCxxStandard = isNode18OrElectron20AndUp
15- ? '17'
16- : '14' ;
17-
18- process . stdout . write ( defaultCxxStandard ) ;
21+ process . stdout . write ( cxxStandard ) ;
You can’t perform that action at this time.
0 commit comments