@@ -10,18 +10,21 @@ const ONE_DAY_IN_MILLISECONDS = 86_400_000;
10
10
*/
11
11
export class NodeRelease {
12
12
/**
13
- * How long before enf-of-life do we start warning customers? Expressed in
14
- * milliseconds to make it easier to deal with JS dates.
13
+ * How long after end-of-life do we continue to support a node version.
15
14
*/
16
- private static readonly DEPRECATION_WINDOW_MS = 30 * ONE_DAY_IN_MILLISECONDS ;
15
+ private static readonly DEFAULT_EXTENDED_SUPPORT_MONTHS = 6 ;
17
16
18
17
/**
19
18
* All registered node releases.
20
19
*/
21
20
public static readonly ALL_RELEASES : readonly NodeRelease [ ] = [
22
21
// Historical releases (not relevant at time of writing this as they're all EOL now...)
23
22
...( [ 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10 , 11 ] as const ) . map (
24
- ( majorVersion ) => new NodeRelease ( majorVersion , { endOfLife : true } ) ,
23
+ ( majorVersion ) =>
24
+ new NodeRelease ( majorVersion , {
25
+ endOfLife : new Date ( '2018-01-01' ) ,
26
+ untested : true ,
27
+ } ) ,
25
28
) ,
26
29
27
30
// Past end-of-life releases
@@ -46,11 +49,16 @@ export class NodeRelease {
46
49
} ) ,
47
50
new NodeRelease ( 19 , { endOfLife : new Date ( '2023-06-01' ) , untested : true } ) ,
48
51
new NodeRelease ( 21 , { endOfLife : new Date ( '2024-06-01' ) , untested : true } ) ,
52
+ new NodeRelease ( 23 , { endOfLife : new Date ( '2025-06-01' ) , untested : true } ) ,
49
53
50
54
// Currently active releases (as of last edit to this file...)
51
- new NodeRelease ( 18 , { endOfLife : new Date ( '2025-04-30' ) } ) ,
55
+ new NodeRelease ( 18 , {
56
+ endOfLife : new Date ( '2025-04-30' ) ,
57
+ endOfJsiiSupport : new Date ( '2025-11-30' ) ,
58
+ } ) ,
52
59
new NodeRelease ( 20 , { endOfLife : new Date ( '2026-04-30' ) } ) ,
53
60
new NodeRelease ( 22 , { endOfLife : new Date ( '2027-04-30' ) } ) ,
61
+ new NodeRelease ( 24 , { endOfLife : new Date ( '2028-04-30' ) } ) ,
54
62
55
63
// Future (planned releases)
56
64
] ;
@@ -88,21 +96,33 @@ export class NodeRelease {
88
96
89
97
/**
90
98
* The date on which this release range starts to be considered end-of-life.
91
- * May be `undefined` for "ancient" releases (before Node 12).
99
+ * Defaults to a pre-CDK date for "ancient" releases (before Node 12).
92
100
*/
93
- public readonly endOfLifeDate : Date | undefined ;
101
+ public readonly endOfLifeDate : Date ;
94
102
95
103
/**
96
- * Determines whether this release is currently considered end-of-life.
104
+ * Determines whether this release has reached end of support for jsii.
105
+ * This is usually longer then endOfLife;
97
106
*/
98
- public readonly endOfLife : boolean ;
107
+ public readonly endOfJsiiSupportDate : Date ;
99
108
100
109
/**
101
110
* Determines whether this release is within the deprecation window ahead of
102
111
* it's end-of-life date.
103
112
*/
104
113
public readonly deprecated : boolean ;
105
114
115
+ /**
116
+ * Determines whether this release has reached end-of-life.
117
+ */
118
+ public readonly endOfLife : boolean ;
119
+
120
+ /**
121
+ * Determines whether this major version line is currently "in support",
122
+ * meaning it is not end-of-life or within our extended support time frame.
123
+ */
124
+ public readonly supported : boolean ;
125
+
106
126
/**
107
127
* If `true` denotes that this version of node has not been added to the test
108
128
* matrix yet. This is used when adding not-yet-released versions of node that
@@ -119,51 +139,45 @@ export class NodeRelease {
119
139
*/
120
140
public readonly supportedRange : Range ;
121
141
122
- /**
123
- * Determines whether this major version line is currently "in support",
124
- * meaning it is not end-of-life nor pending.
125
- */
126
- public readonly supported : boolean ;
127
-
128
- /** @internal visible for testing */
129
- public constructor (
130
- majorVersion : 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 ,
131
- opts : { endOfLife : true } ,
132
- ) ;
133
142
/** @internal visible for testing */
134
143
public constructor (
135
144
majorVersion : number ,
136
145
opts : {
137
146
endOfLife : Date ;
138
- untested ?: boolean ;
139
- supportedRange ?: string ;
140
- } ,
141
- ) ;
142
- /** @internal visible for testing */
143
- public constructor (
144
- majorVersion : number ,
145
- opts : {
146
- endOfLife : Date | true ;
147
+ endOfJsiiSupport ?: Date ;
147
148
untested ?: boolean ;
148
149
supportedRange ?: string ;
149
150
} ,
150
151
) {
151
- this . majorVersion = majorVersion ;
152
- this . endOfLifeDate = opts . endOfLife === true ? undefined : opts . endOfLife ;
153
152
this . untested = opts . untested ?? false ;
153
+ this . majorVersion = majorVersion ;
154
154
this . supportedRange = new Range (
155
155
opts . supportedRange ?? `^${ majorVersion } .0.0` ,
156
156
) ;
157
157
158
+ this . endOfLifeDate = opts . endOfLife ;
158
159
this . endOfLife =
159
- opts . endOfLife === true || opts . endOfLife . getTime ( ) <= Date . now ( ) ;
160
- this . deprecated =
161
- ! this . endOfLife &&
162
- opts . endOfLife !== true &&
163
- opts . endOfLife . getTime ( ) - NodeRelease . DEPRECATION_WINDOW_MS <=
164
- Date . now ( ) ;
165
-
166
- this . supported = ! this . untested && ! this . endOfLife ;
160
+ opts . endOfLife . getTime ( ) + ONE_DAY_IN_MILLISECONDS <= Date . now ( ) ;
161
+
162
+ // jsii EOS defaults to 6 months after EOL
163
+ this . endOfJsiiSupportDate =
164
+ opts . endOfJsiiSupport ??
165
+ new Date (
166
+ this . endOfLifeDate . getFullYear ( ) ,
167
+ this . endOfLifeDate . getMonth ( ) +
168
+ NodeRelease . DEFAULT_EXTENDED_SUPPORT_MONTHS ,
169
+ this . endOfLifeDate . getDate ( ) ,
170
+ ) ;
171
+
172
+ const endOfJsiiSupport =
173
+ this . endOfJsiiSupportDate . getTime ( ) + ONE_DAY_IN_MILLISECONDS <=
174
+ Date . now ( ) ;
175
+
176
+ // We deprecate (warn) from EOL to jsii EOS
177
+ this . deprecated = this . endOfLife && ! endOfJsiiSupport ;
178
+
179
+ // All tested and not EOS versions are supported
180
+ this . supported = ! this . untested && ! endOfJsiiSupport ;
167
181
}
168
182
169
183
public toString ( ) : string {
0 commit comments