@@ -85,7 +85,11 @@ const cdnLegacy = [
8585] ;
8686
8787const cdnMaps = [
88- "maps/{{version}}/modules/map.js"
88+ 'maps/{{version}}/modules/map.js'
89+ ] ;
90+
91+ const cdnGantt = [
92+ '{{version}}/modules/gantt.js'
8993] ;
9094
9195const cdnMoment = [
@@ -129,6 +133,12 @@ let schema = {
129133 required : true ,
130134 conform : boolConform
131135 } ,
136+ gantt : {
137+ description : 'Include Gantt? (requires Gantt license, and >V6.2)' ,
138+ default : 'no' ,
139+ required : true ,
140+ conform : boolConform
141+ } ,
132142 styledMode : {
133143 description : 'Enable styled mode? (requires Highcharts/Highstock 5+ license)' ,
134144 default : 'no' ,
@@ -273,19 +283,34 @@ function endMsg() {
273283 console . log ( 'For documentation, see https://github.com/highcharts/node-export-server' ) ;
274284}
275285
276- function embedAll ( version , includeStyled , includeMaps , includeMoment , optionals ) {
286+ function embedAll ( version , includeStyled , includeMaps , includeMoment , includeGantt , optionals ) {
277287 var standard = cdnScriptsStandard . concat ( cdnScriptsCommon ) . concat ( cdnAdditional ) ,
278288 styled = cdnScriptsStyled . concat ( cdnScriptsCommon ) . concat ( cdnAdditional )
279289 ;
280290
291+ optionals = optionals || { } ;
292+
281293 if ( includeMaps ) {
282294 console . log ( 'Including maps support' . green ) ;
283295 standard = standard . concat ( cdnMaps ) . concat ( cdnMapCollection ) ;
284296 styled = styled . concat ( cdnMaps ) . concat ( cdnMapCollection ) ;
285297
286298 // Map collections are user supplied, so we need to allow them to 404
287299 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
289314 } ) ;
290315 }
291316
@@ -355,6 +380,7 @@ function startPrompt() {
355380 affirmative ( result . styledMode ) ,
356381 affirmative ( result . maps ) ,
357382 affirmative ( result . moment ) ,
383+ affirmative ( result . gantt ) ,
358384 getOptionals ( result )
359385 ) ;
360386 } else {
@@ -372,7 +398,8 @@ if (process.env.ACCEPT_HIGHCHARTS_LICENSE) {
372398 useIfDefined ( process . env . HIGHCHARTS_VERSION , 'latest' ) ,
373399 useIfDefined ( process . env . HIGHCHARTS_USE_STYLED , true ) ,
374400 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 )
376403 ) ;
377404} else {
378405 console . log ( fs . readFileSync ( __dirname + '/msg/licenseagree.msg' ) . toString ( ) . bold ) ;
0 commit comments