Skip to content

Latest commit

 

History

History
2901 lines (2087 loc) · 128 KB

index.md

File metadata and controls

2901 lines (2087 loc) · 128 KB

Quasar - a Quick, Usable, And Simple; Application Runtime

Quasars are among the most luminous objects in the universe. Each one greatly outshines the combined output of all the stars in their host galaxies. (For instance, in 2015 astronomers announced they’d found a quasar that shines some 400 trillion times brighter than our sun.)

All large galaxies have giant black holes at their centers, and a quasar forms when one actively starts feeding, pulling in matter like gas and dust. But this stuff doesn’t fall directly into the black hole — it circles around the abyss at ever-increasing speeds while spiraling inward. Eventually, the cosmic food becomes so hot (from friction) that it pours out light before some of it makes its way into the black hole. The object that generates this prodigious amount of light — the black hole and cloud of debris swirling around it — is a quasar.

Quasar is the library that runs quasars, compiles data and debris, and produces a singular document

  • quasars are the build tasks
  • templates are the before files
  • debris are the global dependencies

Quasars can be large or small, complex or simple, and can include multiple frontend stacks. At the end of the day it is a document generator that takes input data and produces a singular output. That output is something that you might find yourself wanting to build, repeatedly, with either the same data or different data, in a predictably manner, to any destination of your choice. Quasars can support anything from entire websites to singular components used in other websites. Quasar can support JSON document generation and feed itself that JSON to create more JSON or an HTML file. Quasar can support TXT file output if you simply want to have your files ingested by something else. Quasar can deploy your resources to the cloud, or host them directly for testing purposes.

Quasar was built to facilitate the collaboration of different groups to create a singular output, for example: a sales team, a design team, an implementation team, and a QA team; the output of work from one team goes into quasar and becomes an input to the process of delivery on an item for the rest of the teams. In this example: the sales team creates a receipt from a sale, design creates assets from receipt information and provides that information in a new receipt, implementation creates the output from the receipt and assets, and QA tests the final output in a test environment (automated + human verified) and creates final receipt with the information included from all previous teams. The final receipts represent the entire product in it's raw form, and can be rebuilt over and over again. Receipts can be updated as assets change or templates change or the parameters of a sale changes, and rebuilt without having to revisit the entire process all over again. This enables small changes to be made by non-technical people, like: updating an image, updating copy, choosing a different template for the output, or changing the details of the sale.

Command Line Interface

Install Dependencies

  1. install nodejs
  2. run yarn install to install dependencies

CLI scripts

  • run bin/cli to use the cli of quasar
  • run bin/watch to automate jobs using json files in the /json folder
  • run bin/web to run an api and web server with form @ http://localhost:3000

CLI flags

--port=3000 argument to set the port number to run the application on

--runAsDaemon=true argument to run the web api or watch jobs tasks in the background

--runWebApi=true argument to run the api @ http://localhost:3000

--watchJobs=true argument to autoload json files to build quasars

--runWebform=true to run the webform @ http://localhost:3000

--autoBuildWebForm=true to build the quasarWebform task on startup

--autoBuildWebApp=true to build the quasarWebApp task on startup

--reRun=true to rebuild the last successfully run arguments back through quasar

Development

Useful CLI commands:

  • bin/dev will run bin/clean and bin/buildWebForm to build a new version of the app then bin/web so you can test quasar output from the webform.
  • bin/clean will delete the outputFolder.
  • bin/cleanOutput will delete the outputFolder.
  • bin/cleanDev will delete the local development folders and the dist folder.
  • bin/app takes the has the following default arguments that you can override the cli with --[arg]=[val] (eg: --runWebApi=true ):
defaultCliArgs = {
		port: process.env.PORT,
		runOnce: false,
		watchJobs: false,
		qType: false,
		runWebForm: false,
		autoBuildWebForm: false,
		runWebApi: false }
  • there is a .vscode/launch.json file in the repository that enables debugging of the application in vscode. You can use the above arguments in your IDE and override any of the above arguments.

Getting Started With Quasar

Install it

  1. install nodejs
  2. run yarn install to install dependencies

Use it

  • run bin/cli to use the cli of quasar
  • run bin/watch to automate jobs using json files in the /json folder
  • run bin/web to run an api and web server with form @ http://localhost:3000

Run as a process

  • run bin/cli to run the application as a process, see the Coommand Line Interface section of the documentation for flags that you can use when running the cli as a process.

Development History

0.0.1 / 2017-11-24 (Thanksgiving Day!)

  • Initial release

0.1.0 - initial refactor / 2017-11-26

  • This is basically what Quasi should have been, a more simple pipeline. The scope creep of that project really torpedo'd it, but I like the ebb and flow and how it brought me to this point. I could actually see quasar become the underlying engine for Quasi, and Quasi becoming the quasar generation tool.

0.4.0 - structure / 2017-12-09

  • This is the biggest set of functionality yet byeond the core, that brings with it a lot of breaking changes to make the core more robust. Heading towards a milestone of "0.5.0 robustness", this version introduces a more complex version of an example quasar, 'quasar-webform' that demonstrates; a precompile method, asset compiling for the html, css, and js files, accompanying files from the templates folder to be bundled as an express application complete with package.json, and other use cases not present in the more simple example, 'page' quasar. This quasar webForm is a client application that runs in the browser with a web api, in addition to the cli, [UNFINISHED]

0.5.0 - robustness / 2018-01-01

  • Description changed to "a Quick, Usable, And Simple; Application Runtime" to fit the QUASAR acronym.
  • This milestone represents a functional usage of quasar in the wild on a daily basis. From nothing to something, this milestone includes the following featureset:
    • build pipeline that globs html, js, and css files alongside imported assets and using templating to generate a single html outputFile that can be used as an Single Page Application.
    • globbed sources files can be minified on output.
    • template sourcefiles can be precompiled from the languages: mustache, sass, jsx into html, css, and javascript respectively.
    • application available as a process, a CLI app, an express webForm Application, and an express webApi; from the terminal, independently or concurrently.
    • application can be packaged into a multi-platform electron application.
    • every feature of the pipeline is available through the CLI which is the core of all functionality wrapped by the API and webForm and electron App.

0.6.0 - architecture / 2018-07-07

  • Major breaking change which now uses classes for each task, unifying core functionality across all tasks.
  • This milestone represents a shift in the direction towards true modularity and abstraction of the core components of the quasar runtime, setting this project up for a future and final refactor before 1.0:
    • lib : The static utility methods that stores no knowledge of the objects it manipulates from outside of itself. This library can be shimmed, but is not a class because it shouldn't follow inheritance rules. The core functionality of the runtime lives here. The core functionality could later be refactored into a runtime object that has awareness of QuasarTasksFactory and compiles a build pipeline usng them.
    • api : The programmable interface to the core library. This could be refactored in the future to; take all of the functionality out of this file and put it into the runtime, include only passthrough methods for the runtime and lib.
    • cli : The orchestrator of the core library and api together. This could be refactored in the future to; take all of the functionality out of this file and put it into the runtime, be an orchestrator that is command based which uses the runtime.
    • config : The configuration object that is used with each QuasarTask and in the core library. This object contains absolute paths to environment files and folders.
    • electron : The electron wrapper around the cli and api for running an electron application for the quasarWebform or quasarWebapp.
    • task : The base class for each QuasarTask which contains core functionality of a task that is run by the runtime (or build pipeline).

0.7.0 - core / 2018-09-03

  • Another breaking change, as now the core modules have been reorganized into their final v1.0.0 states. The functionality of these core modules are now locked and this version is the basis of what will become the contract with consumers. The API will evolve from here to include different use cases of the runtime as methods and will not include methods of the library directly.
  • The core modules:
    • lib : The abstracted utility methods of the runtime live here.
    • runtime : the build pipeline that processes QuasarTasks.
    • api : The programmable interface to the core library and runtime.
    • cli : The orchestrator of the api and runtime.
    • web : the express application that takes POST requests and serves the quasarWebform or quasarWebapp.
    • config : The configuration object that is used with each QuasarTask to load lib methods.
    • task : The base class for each QuasarTask that is processed by the runtime.
    • electron : The electron wrapper around the cli and api for running an electron application for the quasarWebform or quasarWebapp.

