simple-scorm-packager
v0.2.7
Published
Simple way to package your scorm projects
Downloads
862
Readme
version 0.2.7
Documentation
Creates SCORM package from source directory.
- Supported Scorm versions:
- SCORM 1.2
- SCORM 2004 3rd Edition
- SCORM 2004 4th Edition
Installation
npm install simple-scorm-packager
Initialization Options Object
{type} [default]
version
{string} ['1.2'] Version of SCORM schema. Available options:- '1.2'
- '2004 3rd Edition' alias '2004.3' alias '2004v3'
- '2004 4th Edition' alias '2004.4' alias '2004v4'
organization
{string} [''] Company namelanguage
{string} ['en'] Language of the package ( ISO )title
{string} ['']identifier
{string} [null] If empty, identifier is generated using: `${package.author || 'com'}.${organization || 'company'}.${title || ''}.${generated uuid}`masteryScore
{number} [80]startingPage
{string} ['index.html']source
{string} ['./'] The path to files from which the package will be createdpackage
{object} Available options:zip
{boolean} [false] Archives package (NAME_VERSION_DATE.zip
)appendTimeToOutput
{boolean} [false] Add full Unix time milliseconds to the zip file output, so repeated builds are unique (NAME_VERSION_DATE_TIMESTAMP.zip
)outputFolder
{string} ['./scorm'] The folder path where you want the zip filesize
{number} [null] Provide the package size in bytes, automatically calculated when not set,name
{string} [`{$title}`] Package name, defaults to scorm titleauthor
{string} [''] Author name, used as default for vcard if not providedversion
{string} [process.env.npm_package_version || '1.0.0'] Package versionorganization
{string} [`${organization}`] Company namedate
{string} [current date YYYY-MM-DD] Package datevcard
{object} :author
{string} [`${package.author}`] Author nameorg
{string} [`${package.organization}` || `${organization}`] Organization name, defaults toorganization
tel
{string} [''] Telephone number(s)address
{string} [''] Addressmail
{string} [''] E-mail contacturl
{string} [''] website url
description
{string} [''] Provide the course description or the Project Informationkeywords
{array} [[]] Keywordsduration
{string} ['PT0H0M0S'] The time the media takes to play through, format PT#H#M#StypicalDuration
{string} [`${package.duration}` || 'PT0H0M0S'] The time it will take for a typical learner to fully experience the program, format PT#H#M#Srequirements
{array of objects of the following structure} [[]]type
{string} The type of requirement, eg.: Browser, Osname
{string} The name of the type of requirement, eg.: Microsoft Internet Explorerversion
{string} The minimum version of the requirement
rights
{string} [`© ${organization || ''}. All rights reserved.`] Copyright information
Programatic usage
var scopackager = require('simple-scorm-packager');
scopackager({
version: '2004 4th Edition',
organization: 'Test Company',
title: 'Test Course',
language: 'fr-FR',
identifier: '00',
masteryScore: 80,
startingPage: 'index.html',
source: './myProjectFolder',
package: {
version: "0.0.1",
zip: true,
outputFolder: './scormPackages'
}
}, function(msg){
console.log(msg);
});
Adding it to npm scripts
If you are packaging a project which utilizes npm and has a package.json file, follow the instructions below for adding a SCORM packager to your npm scripts.
- Create a JavaScript file (typically at the root of your project in the same directory as package.json)
scoPackager.js
- The file should contain code to execute this package. Example:
var scopackager = require('simple-scorm-packager');
var path = require('path');
const config = {
version: '1.2',
organization: 'My Amazing Company',
title: 'Test Course',
language: 'en-US',
masteryScore: 80,
startingPage: 'index.html',
source: path.join(__dirname, 'build'),
package: {
version: process.env.npm_package_version,
zip: true,
author: 'Firstname Lastname',
outputFolder: path.join(__dirname, 'scorm_packages'),
description: 'A test of the course packaging module',
keywords: ['scorm', 'test', 'course'],
typicalDuration: 'PT0H5M0S',
rights: `©${new Date().getFullYear()} My Amazing Company. All right reserved.`,
vcard: {
author: 'Firstname Lastname',
org: 'My Amazing Company',
tel: '(000) 000-0000',
address: 'my address',
mail: '[email protected]',
url: 'https://mydomain.com'
}
}
};
scopackager(config, function(msg){
console.log(msg);
process.exit(0);
});
- In the scripts portion of your package.json, add the following:
"package-scorm": "node scoPackager.js"
(replace the .js file name with the name (and path) of the file containing your script from step 2) - You can now package your project for SCORM by running
npm run package-scorm
from the command line.
USE IT AS CLI
if installed globally you can use it directly in command line
$ simple-scorm-packager
or
$ scopackager