@hoast/utils

Utility functions commonly used by hoast and hoast packages.


Keywords
hoast, util, utils, utility, utilities, blog-engine, build-automation, javascript, modular, site-generator, static-site-generator
License
MIT
Install
npm install @hoast/utils@3.2.0

Documentation

Project logo

Hoast

A set of simple and modular packages for build automation.

Creating a static page generator can be incredibly easy! Create the following configuration file in the root of your project, install the used dependencies and run the hoast command to start a build.

export default {
  options: {
    directory: 'src',
  },
  collections: [{
    source: ['@hoast/source-readfiles', {
      directory: 'pages',
    }],
    processes: [
      '@hoast/process-frontmatter',
      '@hoast/process-markdown',
      ['@hoast/process-handlebars', {
        templateDirectory: 'layouts',
        templatePath: 'default.hbs',
      }],
      ['@hoast/process-writefiles', {
        directory: '../dst',
      }],
    ],
  }],
}

Configuration files can have many forms JSON, JavaScript objects, Hoast instances, or use the API directly and call the process function to start building.

Architecture

There is one core package that controls what and when the modules are run as well as the data provided to them. What modules should run in what order can be controlled using a configuration file or directly through code.

This repository contains the core package as well as first party modules and everything directly surrounding the project. For example all the packages can be found in packages directory, the website's source code can be found in the .docs directory and the build of the website is in the docs directory.

Made with

The following list are project that are build with this project.

The following list serve as tools you can use directly, or as an example on how to make a solution that fits your needs.

  • examples - Examples on how Hoast and several modules can be used.

Packages

  • hoast - The core package of hoast responsible for managing and running the other packages. See this package for more information on how to create a config file.

Source packages

  • source-custom - Allows you to provide your own custom source functions. Extends base-source where the overridable functions can be provided via the options. Helps you from having to create a package for simple one-off behaviour.
  • source-airtable - Read data from Airtable bases.
  • source-javascript - Read and execute script from the filesystem.
  • source-readfiles - Read files from the filesystem.

Process packages

Developer packages

  • base-package - Provides basic functionality like receiving the library's reference and setting up a logger.
  • base-process - Provides basic functionality for process package like an initialization function, sequentially running of certain code, and filtering out running the process based of the data.
  • base-source - Provides basic functionality for source package like an initialization function, sequentially running of certain code, and a finallize function called after the source is done iterating.
  • utils - A package of utility functions used by several other packages in this list.