0.8.0 - programmable interface / TBD

  • The QuasarApi class functionality is now purely defined within the class and each method of the runtime is overloaded 1:1. Documentation of the API is available to built using the api-docs quasar on the scripts folder and exists in the about/scripts.md file. The API offers the following quasar build pipeline functionality to be used by quasars:
    • load and run quasars
    • log information with quasar for debugging and progress reporting
    • clean (delete) public and build folders
    • move files between quasar temporary build and public folders
    • compile assets into singular file within assets folder to be used in the outputFile
    • inject debris, required, and included files within the template files
    • download and unpack source files to assets folder
    • output to HTML, JSON, and TXT file pipeline methods
    • upload outputFiles to S3 and Dropbox

0.9.0 - webform and application / TBD

1.0.0 - Version 1 / TBD

  • Quasar Runtime and web interface is complete for the original roadmap:

    • Upload to AWS buckets
    • Express based web UI with live preview for quasar building
    • Asset compiler and bundler
    • Builder packaged as an electron application
    • Asset mutation on output (minification, tree shaking, code splitting, uglification)
    • Command line interface and bin files for local use of the runtime
    • Application Programmable Interface for use in production applicaitons as a build utility
    • Web Form interface to run quasars in a browser with a simple menu and form which use the API
    • SAAS application suite for all things Quasar including plugins that consume the API and middleware that uses the core modules.
  • Version 1 lifecycle:

    • Locked functionality across runtime and API. No new runtime methods. No new QuasarTask methods, no new external lib methods.
    • Contract with consuming developers locked at version 1 of QuasarTask base methods and fields.
    • No refactors of the architecture or core modules allowed.
    • Version will see minor and patch updates for as long as the code is being used in production environments.

Ethos

Web components should be isolated, self-contained, modular, consistent, pluggable, injectable, renderable, updatable, and testable. These things mean different, but separate, solutions for different people - but those differences between developers shouldn't hold hostage the stack and course of development in order to accomplish small website features and frontend solutions for larger applications. Data layer interactions, state management, api interactions, and the setup and teardown of components shouldn't be handled by the components themselves; this is a given.

To think that language, stack, or framework used to create a component should also dictate the implementation of the stack is limiting as well. As long as you know how to get access to the data, can make api interactions from a common core, be able to attach to global events, and have your render managed externally then you should be enabled to implement your component however you see fit. With the advent of transpilers like Babel and compilers like Sass, in addition to tools that do minification and tree shaking and code splitting, we can do a lot more to support the wide range of developer experience and comfort with different stacks and tools to build their frontends.

The architecture of view and view model separated by how data is stored and retrieved and how the combination of the two is rendered has always been littered with business rules and data processing before and after long term storage retrieval. There must be a way to separate business rules from the process of rendering and using data as we have been able to separate view from model.

Quasar is much like webpack or browserify in that it compiles code into a singular output from various resources. However, what Quasar does differently than these packages is that it provides a server for real-time rendering of templated code into singular outputs from templates developed in any sort of architecture. Quasar has no front end dependencies outside of the templates allowing developers of templates to define the stack and the user to simply input data into each build. The "build process" for quasar was my original reason for calling this a runtime and it was originally built on top of an express application using an HTML webform. The build process in Quasar comprises the following steps:

Run

Validate Required Input Arguments from the input [receipt]

Copy files from sources [local, web]

Setting additional arguments from the input using the source files [.zip files]

Injecting code associated with the template [debris]

Injecting data into the template [arguments]

Compiling all js, css, and html elements into a singular text based output [template assets]

Uploading files to the cloud [aws s3, dropbox, google]

Deploying code to endpoint [google ad manager, placements]

End

Each Quasar, a type of middleware, has a build task file and a template folder associated with it. Quasar loads these files and uses some data, like defined arguments for template data, from these files to build the webform and webapp which serve as a user interface to create Quasar build jobs. This runtime was originally developed as an express web application which uses gulp to watch a local filesystem folder for new job files (.json) created by the web api endpoint which receives the receipts as json data. The Quasar Webform and Webapp are also generated by Quasar and I have developed those two stacks on React, which can be generated on the fly when starting up the web api which serves the form (on localhost:3000).

The architecture of this platform is as follows:

The Quasar SDK - the runtime actions and tools that allow quasar developers to use any front-end stack they want to produce a singular html output that is cross-browser compatible.

The Quasar CLI - the command line interface to the SDK which can run builds and spin up the Web Api.

The Quasar Web Api - the express application which hosts and receives requests for running Quasar builds.

The Quasar Electron App - the electron application which runs the Web Api and serves the webform or webapp in an application window on OS X, Windows, or Linux.

The Quasar Lambda Function - an AWS Lambda implementation of the Quasar SDK for running builds in a serverless environment.

The Quasar Webform - a longform UI of all the inputs for each Quasar in an environment. This was the original way to use Quasar and is now more of a developer tool.

The Quasar WebApp - the platform application for the Quasar ecosystem in a scalable environment which allows users to login, manage builds step by step with a wizard, update and invalidate files uploaded to external storage, preview outputs in environments where Quasar widgets live, deploy widgets to production websites, and see usage statistics of quasars in production.

Implementation Philosophy

When writing a quasar

quasars are build tasks that associate user provided data with template files in a pipeline to produce a single text file output. The output can have dependency files associated with it, or it can be a single, self contained, piece of code.

The base class for a quasar can be overloaded for your custom specifications or used in place and extended. By default, the build pipeline will run the following methods sequentially:

validateRequiredArgs

build

cleanUp

And, by default, each of those methods will follow the build pipeline from downloading or unpacking source files, verifying and setting required data, and cleaning up after moving and staging files. The build method in the base class, by default, does not produce an outputFile as this is a scaffolding class and the logic behind an outputFile is too specific to the implementation, in most cases, to be handled dynamically.

When writing debris

debris are text based assets that are injected into quasars in an ordered fashion as they are included, or directly as comments within the quasars template files using the convention below. Debris can be the file itself or it can be a manifest that points to a file src to either be included as a tag or downloaded and replaced inline with wrapping code (.uri file). Debris do not have access to template data at build time, so they must follow the practice of creating an initializing method for templated data to pass params to if they are needed.

To require or include debris in your template files use the following convention. A file that is included with require will only be included if it has not been included before. Files included with include will always be included.

//=require vendor/**/*.js

//=require relative/path/to/file.js

/*=include relative/path/to/file.css */

<!--=include relative/path/to/file.html -->

When writing a template

templates are the target files for each quasar build and can comprise the entire source of the quasar build or be partial components that wrap external sources for the desired output. Data is injected into template files during build time following the convention.

Template files can be lodash or _ (underscore) templates and data is typically inserted in that way. These templating methods can be used in any template file type (js, css, html).

Roadmap

1.0.0

Features

  • Upload to AWS buckets
  • Express based web UI with live preview for quasar building
  • Plugin architecture allows for a common extending of each component
  • Asset compiler and bundler
  • Builder packaged as an electron application
  • Asset mutation on output (minification, tree shaking, code splitting, uglification)

Classes

QuasarApiQuasarRuntime

The API wrapper around the quasar runtime.

QuasarCli

Processes command line arguments to run quasar runtime methods.

QuasarConfig

Contains the path information for loading quasar files.

DTQuasarTaskQuasarTask

A quasar task with Digital Trends specific business logic

QuasarElectronApp

Runs the QuasarWebApp in an electron window

QuasArgs

The default quasArgs object used in quasar builds.

QuasarRuntime

The quasar Runtime [use the quasar API, not this class directly].

QuasarTask

A task that can be run by the quasar runtime API.

QuasarWebApp

The web application for running the quasar API and webform.

QuasarApi ⇐ QuasarRuntime

The API wrapper around the quasar runtime.

