3.1.2 • Published 1 month ago

@das.laboratory/gulp-plugin-interactive v3.1.2

Weekly downloads
2
License
UNLICENSED
Repository
bitbucket
Last release
1 month ago

Big-Gulp-Logo

gulp-plugin-interactive

BigGulp makes building interactive projects, SCORM packages, uploading and live-link generation a lot easier.

The following commands are available to you through @das.laboratory/gulp-plugin-interactive on npm.

Available commands

Note: you can always list the available tasks by running gulp --tasks.

The following table lists all available commands (tasks) you can run with gulp <command> and the submodules it runs behind the scenes:

CommandRuns these submodules:
buildOnlystart, setFilePermissions, copyAll, compileSASS, joinUserefBlocks, doNotRevAllFiles, scormify, zipSCORM
buildbuildOnly + commitProject, upload, makelive
putOnlinezipSCORM, upload, makelive
makelivemakelive
uploadupload
setupsetup
zipzipSCORM

I left out submodules that don't contribute to the actual output, like cleaning up temp files or show terminal messages, etc.

Descriptions

Here is a description of what each of these submodules does:

ModuleDescription
startsets up the project (checks for interactive.json file and asks for info if not available, etc.)
setFilePermissionssets file permissions of 755 to all files in ./src
copyAllcopies all files from ./src to ./tmp folder (except .scss, .css, .js, .md, .map, package.json, LICENSE files)
compileSASScompiles all .scss files in ./src/css and its subfolders and saves resulting .css file(s) to ./src/css
joinUserefBlocksjoins all files marked in index.html with build:css and build:js comments (if the current file happens to be interactive.min.js it will run it through babel and add 'INTERACTIVE BUILD ON...' message) and puts them into ./tmp
doNotRevAllFilesshortcut to avoid 'revAllFiles' (which doesn't quite work yet but would add checksums to the name of the files, making cache problems a thing of the past) and instead simply copies all files from ./tmp to ./build
scormifyuses handlebars.js to make SCORM manifest file with list of files in ./build folder and adds schema files (removing old ones from ./build without asking)
zipSCORMzips the build folder and names the archive according to the data in interactive.json file
commitProjectchecks the local repository and if uncommitted files are found will commit them for you
uploaduploads the zipfile into a folder on the server that's named according to the project info found in interactive.json
makeliveruns a script on the server that unzips the project, turns off SCORM and video-seeking on and returns a live-link URL
setupasks for details about the project that are used for building the final package

Modules

Modules actually used by the tasks

As we can see, not many modules actually use gulp. Time to say goodbye to gulp?

FilesTypeGulpDescription
./index.jsMAINyesgulpfile.js
./modules/all.jsMODULEyesdoes the main building job
./modules/cli-style.jsMODULEhelpers for CLI stuff
./modules/css.jsMODULEyestranspile SCSS/CSS
./modules/git-commit.jsMODULEcommit project
./modules/interactive-data-parser.jsMODULEparse interactive.json
./modules/makelive.jsMODULErun makelive on server
./modules/scormify.jsMODULEadd SCORM templates to output
./modules/setup.jsMODULEsetup project
./modules/upload.jsMODULEupload project to server
./modules/utils.jsMODULEhelpers for CLI stuff
./modules/wait-for-it.jsMODULEadd delay between tasks
./modules/data/languages.jsDATAlanguage options for setup
./modules/data/output-options.jsDATAoutput options for setup

Modules not used by the tasks or experimental stuff

FilesTypeGulpDescription
./modules/examples/boxes.jsPLAYGROUNDtesting boxes
./modules/examples/lines.jsPLAYGROUNDtesting lines
./modules/chmod.jsMODULEset files permissions
./modules/js.jsMODULEyesinsert date into built interactive.js
./modules/prefixer.jsMODULEyesprefix urls
./modules/quality-assurance.jsMODULEtest project for potential problems
./modules/server.jsMODULEyeswatch/serve/reload project
./modules/weird-emoji-tests.mjsMODULEwho knows

Notes on converting to ESM

Interesting articles:

Running gulp programmatically from node script

A proof of concept can be found in ./vite-library-test. It works just fine!

But this is the gist of it:

gulpfile.js:

import gulp from 'gulp';

export const two = () => Promise.resolve(11);
export const one = gulp.series(two, () => Promise.resolve(5));

index.js:

import { one, two } from './gulpfile.js';

const resultOne = one();
const resultTwo = two();

console.log('result one: ', resultOne); // result one:  undefined
console.log('result two: ', resultTwo); // result two:  Promise { 11 }

Note: resultOne is undefined because one() is a gulp series.

This comment explains it:

"series and parallel don't return results because they have nothing to return. When invoking, you pass a callback function that passes the errors and results.

prelim(function (err, results) {
	console.log(err, results);
});

Btw, all of this is documented in the dependencies (https://github.com/gulpjs/bach in this case) but haven't been surfaced to the 4.0 docs yet (always looking for people to help!)"