3.1.0 • Published 2 years ago
@hoast/hoast v3.1.0
@hoast/hoast
The core package of hoast responsible for managing and running the other packages.
Install
npm install @hoast/hoastUsage
Configuration file
See the config example for more detail on how to configure and use the core package.
Command line interface
Run hoast help or hoast h to see information on how to use command line interface.
Usage
% @hoast/hoast [command] [...options]
Commands
h, help Display help
r, run Run from file (default command)
v, version Display version
Options for run
--concurrency-limit {Number} Maximum amount of items to process at once. (Default: 4)
--directory-path {String} Directory to run the command from. (Default: '.')
--file-path {String} File path to config or script file. (Defaults: 'hoast.js' and 'hoast.json')
--log-level {Number} Log level given to the logger. (Default: 2 (Errors and warnings))
--watch Re-build automatically when a file changes.
--watch-ignore {String} Glob patter or paths to exclude from watching. (Default: 'node_modules/**')API
constructorCreateHoastinstance.@params {Object} optionsOptions object which can contain the following keys.{Number} logLevel = 2Log level given to the logger.{Number} concurrencyLimit = 4Maximum amount of items to process at once.{String} directory = process.cwd()Directory path to build from. Relative paths are resolved withprocess.cwd().
@params {Object} meta = {}Global metadata that can be picked up by process packages.@returns {Object}Hoast instance.
Variables
meta {Object}Global metadata that can be picked up by process packages.
Functions
Collections
addCollectionAdd collection to collections.@param {Object}collection Collection to add.@returns {Object}The hoast instance.
addCollectionsAdd multiple collections to collections.@param {Array} collectionsCollections to add.@returns {Object}The hoast instance.
Meta collections
addMetaCollectionAdd collection to meta collections.@param {Object}collection Collection to add.@returns {Object}The hoast instance.
addMetaCollectionsAdd multiple collections to meta collections.@param {Array} collectionsCollections to add.@returns {Object}The hoast instance.
Processes
registerProcessRegister process.@param {String} nameName of process.@param {Object} processProcess object.@returns {Object}The hoast instance.
registerProcessesRegister multiple processes.@param {Object} processesProcess objects by name as key.@returns {Object}The hoast instance.
Process
async processProcess collections.
Access
addAccessedMark a file as accessed by the given source, this will allow the watcher to rebuild effectively.@params {String} sourceA unique identifier of the source.@params {String} ...filePathsFile paths accessed by the source.
clearAccessedClears information of file paths accessed by the given source.@params {String} sourceA unique identifier of the source.
Changes
getChangedGet the list of changed file since the last build.@returns {Array<String>}List of absolute file paths.
hasChangedCheck whether any files that the source uses have changed.@params {String} sourceA unique identifier of the source.@returns {Boolean}Whether a file the source uses has changed.
setChangedMarks the given set of file paths as changed files.@params {Array<String>} filePaths = nullA list of absolute file paths.
Options
getOptionsGet the options.@returns {Object}The options.
Watching
isWatchingGet whether the watcher is running.@returns {Boolean}Whether the watcher is running.
setWatchingSet whether the watcher is running.@params {Boolean} isWatchingWhether the watcher is running.