Kind: global class
Extends: QuasarRuntime
Export:

quasarApi.config : QuasarConfig

Kind: instance property of QuasarApi

quasarApi.cleanDevFolders(quasArgs) ⇒ promise

cleans local files in the application root for development testing

Kind: instance method of QuasarApi
Overrides: cleanDevFolders

Param Type
quasArgs QuasArgs

quasarApi.cleanOutputFolders(quasArgs, [allFolders]) ⇒ promise

deletes the contents of the output root folder and all subdirectories

Kind: instance method of QuasarApi
Overrides: cleanOutputFolders

Param Type Default
quasArgs QuasArgs
[allFolders] boolean false

quasarApi.cleanAssetsFolder(quasArgs, subdirectory) ⇒ promise

deletes the contents of the assets folder for this quasar

Kind: instance method of QuasarApi
Overrides: cleanAssetsFolder

Param Type
quasArgs QuasArgs
subdirectory string

quasarApi.compileScriptsToAssetsFolder(quasArgs, files, outputFilename) ⇒ promise

Compiles jsx templates in the templates folder and outputs the targetFile into the assets folder.

Kind: instance method of QuasarApi
Overrides: compileScriptsToAssetsFolder
Returns: promise - gulp chain

Param Type Description
quasArgs QuasArgs
files array | string gulp src input
outputFilename string

quasarApi.compileStylesToAssetsFolder(quasArgs, files, outputFilename) ⇒ promise

Compiles sass templates in the templates folder, using json files for data input which mirror the input filenames, and outputs the targetFile into the assets folder.

Kind: instance method of QuasarApi
Overrides: compileStylesToAssetsFolder
Returns: promise - gulp chain

Param Type Description
quasArgs QuasArgs
files array | string gulp src input
outputFilename string

quasarApi.compileTargetFileToAssetsFolder(quasArgs) ⇒ promise

compiles mustache templates in the templates folder, using json files for data input which mirror the input filenames, and outputs the targetFile into the assets folder.

Kind: instance method of QuasarApi
Overrides: compileTargetFileToAssetsFolder
Returns: promise - gulp chain

Param Type
quasArgs QuasArgs

quasarApi.copyFilesFromAssetsFolderToOutput(quasArgs, files, excludeFiles) ⇒ promise

copies files from the assets folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyFilesFromAssetsFolderToOutput

Param Type
quasArgs QuasArgs
files *
excludeFiles *

quasarApi.copyFilesFromSourcesFolderToOutput(quasArgs, [files], [excludeFiles]) ⇒ promise

copies files the sources folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyFilesFromSourcesFolderToOutput

Param Type Default
quasArgs QuasArgs
[files] *
[excludeFiles] * []

quasarApi.copyFilesFromTemplatesFolderToAssetsFolder(quasArgs, files, [excludeFiles]) ⇒ promise

copies files from the templates folder to the assets folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyFilesFromTemplatesFolderToAssetsFolder

Param Type Default
quasArgs QuasArgs
files *
[excludeFiles] * []

quasarApi.copyFilesFromTemplatesFolderToOutput(quasArgs, files, [excludeFiles]) ⇒ promise

copies files from the templates folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyFilesFromTemplatesFolderToOutput

Param Type Default
quasArgs QuasArgs
files *
[excludeFiles] * []

quasarApi.copyFilesToOutputFolder(quasArgs, fromDirectory, files, [excludeFiles]) ⇒ promise

copies files from a directory to the output folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyFilesToOutputFolder

Param Type Default
quasArgs QuasArgs
fromDirectory *
files *
[excludeFiles] * []

quasarApi.copyTemplateFilesToAssetsPath(quasArgs) ⇒ promise

copies files from the templates folder to the assets folder given the quasArgs folder information

Kind: instance method of QuasarApi
Overrides: copyTemplateFilesToAssetsPath

Param Type
quasArgs QuasArgs

quasarApi.debug(message, obj, condition)

makes a call to log and is used as a canary for testing

Kind: instance method of QuasarApi
Overrides: debug

Param Type
message string
obj object
condition string

quasarApi.downloadFileFromUrlToSourcesFolder(quasArgs, url) ⇒ promise

downloads source files from a url into the sources folder to be used at build time

Kind: instance method of QuasarApi
Overrides: downloadFileFromUrlToSourcesFolder

Param Type
quasArgs QuasArgs
url string

quasarApi.downloadSourceFilesToSourcesFolder(quasArgs) ⇒ promise

downloads source files from a url into the sources folder to be used at build time

Kind: instance method of QuasarApi
Overrides: downloadSourceFilesToSourcesFolder

Param Type
quasArgs QuasArgs

quasarApi.findTargetFile(quasArgs, nextPath, originalPath, exhausted) ⇒ string

searches for a target file in the various available folders by name, qType, oType, and extension until it finds one

Kind: instance method of QuasarApi
Overrides: findTargetFile

Param Type
quasArgs QuasArgs
nextPath string
originalPath string
exhausted string

quasarApi.getAvailableSourceFilenames(quasArgs) ⇒ array

gets the filenames of the source extension type from the sources folder

Kind: instance method of QuasarApi
Overrides: getAvailableSourceFilenames
Returns: array - list of filenames from sources folder

Param Type
quasArgs QuasArgs

quasarApi.getAvailableDebrisFilenames(quasArgs) ⇒ array

gets the debris filenames from the debris folder

Kind: instance method of QuasarApi
Overrides: getAvailableDebrisFilenames
Returns: array - list of filenames from debris folder

Param Type
quasArgs QuasArgs

quasarApi.getAvailableTaskNames() ⇒ array

gets an array of the loaded task names

Kind: instance method of QuasarApi
Overrides: getAvailableTaskNames

quasarApi.getQuasarOutputPath([quasArgs]) ⇒ string

gets the outputPath for quasars

Kind: instance method of QuasarApi
Overrides: getQuasarOutputPath

Param Type Default
[quasArgs] QuasArgs {}

quasarApi.getTaskNames([dir]) ⇒ array

gets the task names from the tasks folder

Kind: instance method of QuasarApi
Overrides: getTaskNames

Param Type Default
[dir] string null

quasarApi.getTasksAssociatedByOutputType(taskNames, [orderByQuasar]) ⇒ object

gets task names associated with the oType field

Kind: instance method of QuasarApi
Overrides: getTasksAssociatedByOutputType

Param Type Default
taskNames array
[orderByQuasar] boolean false

quasarApi.injectCode(quasArgs) ⇒ object

Injects asset file references into the output file in the assets folder.

Kind: instance method of QuasarApi
Overrides: injectCode
Returns: object - the quasargs used

Param Type
quasArgs QuasArgs

quasarApi.injectDebrisFilesIntoStream(quasArgs, contents, [minify]) ⇒ stream

Injects require statements for debris.

Kind: instance method of QuasarApi
Overrides: injectDebrisFilesIntoStream
Returns: stream - the stream written to

Param Type Default
quasArgs QuasArgs
contents stream
[minify] boolean false

quasarApi.injectRequiredFilesIntoStream(quasArgs, contents) ⇒ stream

Injects require statements for the default asset files (css and js).

Kind: instance method of QuasarApi
Overrides: injectRequiredFilesIntoStream
Returns: stream - the stream written to

Param Type
quasArgs QuasArgs
contents stream

quasarApi.loadTasks(taskPaths, [loadDefaults], [clobber]) ⇒ array

loads the quasar tasks into the gulp taskList

Kind: instance method of QuasarApi
Overrides: loadTasks
Returns: array - the tasks loaded

Param Type Default
taskPaths array
[loadDefaults] boolean false
[clobber] boolean true

quasarApi.logArgsToFile(quasArgs, [toStatus], [overwite]) ⇒ QuasArgs

writes the args to file with the status passed in

Kind: instance method of QuasarApi
Overrides: logArgsToFile

Param Type Default
quasArgs QuasArgs
[toStatus] string null
[overwite] boolean false

quasarApi.logBuildQueued(quasArgs) ⇒ QuasArgs

