@@ -376,7 +376,93 @@ module.exports = (app) => {
376
376
377
377
// Show the package options
378
378
app . get ( '/mdk/package' , ( req , res ) => {
379
- res . locals = Object . assign ( res . locals , { template : 'download' } )
379
+ let status = {
380
+ demo : 'unknown' ,
381
+ install : 'unknown' ,
382
+ screenshot : 'unknown' ,
383
+ icon : 'unknown' ,
384
+ scoreModule : 'unknown' ,
385
+ creatorCallback : 'unknown' ,
386
+ playerCallback : 'unknown' ,
387
+ scoreScreenCallback : 'unknown'
388
+ }
389
+ let action = {
390
+ demo : '' ,
391
+ install : '' ,
392
+ screenshot : '' ,
393
+ icon : '' ,
394
+ scoreModule : '' ,
395
+ creatorCallback : '' ,
396
+ playerCallback : '' ,
397
+ scoreScreenCallback : ''
398
+ }
399
+ //let's see if we can get the demo json file
400
+ try {
401
+ let demo = JSON . parse ( getFileFromWebpack ( 'demo.json' ) . toString ( ) )
402
+
403
+ if ( ! demo . name ) {
404
+ status . demo = 'fail'
405
+ action . demo = "'name' property missing"
406
+ } else if ( ! demo . qset ) {
407
+ status . demo = 'fail'
408
+ action . demo = "'qset' property missing"
409
+ } else if ( ! demo . qset . version ) {
410
+ status . demo = 'fail'
411
+ action . demo = "'qset' 'version' property missing"
412
+ } else if ( ! demo . qset . data ) {
413
+ status . demo = 'fail'
414
+ action . demo = "'qset' 'data' property missing"
415
+ }
416
+ status . demo = 'pass'
417
+ } catch ( error ) {
418
+ status . demo = 'fail'
419
+ action . demo = 'demo.json missing or can\'t be parsed'
420
+ }
421
+
422
+ const checklist = [
423
+ {
424
+ status : status . demo ,
425
+ text : 'demo.json found and valid' ,
426
+ action : action . demo ,
427
+ } ,
428
+ {
429
+ status : status . install ,
430
+ text : 'install.yaml found and valid' ,
431
+ action : action . install ,
432
+ } ,
433
+ {
434
+ status : status . screenshot ,
435
+ text : 'screenshots found' ,
436
+ action : action . screenshot ,
437
+ } ,
438
+ {
439
+ status : status . icon ,
440
+ text : 'icons files found' ,
441
+ action : action . icon ,
442
+ } ,
443
+ {
444
+ status : status . scoreModule ,
445
+ text : 'score module found and valid' ,
446
+ action : action . scoreModule ,
447
+ } ,
448
+ {
449
+ status : status . creatorCallback ,
450
+ text : 'creator callbacks registered' ,
451
+ action : action . creatorCallback ,
452
+ } ,
453
+ {
454
+ status : status . playerCallback ,
455
+ text : 'player callbacks registered' ,
456
+ action : action . playerCallback ,
457
+ } ,
458
+ {
459
+ status : status . scoreScreenCallback ,
460
+ text : 'score screen callbacks registered' ,
461
+ action : action . scoreScreenCallback ,
462
+ } ,
463
+ ]
464
+
465
+ res . locals = Object . assign ( res . locals , { template : 'download' , checklist : checklist } )
380
466
res . render ( res . locals . template )
381
467
} )
382
468
0 commit comments