@liascript/exporter 2.6.16--0.12.2 → 2.6.18--0.12.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liascript/exporter",
3
- "version": "2.6.16--0.12.2",
3
+ "version": "2.6.18--0.12.2",
4
4
  "description": "A generic exporter for LiaScript",
5
5
  "main": "dist/index.js",
6
6
  "repository": {
package/src/export/ims.ts CHANGED
@@ -101,7 +101,7 @@ export async function exporter(
101
101
  argument.style
102
102
  )
103
103
 
104
- helper.zip(tmpPath, argument.output)
104
+ await helper.zip(tmpPath, argument.output)
105
105
  }
106
106
 
107
107
  async function manifest(tmpPath: any, meta: any) {
@@ -243,8 +243,6 @@ export async function exporter(
243
243
  : ''
244
244
  }
245
245
 
246
- ${argument['project-no-meta'] ? '' : meta(json)}
247
-
248
246
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
249
247
 
250
248
  <script>
@@ -440,6 +438,16 @@ async function toCard(
440
438
  }
441
439
 
442
440
  let downloads = {}
441
+
442
+ if (argument['project-generate-pdf'])
443
+ downloads['pdf'] = 'assets/pdf/' + backupOutput + '.pdf'
444
+ if (argument['project-generate-ims'])
445
+ downloads['ims'] = 'assets/ims/' + backupOutput + '.zip'
446
+ if (argument['project-generate-scorm12'])
447
+ downloads['scorm12'] = 'assets/scorm12/' + backupOutput + '.zip'
448
+ if (argument['project-generate-scorm2004'])
449
+ downloads['scorm2004'] = 'assets/scorm2004/' + backupOutput + '.zip'
450
+
443
451
  if (argument['project-generate-pdf']) {
444
452
  argument.input = course.data.lia.readme
445
453
  argument.output = backupOutput
@@ -450,7 +458,7 @@ async function toCard(
450
458
  argument['project-generate-cache'] &&
451
459
  fs.existsSync(path.join(process.cwd(), 'assets/pdf/' + file))
452
460
  ) {
453
- downloads['pdf'] = 'assets/pdf/' + file
461
+ console.log('using cached file of ', argument.input, ' -> ', file)
454
462
  } else {
455
463
  console.log('generate pdf of', argument.input, ' -> ', file)
456
464
 
@@ -458,7 +466,6 @@ async function toCard(
458
466
 
459
467
  if (fs.existsSync(file)) {
460
468
  await moveFile(file, 'assets/pdf/' + file)
461
- downloads['pdf'] = 'assets/pdf/' + file
462
469
  }
463
470
  }
464
471
  }
@@ -488,22 +495,20 @@ async function toCard(
488
495
 
489
496
  // IMS
490
497
  if (repo && argument['project-generate-ims']) {
491
- argument.output = backupOutput
498
+ argument.output = 'assets/ims/' + backupOutput
492
499
  const file = argument.output + '.zip'
493
- const asset = argument.output + '.zip'
500
+
501
+ try {
502
+ execSync('mkdir assets/ims')
503
+ } catch (e) {}
494
504
 
495
505
  if (
496
506
  argument['project-generate-cache'] &&
497
- fs.existsSync(path.join(process.cwd(), asset))
507
+ fs.existsSync(path.join(process.cwd(), file))
498
508
  ) {
499
- downloads['ims'] = asset
509
+ console.log('using cached file of ', argument.input, ' -> ', file)
500
510
  } else {
501
511
  await IMS.exporter(argument, course.data)
502
-
503
- if (fs.existsSync(asset)) {
504
- await moveFile(file, 'assets/ims/' + file)
505
- downloads['ims'] = asset
506
- }
507
512
  }
508
513
  }
509
514
 
@@ -516,13 +521,9 @@ async function toCard(
516
521
  argument['project-generate-cache'] &&
517
522
  fs.existsSync(path.join(process.cwd(), asset))
518
523
  ) {
519
- downloads['scorm12'] = asset
524
+ console.log('using cached file of ', argument.input, ' -> ', asset)
520
525
  } else {
521
526
  await SCORM12.exporter(argument, course.data)
522
-
523
- if (fs.existsSync(asset)) {
524
- downloads['scorm12'] = asset
525
- }
526
527
  }
527
528
  }
528
529
 
@@ -536,13 +537,9 @@ async function toCard(
536
537
  argument['project-generate-cache'] &&
537
538
  fs.existsSync(path.join(process.cwd(), asset))
538
539
  ) {
539
- downloads['scorm2004'] = asset
540
+ console.log('using cached file of ', argument.input, ' -> ', asset)
540
541
  } else {
541
542
  await SCORM2004.exporter(argument, course.data)
542
-
543
- if (fs.existsSync(asset)) {
544
- downloads['scorm2004'] = asset
545
- }
546
543
  }
547
544
  }
548
545
 
@@ -698,7 +695,9 @@ function card(
698
695
  <div class="card-body" style="transform: rotate(0);">
699
696
  <a href="${link ? '' : 'https://liascript.github.io/course/?'}${
700
697
  link || url
701
- }" target="_blank" class="link-dark stretched-link">
698
+ }" target="${
699
+ link && !link.startsWith('http') ? '_self' : '_blank'
700
+ }" class="link-dark stretched-link">
702
701
  <h${small ? 6 : 5} class="card-title">${title}</h${small ? 6 : 5}>
703
702
  </a>
704
703
  <p class="card-text">${comment}</p>
@@ -122,7 +122,7 @@ export async function exporter(
122
122
  },
123
123
  }
124
124
 
125
- scormPackager(config, function (msg) {
125
+ await scormPackager(config, function (msg) {
126
126
  console.log(msg)
127
127
  process.exit(0)
128
128
  })
package/src/index.ts CHANGED
@@ -22,7 +22,7 @@ import fetch from 'node-fetch'
22
22
 
23
23
  // -------------------------------Main Execution-------------------------------
24
24
  if (argv.v || argv.version) {
25
- console.log('version: 2.6.16--0.12.2')
25
+ console.log('version: 2.6.18--0.12.2')
26
26
  } else if (argv.h || argv.help) {
27
27
  help()
28
28
  } else if (argv.i || argv.input) {