logs quasArgs to the jobFile

Kind: instance method of QuasarApi
Overrides: logBuildQueued
Returns: QuasArgs - the quasargs logged with updated argsFile entry

Param Type
quasArgs QuasArgs

quasarApi.logCritical(message, obj, color)

ogs a critical message

Kind: instance method of QuasarApi
Overrides: logCritical

Param Type
message string
obj object
color color

quasarApi.logData(message, obj, color)

Logs a data message

Kind: instance method of QuasarApi
Overrides: logData

Param Type
message string
obj object
color color

quasarApi.logEnd(message, obj, color)

Logs an end message

Kind: instance method of QuasarApi
Overrides: logEnd

Param Type
message string
obj object
color color

quasarApi.logError(message, obj, color)

Logs an error message

Kind: instance method of QuasarApi
Overrides: logError

Param Type
message string
obj object
color color

quasarApi.logInfo(message, obj, color)

Logs an info message (default)

Kind: instance method of QuasarApi
Overrides: logInfo

Param Type
message string
obj object
color color

quasarApi.logSuccess(message, obj, color)

Logs a success message

Kind: instance method of QuasarApi
Overrides: logSuccess

Param Type
message string
obj object
color color

quasarApi.makePromptRequired() ⇒ function

used with inquirer questions to ensure that values entered have a length

Kind: instance method of QuasarApi
Overrides: makePromptRequired

quasarApi.makePromptRequiredAndSanitary() ⇒ function

used with inquirer questions to ensure that values entered from the CLI follow the required ruleset

Kind: instance method of QuasarApi
Overrides: makePromptRequiredAndSanitary

quasarApi.moveTargetFilesToRootOfAssetsPath(quasArgs) ⇒ promise

moves the target html, js, and css files to the assetsFolder

Kind: instance method of QuasarApi
Overrides: moveTargetFilesToRootOfAssetsPath

Param Type
quasArgs QuasArgs

quasarApi.outputToHtmlFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as HTML.

Kind: instance method of QuasarApi
Overrides: outputToHtmlFile
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarApi.outputToJsonFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as JSON.

Kind: instance method of QuasarApi
Overrides: outputToJsonFile
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarApi.outputToTextFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as TXT.

Kind: instance method of QuasarApi
Overrides: outputToTextFile
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarApi.promptConsole(questions, getResults, [showOptional], [optionalOnly]) ⇒ promise

prompts the terminal with questions

Kind: instance method of QuasarApi
Overrides: promptConsole
Returns: promise - the promise of a prompt of the user to the command line interface

Param Type Default Description
questions array the questions to ask the user
getResults function callback after prompt has completed
[showOptional] boolean false
[optionalOnly] boolean

quasarApi.runFromArgsFile(qType, argsFile)

spawns a task to run a quasar from quasArgs saved in a json file.

Kind: instance method of QuasarApi
Overrides: runFromArgsFile

Param Type
qType *
argsFile *

quasarApi.runLastSuccessfulBuild([quasArgs]) ⇒ promise

runs the last successfully recorded argsFile

Kind: instance method of QuasarApi
Overrides: runLastSuccessfulBuild
Returns: promise - resolves to the QuasArgs used

Param Type Default
[quasArgs] QuasArgs

quasarApi.runQuasar(quasar, [quasArgs], registerTask, end) ⇒ promise

Runs a quasar build task

Kind: instance method of QuasarApi
Overrides: runQuasar

Param Type Default Description
quasar string name of the quasar to run
[quasArgs] QuasArgs {}
registerTask bool whether or not to register the quasar with gulp
end function the callback for when the task has completed

quasarApi.unpackSourceFiles(quasArgs, subDirectory) ⇒ promise

unzips or moves source files to the assets folder

Kind: instance method of QuasarApi
Overrides: unpackSourceFiles

Param Type Description
quasArgs QuasArgs
subDirectory string the subdirectory of the assets folder to place the source files

quasarApi.uploadOutputFiles(quasArgs, [excludeFiles]) ⇒ promise

Uploads output files to Amazon S3.

Kind: instance method of QuasarApi
Overrides: uploadOutputFiles

Param Type Default
quasArgs QuasArgs
[excludeFiles] array []

quasarApi.uploadOutputFileAsTxt(quasArgs) ⇒ promise

Uploads the outputFile to Amazon S3.

Kind: instance method of QuasarApi
Overrides: uploadOutputFileAsTxt

Param Type
quasArgs QuasArgs

quasarApi.uploadOutputFileWithMetadata(quasArgs) ⇒ promise

Uploads the outputFile to Amazon S3.

Kind: instance method of QuasarApi
Overrides: uploadOutputFileWithMetadata

Param Type
quasArgs QuasArgs

QuasarCli

Processes command line arguments to run quasar runtime methods.

Kind: global class
Export:

quasarCli.app

returns the application attached to the CLI

Kind: instance property of QuasarCli
Read only: true

quasarCli.applicationRoot

the absolute path to the application root

Kind: instance property of QuasarCli
Read only: true

quasarCli.jobsFolder

the absolute path to the jobs folder

Kind: instance property of QuasarCli
Read only: true

quasarCli.outputRoot

the absolute path to the output root folder

Kind: instance property of QuasarCli
Read only: true

quasarCli.getJobError(jobFile) ⇒ string

extracts the error from the jobfile

Kind: instance method of QuasarCli

Param Type Description
jobFile string the jobFile path

quasarCli.init([appRoot], [outRoot])

creates the application job folders and sets initial vars

Kind: instance method of QuasarCli

Param Type Default
[appRoot] * process.cwd()
[outRoot] string "`${os.homedir()}/Documents/quasar/`"

quasarCli.packageIntoElectronApp() ⇒ promise

runs electron-packager on the applicationRoot and uses the electron.js file for driving the application

Kind: instance method of QuasarCli
Summary: [INCOMPLETE]
Returns: promise - gulp chain

quasarCli.processArgsFile(argsFile, data)

processes a job file and kicks off a build from those args

Kind: instance method of QuasarCli

Param Type Description
argsFile string the path to the argsfile to process
data *

quasarCli.quasarSelectPrompt(tasks) ⇒ promise

prompts the user from the command line with the given tasks

Kind: instance method of QuasarCli

Param Type Description
tasks QuasarTask defaults to available tasks

quasarCli.run([args]) ⇒ promise

runs the command from the arguments passed in from the command line and invocation

Kind: instance method of QuasarCli

Param Type Default
[args] object {}

quasarCli.runProcess(args, resolve, reject) ⇒ promise

runs the arguments as a single batch process

Kind: instance method of QuasarCli

Param Type
args object
resolve function
reject function

quasarCli.spawnElectronApp()

spawns a new instance of electron from the applicationRoot folder

Kind: instance method of QuasarCli

quasarCli.spawnWebApp() ⇒ boolean

spawns the web app and web api in an express application

Kind: instance method of QuasarCli
Returns: boolean - whether or not the web app was successfully run

quasarCli.spawnWebForm() ⇒ boolean

spawns the web form and web api in an express application

Kind: instance method of QuasarCli
Returns: boolean - whether or not the web form was successfully run

quasarCli.watchJobs()

watches the jobs created folder for new files created and process the argsFile as a new quasar build

Kind: instance method of QuasarCli

QuasarConfig

Contains the path information for loading quasar files.

Kind: global class
Export:

quasarConfig.applicationRoot ⇒ string

the absolute path of the application

Kind: instance property of QuasarConfig
Returns: string - application root path
Read only: true

quasarConfig.assetsFolder ⇒ string

the absolute path of the assets folder

Kind: instance property of QuasarConfig
Returns: string - assets folder path
Read only: true

quasarConfig.debrisFolder ⇒ string

the absolute path of the debris folder

Kind: instance property of QuasarConfig
Returns: string - debris folder path
Read only: true

quasarConfig.jobsFolder ⇒ string

the absolute path of the jobs folder

Kind: instance property of QuasarConfig
Returns: string - jobs folder path
Read only: true

