AdaptFrameworkBuild

adaptframework. AdaptFrameworkBuild

Encapsulates all behaviour needed to build a single Adapt course instance

Constructor

new AdaptFrameworkBuild()

Source:

Members

action :String

Source:
The build action being performed
Type:
  • String

assetData :Object

Source:
All metadata related to assets used in this course
Type:
  • Object

buildData :Object

Source:
Metadata describing this build attempt
Type:
  • Object

buildDir :String

Source:
The course build directory
Type:
  • String

collectionName :String

Source:
The MongoDB collection name
Type:
  • String

courseData :Object

Source:
All JSON data describing this course
Type:
  • Object

courseDir :String

Source:
The course content directory
Type:
  • String

courseId :String

Source:
The _id of the course being build
Type:
  • String

dir :String

Source:
The build output directory
Type:
  • String

disabledPlugins :Array.<Object>

Source:
List of plugins NOT used in this course
Type:
  • Array.<Object>

enabledPlugins :Array.<Object>

Source:
List of plugins used in this course
Type:
  • Array.<Object>

expiresAt :Object

Source:
All JSON data describing this course
Type:
  • Object

idMap :Object

Source:
A map of _ids for use with 'friendly' IDs
Type:
  • Object

isExport :Boolean

Source:
Shorthand for checking if this build is an export
Type:
  • Boolean

isPreview :Boolean

Source:
Shorthand for checking if this build is a preview
Type:
  • Boolean

isPublish :Boolean

Source:
Shorthand for checking if this build is a publish
Type:
  • Boolean

location :String

Source:
The final location of the build
Type:
  • String

postBuildHook :Hook

Source:
Invoked after a course has been built.
Type:
  • Hook

preBuildHook :Hook

Source:
Invoked prior to a course being built.
Type:
  • Hook

userId :String

Source:
_id of the user initiating the course build
Type:
  • String

Methods

(async, static) getBuildExpiry() → {String}

Source:
Returns a timestring to be used for an adaptbuild expiry
Returns:
Type
String

(async, static) run(options) → {Promise}

Source:
Imports a course zip to the database
Parameters:
Name Type Description
options AdaptFrameworkBuildOptions
Returns:
Resolves to this AdaptFrameworkBuild instance
Type
Promise

(async) build() → {Promise}

Source:
Runs the Adapt framework build tools to generate a course build
Returns:
Resolves with the output directory
Type
Promise

(async) cachePluginData() → {Promise}

Source:
Caches lists of which plugins are/aren't being used in this course
Returns:
Type
Promise

(async) copyAssets() → {Promise}

Source:
Deals with copying all assets used in this course
Returns:
Type
Promise

(async) copySource() → {Promise}

Source:
Copies the source code needed for this course
Returns:
Type
Promise

createIdMap()

Source:
Stores a map of friendlyId values to ObjectId _ids

(async) createPreview() → {Promise}

Source:
Makes sure the output folder is structured to allow the files to be served statically for previewing
Returns:
Type
Promise

(async) createZip() → {Promise}

Source:
Creates a zip file containing all files relevant to the type of build being performed
Returns:
Type
Promise

(async) ensureDir(dir)

Source:
Makes sure the directory exists
Parameters:
Name Type Description
dir string

(async) loadAssetData() → {Promise}

Source:
Processes and caches the course's assets
Returns:
Type
Promise

(async) loadCourseData() → {Promise}

Source:
Collects and caches all the DB data for the course being built
Returns:
Type
Promise

(async) recordBuildAttempt() → {Promise}

Source:
Stored metadata about a build attempt in the DB
Returns:
Resolves with the DB document
Type
Promise

(async) removeOldBuilds() → {Promise}

Source:
Removes all previous builds of this.action type
Returns:
Type
Promise

sortContentItems(items)

Source:
Sorts the course data into the types needed for each Adapt JSON file. Works by memoising items into an object using the relative sort order as a key used for sorting.
Parameters:
Name Type Description
items Array.<Object> The list of content objects

transformContentItems()

Source:
Transforms content items into a format recognised by the Adapt framework

(async) writeContentJson() → {Promise}

Source:
Outputs all course data to the required JSON files
Returns:
Type
Promise