@@ -85,7 +85,11 @@ const cdnLegacy = [
85
85
] ;
86
86
87
87
const cdnMaps = [
88
- "maps/{{version}}/modules/map.js"
88
+ 'maps/{{version}}/modules/map.js'
89
+ ] ;
90
+
91
+ const cdnGantt = [
92
+ '{{version}}/modules/gantt.js'
89
93
] ;
90
94
91
95
const cdnMoment = [
@@ -129,6 +133,12 @@ let schema = {
129
133
required : true ,
130
134
conform : boolConform
131
135
} ,
136
+ gantt : {
137
+ description : 'Include Gantt? (requires Gantt license, and >V6.2)' ,
138
+ default : 'no' ,
139
+ required : true ,
140
+ conform : boolConform
141
+ } ,
132
142
styledMode : {
133
143
description : 'Enable styled mode? (requires Highcharts/Highstock 5+ license)' ,
134
144
default : 'no' ,
@@ -273,19 +283,34 @@ function endMsg() {
273
283
console . log ( 'For documentation, see https://github.com/highcharts/node-export-server' ) ;
274
284
}
275
285
276
- function embedAll ( version , includeStyled , includeMaps , includeMoment , optionals ) {
286
+ function embedAll ( version , includeStyled , includeMaps , includeMoment , includeGantt , optionals ) {
277
287
var standard = cdnScriptsStandard . concat ( cdnScriptsCommon ) . concat ( cdnAdditional ) ,
278
288
styled = cdnScriptsStyled . concat ( cdnScriptsCommon ) . concat ( cdnAdditional )
279
289
;
280
290
291
+ optionals = optionals || { } ;
292
+
281
293
if ( includeMaps ) {
282
294
console . log ( 'Including maps support' . green ) ;
283
295
standard = standard . concat ( cdnMaps ) . concat ( cdnMapCollection ) ;
284
296
styled = styled . concat ( cdnMaps ) . concat ( cdnMapCollection ) ;
285
297
286
298
// Map collections are user supplied, so we need to allow them to 404
287
299
cdnMapCollection . forEach ( ( url ) => {
288
- cdnScriptsOptional [ url ] = 1 ;
300
+ optionals [ url ] = 1 ;
301
+ } ) ;
302
+ }
303
+
304
+ if ( includeGantt ) {
305
+ console . log ( 'Including Gantt support' . green ) ;
306
+
307
+ standard = standard . concat ( cdnGantt ) ;
308
+ styled = styled . concat ( cdnGantt ) ;
309
+
310
+ // Gantt was introduced in 6.2. To avoid 404 errors if fetching an
311
+ // older version by accident, let the fetch fail gracefully
312
+ cdnGantt . forEach ( ( url ) => {
313
+ optionals [ url ] = 1
289
314
} ) ;
290
315
}
291
316
@@ -355,6 +380,7 @@ function startPrompt() {
355
380
affirmative ( result . styledMode ) ,
356
381
affirmative ( result . maps ) ,
357
382
affirmative ( result . moment ) ,
383
+ affirmative ( result . gantt ) ,
358
384
getOptionals ( result )
359
385
) ;
360
386
} else {
@@ -372,7 +398,8 @@ if (process.env.ACCEPT_HIGHCHARTS_LICENSE) {
372
398
useIfDefined ( process . env . HIGHCHARTS_VERSION , 'latest' ) ,
373
399
useIfDefined ( process . env . HIGHCHARTS_USE_STYLED , true ) ,
374
400
useIfDefined ( process . env . HIGHCHARTS_USE_MAPS , true ) ,
375
- useIfDefined ( process . env . HIGHCHARTS_MOMENT , false )
401
+ useIfDefined ( process . env . HIGHCHARTS_MOMENT , false ) ,
402
+ useIfDefined ( process . env . HIGHCHARTS_USE_GANTT , true )
376
403
) ;
377
404
} else {
378
405
console . log ( fs . readFileSync ( __dirname + '/msg/licenseagree.msg' ) . toString ( ) . bold ) ;
0 commit comments