quasarConfig.node_modules ⇒ string

the absolute path of the node_modules folder

Kind: instance property of QuasarConfig
Returns: string - node_modules folder path
Read only: true

quasarConfig.outputFolder ⇒ string

the absolute path of the output folder

Kind: instance property of QuasarConfig
Returns: string - output folder path
Read only: true

quasarConfig.quasarsFolder ⇒ string

the absolute path of the quasars folder

Kind: instance property of QuasarConfig
Returns: string - quasars folder path
Read only: true

quasarConfig.sourcesFolder ⇒ string

the absolute path of the sources folder

Kind: instance property of QuasarConfig
Returns: string - sources folder path
Read only: true

quasarConfig.tasks ⇒ array

an array of tasks for this configuration

Kind: instance property of QuasarConfig
Returns: array - list of tasks
Read only: true

quasarConfig.tasks

sets the list of tasks for this configuration

Kind: instance property of QuasarConfig

Param Type
tasks array

quasarConfig.templatesFolder ⇒ string

the absolute path of the templates folder

Kind: instance property of QuasarConfig
Returns: string - templates folder path
Read only: true

quasarConfig.init(applicationRoot, [outputRoot])

initializes the configuration values from an applicationRoot which defaults to the running process location

Kind: instance method of QuasarConfig

Param Type Default Description
applicationRoot string defaults to the running process location
[outputRoot] string null the output root location

DTQuasarTask ⇐ QuasarTask

A quasar task with Digital Trends specific business logic

Kind: global class
Extends: QuasarTask
Export:

dtQuasarTask.getDefaultQuasarQuestions() ⇒ array

returns a list of default prompts for a quasar.

Kind: instance method of DTQuasarTask
Overrides: getDefaultQuasarQuestions
Returns: array - list of default prompts

dtQuasarTask.resolveQuasArgs([args])

sets digital trends specific quasArgs data.

Kind: instance method of DTQuasarTask
Overrides: resolveQuasArgs

Param Type Default
[args] QuasArgs {}

dtQuasarTask.build() ⇒ promise

Builds the quasar into a single outputFile.

Kind: instance method of DTQuasarTask
Returns: promise - the build promise chane

dtQuasarTask.cleanUp()

deletes the assets folder and any other temporary build files

Kind: instance method of DTQuasarTask

dtQuasarTask.getQuasarPrompts() ⇒ array

retrieves the list of inquirer questions to ask the user

Kind: instance method of DTQuasarTask
Returns: array - array of questions
See: https://www.npmjs.com/package/inquirer#questions

dtQuasarTask.promptUser() ⇒ promise

prompts the user from the CLI to get the QuasArgs

Kind: instance method of DTQuasarTask
Returns: promise - prompt promise

dtQuasarTask.registerRequiredQuasArgs([requiredArgs], [optionalRequiredArgs], [clobber])

adds required and optional defined arguments, and the defaults, within the quasArgs

Kind: instance method of DTQuasarTask
Summary: This method expects that the second parameter requiredArgs is an array of objects with the same structure as inquirer's .prompt questions parameter
See: https://www.npmjs.com/package/inquirer#questions

Param Type Default
[requiredArgs] array []
[optionalRequiredArgs] array []
[clobber] boolean true

dtQuasarTask.registerTasks()

register the build tasks for this quasar

Kind: instance method of DTQuasarTask

dtQuasarTask.run([args]) ⇒ promise

Runs the quasar through validation, build, then cleanup.

Kind: instance method of DTQuasarTask

Param Type Default
[args] QuasArgs {}

dtQuasarTask.setConfig(_config, [applicationRoot], [force])

sets the configuration values from the quasar runtime

Kind: instance method of DTQuasarTask

Param Type Default
_config QuasarConfig
[applicationRoot] String process.cwd()
[force] boolean false

dtQuasarTask.setDefaultQuasArgs(qType, [additionalArgs]) ⇒ QuasArgs

sets the default quasArgs including command line arguments in order of priority from: QuasArgs class, additionalArgs param, cliArgs, loaded from file

Kind: instance method of DTQuasarTask

Param Type Default
qType string
[additionalArgs] object {}

dtQuasarTask.setSourceAndOutputPlusArgs([args])

sets the default values of the source and output arguments from user input

Kind: instance method of DTQuasarTask

Param Type Default
[args] QuasArgs {}

dtQuasarTask.setSourceQuaArgsFromSourceFiles(map, defaultKey)

unpacks source files and sets quasArg values using the regex map passed in

Kind: instance method of DTQuasarTask

Param Type
map object
defaultKey string

dtQuasarTask.validateRequiredArgs([args]) ⇒ promise

sets args from quasar form data and runs validation on the final fields

Kind: instance method of DTQuasarTask
Returns: promise - resolves to true if validation is successful

Param Type Default
[args] QuasArgs {}

QuasarElectronApp

Runs the QuasarWebApp in an electron window

Kind: global class
Export:

quasarElectronApp.createWindow([title], [htmlContent]) ⇒ BrowserWindow

creates an electron window

Kind: instance method of QuasarElectronApp

Param Type Default
[title] string "'quasar'"
[htmlContent] string null

quasarElectronApp.electrify() ⇒ BrowserWindow

runs the quasar cli to watch the jobs folder, then creates the app window

Kind: instance method of QuasarElectronApp

quasarElectronApp.getIconFilePath([rootPath], [iconName], [iconExt]) ⇒ BrowserWindow

returns the path to the icon file

Kind: instance method of QuasarElectronApp

Param Type Default
[rootPath] string "appRoot"
[iconName] string "'icon'"
[iconExt] string "'.ico'"

quasarElectronApp.runElectron()

Creates an electron app and sets it up to run quasar

Kind: instance method of QuasarElectronApp

quasarElectronApp.showErrorWindow(error) ⇒ BrowserWindow

creates a window with the content of an error for debugging purposes

Kind: instance method of QuasarElectronApp

Param Type
error *

QuasArgs

The default quasArgs object used in quasar builds.

Kind: global class
Export:

quasArgs.qType : string

This is the main field of a quasar and is used in many places and used to infer build task and template files

Kind: instance property of QuasArgs
Summary: the quasar type

quasArgs.domain : string

This field could be used to designate builds between different pages, or to represent different data types. In the end, it's up to the implementation as to how this is relevant.

Kind: instance property of QuasArgs
Summary: the namespace or global name of the quasar
Example

(the name of a company) 'Toyota'

quasArgs.signature : string

This field is more granular than the field before it, domain, and represents a more specific identifier for something lik a region or position in a document.

Kind: instance property of QuasArgs
Summary: the id or build name of the quasar
Example

(the name of a product) 'Tacoma'

quasArgs.buildUser : string

This field defaults to the machine hostname

Kind: instance property of QuasArgs
Summary: the name of the user who initiated the build

quasArgs.target : string

This field tells quasar to look when targeting a file for a build. If left blank, this will be inferred from the qType variable and fallback to any .html quasar can find between the templates folder and the assets folder.

Kind: instance property of QuasArgs
Summary: the main file to target when building the quasar

quasArgs.status : string

This field changes as the quasar moves through each phase of the build

Kind: instance property of QuasArgs
Summary: the status of the build of quasar
Default: "'created'"
Example

[ 'created', 'queued', 'completed', 'failed' ]

quasArgs.jobTimestamp : string

This field also serves as specific job identifier for the assets folder and can be used to version the output

Kind: instance property of QuasArgs
Summary: the timestamp of the build
Default: "Date.now()"

quasArgs.outputFolder : string

This path is where quasar outputs are saved once the build has finished.

Kind: instance property of QuasArgs
Summary: The absolute path to the output folder
Example

`/${publicFolder}/${domain}/${signature}`

quasArgs.sourcesFolder : string

This path is where sources are downloaded to and pulled from during build time.

Kind: instance property of QuasArgs
Summary: The absolute path to the sources folder

quasArgs.jobsFolder : string

This path is where quasArgs are saved as the build moves through the each status of the build.

