adapt-authoring-adaptframework 1.0.1 → 1.1.1
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/lib/AdaptFrameworkBuild.js +13 -2
- package/package.json +1 -1
|
@@ -44,7 +44,7 @@ class AdaptFrameworkBuild {
|
|
|
44
44
|
* @constructor
|
|
45
45
|
* @param {AdaptFrameworkBuildOptions} options
|
|
46
46
|
*/
|
|
47
|
-
constructor ({ action, courseId, userId, expiresAt }) {
|
|
47
|
+
constructor ({ action, courseId, userId, expiresAt, compress }) {
|
|
48
48
|
/**
|
|
49
49
|
* The MongoDB collection name
|
|
50
50
|
* @type {String}
|
|
@@ -70,6 +70,11 @@ class AdaptFrameworkBuild {
|
|
|
70
70
|
* @type {Boolean}
|
|
71
71
|
*/
|
|
72
72
|
this.isExport = action === 'export'
|
|
73
|
+
/**
|
|
74
|
+
* Whether the final output directory should be compressed (only applies to publish and export)
|
|
75
|
+
* @type {Boolean}
|
|
76
|
+
*/
|
|
77
|
+
this.compress = compress !== false
|
|
73
78
|
/**
|
|
74
79
|
* The _id of the course being build
|
|
75
80
|
* @type {String}
|
|
@@ -170,7 +175,9 @@ class AdaptFrameworkBuild {
|
|
|
170
175
|
if (!this.expiresAt) {
|
|
171
176
|
this.expiresAt = await AdaptFrameworkBuild.getBuildExpiry()
|
|
172
177
|
}
|
|
173
|
-
|
|
178
|
+
// random suffix to account for parallel builds executed at exactly the same millisecond
|
|
179
|
+
const randomSuffix = `_${Math.floor(Math.random() * 1000).toString().padStart(4, '0')}`
|
|
180
|
+
this.dir = path.resolve(framework.getConfig('buildDir'), Date.now() + randomSuffix)
|
|
174
181
|
this.buildDir = path.join(this.dir, 'build')
|
|
175
182
|
this.courseDir = path.join(this.buildDir, 'course')
|
|
176
183
|
|
|
@@ -475,6 +482,10 @@ class AdaptFrameworkBuild {
|
|
|
475
482
|
*/
|
|
476
483
|
async createZip () {
|
|
477
484
|
const zipPath = path.join(this.dir, this.isPublish ? 'build' : '')
|
|
485
|
+
if (this.compress === false) {
|
|
486
|
+
this.location = zipPath
|
|
487
|
+
return
|
|
488
|
+
}
|
|
478
489
|
const outputPath = `${this.dir}.zip`
|
|
479
490
|
await zipper.zip(zipPath, outputPath, { removeSource: true })
|
|
480
491
|
await fs.remove(this.dir)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "adapt-authoring-adaptframework",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"description": "Adapt framework integration for the Adapt authoring tool",
|
|
5
5
|
"homepage": "https://github.com/adapt-security/adapt-authoring-adaptframework",
|
|
6
6
|
"license": "GPL-3.0",
|