@wethegit/sweet-potato-utensils

1.1.0 • Public • Published

sweet-potato-utensils 🥣

Shared utility functions and variables used across the sweet-potato packages.

Usage

npm install @wethegit/sweet-potato-utensils

config

Contains all the common paths and most importantly the user's options.

const { config } = require("@wethegit/sweet-potato-utensils");

// get projects builld directory
config.OPTIONS.buildDirectory;

getFiles

Small wrapper around the glob package to promisify it.

const { getFiles, config } = require("@wethegit/sweet-potato-utensils");

async function getAllJPGsOnProject() {
  const jpgs = await getFiles(
    path.join(config.PUBLIC_DIRECTORY, "**", "*.jpg")
  );
  // do something with jpgs
}

logger

Function that helps standardize all the logs across all packages.

const { logger } = require("@wethegit/sweet-potato-utensils");

// Simple string
logger.announce("Config parsed");

// You can also pass a second argument for .error
// The logger will try its best to display the propper error message
logger.error("Couldn't compile", error);

// Pass in an array and logger will concat messages with an arrow ->
// The result of this call will be
// SUCCESS:: File saved with success -> /build/file.html
logger.success(["File saved with success", file]);

// other types of messages
logger.warning("Deprecated on next version");
logger.start("Stated compiling pages");
logger.finish("Finished compiling pages");

Readme

Keywords

none

Package Sidebar

Install

npm i @wethegit/sweet-potato-utensils

Weekly Downloads

21

Version

1.1.0

License

none

Unpacked Size

5.31 kB

Total Files

6

Last publish

Collaborators

  • andrewrubin
  • wethecollective
  • marlonmarcello