Kind: instance property of QuasArgs
Summary: The absolute path to the jobs folder

quasArgs.debrisFolder : string

This path is where quasArgs are saved as the build moves through the each status of the build.

Kind: instance property of QuasArgs
Summary: The absolute path to the debris folder

quasArgs.templatesFolder : string

This path is where quasar gets the template files for the build. This field looks for a folder with the name of the qType.

Kind: instance property of QuasArgs
Summary: The absolute path to the sources folder
Default: "`${args.config.templatesFolder}/${this.qType}`"

quasArgs.assetsFolder : string

This path is where quasar puts the template files for the build to stage for output. Files in this folder are modified ahead of build time and then data from both the quasArgs set by the user are piped into the template files.

Kind: instance property of QuasArgs
Summary: The absolute path to the assets folder
Default: "`${args.config.assetsFolder}/${this.qType}`"

quasArgs.targetFilePath : string

This field is used at build time and cannot be set by the user.

Kind: instance property of QuasArgs
Summary: the full filename of the target
Default: "`${this.qType}.html`"

quasArgs.argsFile : string

This field is used at build time and cannot be set by the user.

Kind: instance property of QuasArgs
Summary: the asbolute path to the jobfile which is saved into the jobs folder under the status
Default: "`${this.jobsFolder}/${this.status}/${this.qType}_${this.jobTimestamp}.json`"

quasArgs.targetEnvironments : array

This field is used to designate a quasar's intended output to differentiate it between a build of the same type used between different use cases only by the environment it is in.

Kind: instance property of QuasArgs
Summary: the acronyms of each environment where this quasar will live

quasArgs.cliArgs : map

Kind: instance property of QuasArgs
Summary: the arguments that the quasar has been run with from the CLI

quasArgs.runArgs : map

Kind: instance property of QuasArgs
Summary: the arguments that the quasar has been run with from the CLI with a jobFile

quasArgs.sourceFileRegexMaps : map

Kind: instance property of QuasArgs
Summary: the regex maps to required args for inferring sourceFile assets

quasArgs.debris : array

This field is a list of js or css files to inject into the output. The contents of the files are piped into script or style tags depending on the file type. Debris are piped into the file only once.

Kind: instance property of QuasArgs
Summary: the list of debris to require with this quasar build.

quasArgs.requiredArgs : array

This field is used with the inquirerjs node package and follows the structure of 'questions'.

Kind: instance property of QuasArgs
Summary: the args that the user can set from a UI.
See: https://github.com/SBoudrias/Inquirer.js/
Example

const questions = [{
				type: 'input',
				name: 'domain',
				shortMessage: 'Domain',
				message: 'Enter the name of the domain to be used in building assets:',
				required: true,
			}];

quasArgs.dbFolder : string

Kind: instance property of QuasArgs
Summary: the name of the folder to upload to when uploading files to Dropbox.

quasArgs.bucket : string

Kind: instance property of QuasArgs
Summary: the name of the bucket to upload to when uploading files to Amazon AWS S3.

quasArgs.logFile : string

If this field is populated then critical level logs will also be saved to the file specified

Kind: instance property of QuasArgs
Summary: the file to log outputs to
Default: "'.log'"

quasArgs.sourceExt : string

This field is appended to the source name when seeking to unpack or copy source files to the assets folder

Kind: instance property of QuasArgs
Summary: the extension of the source file
Default: "'.zip'"

quasArgs.outputExt : string

This field is appended to the outputFile name when building the output.

Kind: instance property of QuasArgs
Summary: the extension of the outputFile
Default: "'.html'"

quasArgs.cdnUrlStart : string

This

Kind: instance property of QuasArgs
Summary: the
Default: "'https=//cdn.com/'"

quasArgs.cssInjectTargets : Array.<string>

These tags are used to search the outputFile and insert default css files found in the template

Kind: instance property of QuasArgs
Summary: a list of the targets for pre and post injection of style tags

quasArgs.jsInjectTargets : Array.<string>

These tags are used to search the outputFile and insert default js files found in the template

Kind: instance property of QuasArgs
Summary: a list of the targets for pre and post injection of script tags

quasArgs.outputVersion : int

This field is not used unless there is another file found with the same id, in which case _${++outputVersion} is appended to the outputFile name.

Kind: instance property of QuasArgs
Summary: the version number to append to the end of a file

quasArgs.uploadOutputFileAsTxtFile : boolean

This will use the Dropbox credentials found in a .config file.

Kind: instance property of QuasArgs
Summary: upload the outputFile to Dropbpx as a .txt file
Default: false

quasArgs.uploadToS3 : boolean

This will use the Amazon AWS IAM credentials found in a .config file.

Kind: instance property of QuasArgs
Summary: upload files to S3 using the domain and signature fields into the destination set in the bucket field.
Default: false

quasArgs.unpackSourceFiles : boolean

This field is mostly used for testing purposes.

Kind: instance property of QuasArgs
Summary: this will flag whether or not to unpack (unzip) the source file
Default: true

quasArgs.minifyScripts : boolean

This field is used at build time to flag whether or not to run minification strategies on injected script files.

Kind: instance property of QuasArgs
Summary: run minification on script files injected
Default: false

quasArgs.minifyStyles : boolean

This field is used at build time to flag whether or not to run minification strategies on injected style files.

Kind: instance property of QuasArgs
Summary: run minification on style files injected
Default: false

quasArgs.minifyHtml : boolean

This field is used at build time to flag whether or not to run minification strategies on the outputFile.

Kind: instance property of QuasArgs
Summary: run minification on html output
Default: false

quasArgs.overwriteUnpackDestination : boolean

This field determines whether or not to preserve or destroy an existing outputFile when copying files to the assets folder during the unpacking of source files.

Kind: instance property of QuasArgs
Summary: overwrite existing assets folder contents on unpack
Default: false

quasArgs.overwriteTargetFileFromTemplate : boolean

This field determines whether or no to override an existing file at the targetFilePath with the file ${qType}.html from the templates folder.

Kind: instance property of QuasArgs
Summary: overwrite the targetFile using the template file
Default: true

quasArgs.cleanUpTargetFileTemplate : boolean

This is a debug field which, if set, will have quasar delete the targetFile after it has been used in the build.

Kind: instance property of QuasArgs
Summary: delete the targetFile
Default: false

quasArgs.useJobTimestampForBuild : boolean

This field, if set, will append the jobTimestamp to assets to ensure uniqueness of the build.

Kind: instance property of QuasArgs
Summary: append the jobTimestamp to the assetsFolder and asset files
Default: true

quasArgs.buildCompletedSuccessfully : boolean

This field is used by the runtime and set upon successful build before outputting the args to file.

Kind: instance property of QuasArgs
Summary: denotes whether or not these quasArgs have been put through a build and have succeeded
Default: false

quasArgs.excludeOutputFileFromUpload : boolean

This is mostly a debug field which allows quasar to not upload the outputFile.

Kind: instance property of QuasArgs
Summary: exclude the outputFile from uploading to Amazon AWS S3
Default: false

quasArgs.wrapInHtmlTags : boolean

This field denotes whether or not the output should be wrapped in html tags.

Kind: instance property of QuasArgs
Summary: wrap the outputFile in html tags
Default: true

quasArgs.versionOutputFile : boolean

This field tells quasar to append the version number to the outputFile if a file exists already with that name in the outputFolder.

Kind: instance property of QuasArgs
Summary: append the version to the outputFile, if one already exists with that name
Default: true

quasArgs.debugAssetsFolder : boolean

This is a debug field that allows a dev to analyze what state the assets files were in before injection and build.

Kind: instance property of QuasArgs
Summary: debug flag for the files used as templates for the build
Default: false

QuasarRuntime

The quasar Runtime [use the quasar API, not this class directly].

Kind: global class
Requires: module:gulp, module:gulp-template, module:gulp-rename, module:gulp-inject-string, module:gulp-insert, module:gulp-concat, module:gulp-flatmap, module:gulp-mustache, module:gulp-clean-css, module:gulp-include, module:gulp-html-beautify, module:gulp-browserify, module:gulp-babel, module:gulp-s3-upload, module:gulp-dropbox, module:gulp-download-files
Export:

new QuasarRuntime()

the build pipeline of the quasar framework

quasarRuntime.config : QuasarConfig

Kind: instance property of QuasarRuntime

quasarRuntime.cleanDevFolders(quasArgs) ⇒ promise

cleans local files in the application root for development testing

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

quasarRuntime.cleanOutputFolders(quasArgs, [allFolders]) ⇒ promise

deletes the contents of the output root folder and all subdirectories

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
[allFolders] boolean false

quasarRuntime.cleanAssetsFolder(quasArgs, subdirectory) ⇒ promise

deletes the contents of the assets folder for this quasar

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs
subdirectory string

quasarRuntime.compileScriptsToAssetsFolder(quasArgs, files, outputFilename) ⇒ promise

Compiles jsx templates in the templates folder and outputs the targetFile into the assets folder.

Kind: instance method of QuasarRuntime
Returns: promise - gulp chain

Param Type Description
quasArgs QuasArgs
files array | string gulp src input
outputFilename string

quasarRuntime.compileStylesToAssetsFolder(quasArgs, files, outputFilename) ⇒ promise

Compiles sass templates in the templates folder, using json files for data input which mirror the input filenames, and outputs the targetFile into the assets folder.

Kind: instance method of QuasarRuntime
Returns: promise - gulp chain

Param Type Description
quasArgs QuasArgs
files array | string gulp src input
outputFilename string

quasarRuntime.compileTargetFileToAssetsFolder(quasArgs) ⇒ promise

compiles mustache templates in the templates folder, using json files for data input which mirror the input filenames, and outputs the targetFile into the assets folder.

Kind: instance method of QuasarRuntime
Returns: promise - gulp chain

Param Type
quasArgs QuasArgs

quasarRuntime.copyFilesFromAssetsFolderToOutput(quasArgs, files, excludeFiles) ⇒ promise

copies files from the assets folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs
files *
excludeFiles *

quasarRuntime.copyFilesFromSourcesFolderToOutput(quasArgs, [files], [excludeFiles]) ⇒ promise

copies files the sources folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
[files] *
[excludeFiles] * []

quasarRuntime.copyFilesFromTemplatesFolderToAssetsFolder(quasArgs, files, [excludeFiles]) ⇒ promise

copies files from the templates folder to the assets folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
files *
[excludeFiles] * []

quasarRuntime.copyFilesFromTemplatesFolderToOutput(quasArgs, files, [excludeFiles]) ⇒ promise

copies files from the templates folder to the output folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
files *
[excludeFiles] * []

quasarRuntime.copyFilesToOutputFolder(quasArgs, fromDirectory, files, [excludeFiles]) ⇒ promise

copies files from a directory to the output folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
fromDirectory *
files *
[excludeFiles] * []

quasarRuntime.copyTemplateFilesToAssetsPath(quasArgs) ⇒ promise

copies files from the templates folder to the assets folder given the quasArgs folder information

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

quasarRuntime.debug(message, obj, condition)

makes a call to log and is used as a canary for testing

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
condition string

quasarRuntime.downloadFileFromUrlToSourcesFolder(quasArgs, url) ⇒ promise

downloads source files from a url into the sources folder to be used at build time

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs
url string

quasarRuntime.downloadSourceFilesToSourcesFolder(quasArgs) ⇒ promise

downloads source files from a url into the sources folder to be used at build time

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

quasarRuntime.findTargetFile(quasArgs, nextPath, originalPath, exhausted) ⇒ string

searches for a target file in the various available folders by name, qType, oType, and extension until it finds one

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs
nextPath string
originalPath string
exhausted string

quasarRuntime.getAvailableSourceFilenames(quasArgs) ⇒ array

gets the filenames of the source extension type from the sources folder

Kind: instance method of QuasarRuntime
Returns: array - list of filenames from sources folder

Param Type
quasArgs QuasArgs

quasarRuntime.getAvailableDebrisFilenames(quasArgs) ⇒ array

gets the debris filenames from the debris folder

Kind: instance method of QuasarRuntime
Returns: array - list of filenames from debris folder

Param Type
quasArgs QuasArgs

quasarRuntime.getAvailableTaskNames() ⇒ array

gets an array of the loaded task names

Kind: instance method of QuasarRuntime

quasarRuntime.getQuasarOutputPath([quasArgs]) ⇒ string

gets the outputPath for quasars

Kind: instance method of QuasarRuntime

Param Type Default
[quasArgs] QuasArgs {}

quasarRuntime.getTaskNames([dir]) ⇒ array

gets the task names from the tasks folder

Kind: instance method of QuasarRuntime

Param Type Default
[dir] string null

quasarRuntime.getTasksAssociatedByOutputType(taskNames, [orderByQuasar]) ⇒ object

gets task names associated with the oType field

Kind: instance method of QuasarRuntime

Param Type Default
taskNames array
[orderByQuasar] boolean false

quasarRuntime.injectCode(quasArgs) ⇒ object

Injects asset file references into the output file in the assets folder.

Kind: instance method of QuasarRuntime
Returns: object - the quasargs used

Param Type
quasArgs QuasArgs

quasarRuntime.injectDebrisFilesIntoStream(quasArgs, contents, [minify]) ⇒ stream

Injects require statements for debris.

Kind: instance method of QuasarRuntime
Returns: stream - the stream written to

Param Type Default
quasArgs QuasArgs
contents stream
[minify] boolean false

quasarRuntime.injectRequiredFilesIntoStream(quasArgs, contents) ⇒ stream

Injects require statements for the default asset files (css and js).

Kind: instance method of QuasarRuntime
Returns: stream - the stream written to

Param Type
quasArgs QuasArgs
contents stream

quasarRuntime.loadTasks(taskPaths, [loadDefaults], [clobber]) ⇒ array

loads the quasar tasks into the gulp taskList

Kind: instance method of QuasarRuntime
Returns: array - the tasks loaded

Param Type Default
taskPaths array
[loadDefaults] boolean false
[clobber] boolean true

quasarRuntime.logArgsToFile(quasArgs, [toStatus], [overwite]) ⇒ QuasArgs

writes the args to file with the status passed in

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
[toStatus] string null
[overwite] boolean false

quasarRuntime.logBuildQueued(quasArgs) ⇒ QuasArgs

logs quasArgs to the jobFile

Kind: instance method of QuasarRuntime
Returns: QuasArgs - the quasargs logged with updated argsFile entry

Param Type
quasArgs QuasArgs

quasarRuntime.logCritical(message, obj, color)

ogs a critical message

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.logData(message, obj, color)

Logs a data message

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.logEnd(message, obj, color)

Logs an end message

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.logError(message, obj, color)

Logs an error message

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.logInfo(message, obj, color)

Logs an info message (default)

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.logSuccess(message, obj, color)

Logs a success message

Kind: instance method of QuasarRuntime

Param Type
message string
obj object
color color

quasarRuntime.makePromptRequired() ⇒ function

used with inquirer questions to ensure that values entered have a length

Kind: instance method of QuasarRuntime

quasarRuntime.makePromptRequiredAndSanitary() ⇒ function

used with inquirer questions to ensure that values entered from the CLI follow the required ruleset

Kind: instance method of QuasarRuntime

quasarRuntime.moveTargetFilesToRootOfAssetsPath(quasArgs) ⇒ promise

moves the target html, js, and css files to the assetsFolder

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

quasarRuntime.outputToHtmlFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as HTML.

Kind: instance method of QuasarRuntime
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarRuntime.outputToJsonFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as JSON.

Kind: instance method of QuasarRuntime
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarRuntime.outputToTextFile(quasArgs) ⇒ object

Compiles the quasar into the outputFile alongside the assets into the outputFolder as TXT.

Kind: instance method of QuasarRuntime
Returns: object - quasArgs including errors if they exist

Param Type
quasArgs QuasArgs

quasarRuntime.promptConsole(questions, getResults, [showOptional], [optionalOnly]) ⇒ promise

prompts the terminal with questions

Kind: instance method of QuasarRuntime
Returns: promise - the promise of a prompt of the user to the command line interface

Param Type Default Description
questions array the questions to ask the user
getResults function callback after prompt has completed
[showOptional] boolean false
[optionalOnly] boolean

quasarRuntime.runFromArgsFile(qType, argsFile)

spawns a task to run a quasar from quasArgs saved in a json file.

Kind: instance method of QuasarRuntime

Param Type
qType *
argsFile *

quasarRuntime.runLastSuccessfulBuild([quasArgs]) ⇒ promise

runs the last successfully recorded argsFile

Kind: instance method of QuasarRuntime
Returns: promise - resolves to the QuasArgs used

Param Type Default
[quasArgs] QuasArgs

quasarRuntime.runQuasar(quasar, [quasArgs], registerTask, end) ⇒ promise

Runs a quasar build task

Kind: instance method of QuasarRuntime

Param Type Default Description
quasar string name of the quasar to run
[quasArgs] QuasArgs {}
registerTask bool whether or not to register the quasar with gulp
end function the callback for when the task has completed

quasarRuntime.unpackSourceFiles(quasArgs, subDirectory) ⇒ promise

unzips or moves source files to the assets folder

Kind: instance method of QuasarRuntime

Param Type Description
quasArgs QuasArgs
subDirectory string the subdirectory of the assets folder to place the source files

quasarRuntime.uploadOutputFiles(quasArgs, [excludeFiles]) ⇒ promise

Uploads output files to Amazon S3.

Kind: instance method of QuasarRuntime

Param Type Default
quasArgs QuasArgs
[excludeFiles] array []

quasarRuntime.uploadOutputFileAsTxt(quasArgs) ⇒ promise

Uploads the outputFile to Amazon S3.

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

quasarRuntime.uploadOutputFileWithMetadata(quasArgs) ⇒ promise

Uploads the outputFile to Amazon S3.

Kind: instance method of QuasarRuntime

Param Type
quasArgs QuasArgs

QuasarTask

A task that can be run by the quasar runtime API.

Kind: global class
Summary: This class can be extended to create custom quasars as shown in the example.
Export:

quasarTask.build() ⇒ promise

Builds the quasar into a single outputFile.

Kind: instance method of QuasarTask
Returns: promise - the build promise chane

quasarTask.cleanUp()

deletes the assets folder and any other temporary build files

Kind: instance method of QuasarTask

quasarTask.getDefaultQuasarQuestions() ⇒ array

returns a list of default prompts for a quasar.

Kind: instance method of QuasarTask
Returns: array - list of default prompts

quasarTask.getQuasarPrompts() ⇒ array

retrieves the list of inquirer questions to ask the user

Kind: instance method of QuasarTask
Returns: array - array of questions
See: https://www.npmjs.com/package/inquirer#questions

quasarTask.promptUser() ⇒ promise

prompts the user from the CLI to get the QuasArgs

Kind: instance method of QuasarTask
Returns: promise - prompt promise

quasarTask.registerRequiredQuasArgs([requiredArgs], [optionalRequiredArgs], [clobber])

adds required and optional defined arguments, and the defaults, within the quasArgs

Kind: instance method of QuasarTask
Summary: This method expects that the second parameter requiredArgs is an array of objects with the same structure as inquirer's .prompt questions parameter
See: https://www.npmjs.com/package/inquirer#questions

Param Type Default
[requiredArgs] array []
[optionalRequiredArgs] array []
[clobber] boolean true

quasarTask.registerTasks()

register the build tasks for this quasar

Kind: instance method of QuasarTask

quasarTask.resolveQuasArgs([args])

method for extended classes to do extra work for quasArgs after validation

Kind: instance method of QuasarTask

Param Type Default
[args] QuasArgs {}

quasarTask.run([args]) ⇒ promise

Runs the quasar through validation, build, then cleanup.

Kind: instance method of QuasarTask

Param Type Default
[args] QuasArgs {}

quasarTask.setConfig(_config, [applicationRoot], [force])

sets the configuration values from the quasar runtime

Kind: instance method of QuasarTask

Param Type Default
_config QuasarConfig
[applicationRoot] String process.cwd()
[force] boolean false

quasarTask.setDefaultQuasArgs(qType, [additionalArgs]) ⇒ QuasArgs

sets the default quasArgs including command line arguments in order of priority from: QuasArgs class, additionalArgs param, cliArgs, loaded from file

Kind: instance method of QuasarTask

Param Type Default
qType string
[additionalArgs] object {}

quasarTask.setSourceAndOutputPlusArgs([args])

sets the default values of the source and output arguments from user input

Kind: instance method of QuasarTask

Param Type Default
[args] QuasArgs {}

quasarTask.setSourceQuaArgsFromSourceFiles(map, defaultKey)

unpacks source files and sets quasArg values using the regex map passed in

Kind: instance method of QuasarTask

Param Type
map object
defaultKey string

quasarTask.validateRequiredArgs([args]) ⇒ promise

sets args from quasar form data and runs validation on the final fields

Kind: instance method of QuasarTask
Returns: promise - resolves to true if validation is successful

Param Type Default
[args] QuasArgs {}

QuasarTask.DTQuasarTask#validateRequiredArgs([args]) ⇒ promise

downloads source files, sets defaults from form args, and copies files to the assets folder

Kind: static method of QuasarTask
Returns: promise - resolves to true if validation is successful

Param Type Default
[args] QuasArgs {}

QuasarWebApp

The web application for running the quasar API and webform.

Kind: global class
Export:

quasarWebApp.port : string

Kind: instance property of QuasarWebApp

quasarWebApp._app : express

Kind: instance property of QuasarWebApp

quasarWebApp.availableTasks : array

Kind: instance property of QuasarWebApp

quasarWebApp.app ⇒ express

retrieves the express instance for the web app

Kind: instance property of QuasarWebApp
Read only: true

quasarWebApp.autoReloadingPageWithMessage([message]) ⇒ string

the content for a loading page with a message

Kind: instance method of QuasarWebApp

Param Type Default
[message] string "`Loading ...`"

quasarWebApp.createJobFile(args) ⇒ promise

Writes a jobFile to the jobs folder

Kind: instance method of QuasarWebApp
Returns: promise - resolves with the created job information

Param Type Description
args QuasArgs the args to create the job with

quasarWebApp.getJob(req, res)

sends the outputFile of a job or the json data about the job if it has not completed

Kind: instance method of QuasarWebApp

Param Type
req *
res *

quasarWebApp.getJobStatus(jobId) ⇒ string

returns the status of a job based on the filename and which job folder it is in

Kind: instance method of QuasarWebApp

Param Type
jobId *

quasarWebApp.getPublicBuild(req, res)

returns the directory view of a domain/signature for a given date range

Kind: instance method of QuasarWebApp

Param Type
req *
res *

quasarWebApp.onTaskDataReceived(req, res) ⇒ promise

creates a jobfile and returns the preliminary data to the response

Kind: instance method of QuasarWebApp
Returns: promise - the json response to the request

Param Type
req *
res *

quasarWebApp.run([app], [port], [start])

runs the express application with webpage and API

Kind: instance method of QuasarWebApp

Param Type Default
[app] express
[port] number
[start] boolean false

quasarWebApp.saveSourceFiles(args) ⇒ QuasArgs

saves an uploaded source file to the sources folder

Kind: instance method of QuasarWebApp
Returns: QuasArgs - the saved QuasArgs

Param Type
args QuasArgs

quasarWebApp.sendJobFileCompleted(job, jobFile) ⇒ promise

sends a response to a client when a job has been completed

Kind: instance method of QuasarWebApp

Param Type
job *
jobFile *

quasarWebApp.sendJobFileQueued(job, jobFile) ⇒ promise

sends a response to a client when a job has been queued

Kind: instance method of QuasarWebApp
Returns: promise - resolves to the job queued information

Param Type
job string
jobFile string