1.0.3 • Published 2 years ago

simple_build_tools v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Simple Build Tools

Simple tools for building a nodejs project

Functions

Typedefs

toProm(fcn) ⇒ Promise

Convert a callback executing asynchronouse function into a promise returning one

Kind: global function

ParamTypeDescription
fcnfunctionasynchronous function that executes a callback

copyFile(src, dest) ⇒ Promise.<void>

Copy a single file

Kind: global function

ParamTypeDescription
srcstringpath to the source file
deststringpath to the destination file

copyDir(src, dest) ⇒ Promise.<void>

Copy an entire directory

Kind: global function

ParamTypeDescription
srcstringpath to the source directory
deststringpath to the destination directory

transformFile(src, dest, transform) ⇒ Promise.<void>

Copy and transorm a file

Kind: global function

ParamTypeDescription
srcstringpath to the source file
deststringpath to the destination file
transformfunctiontext transforming funciton

assertDir(dir) ⇒ Promise.<void>

Ensure that a directory exists

Kind: global function

ParamTypeDescription
dirstringthe path to the directory that must exist

assertParentDir(file) ⇒ Promise.<void>

Ensure that a file's parent directory exists

Kind: global function

ParamTypeDescription
filestringthe path to the file whose parent must exist

rmrf(path) ⇒ Promise.<void>

remove contents recursively

Kind: global function

ParamTypeDescription
pathstringthe path of the item to be removed

runAndReport(task) ⇒ Promise.<void>

Run a build task and report it's time and result

Kind: global function

ParamTypeDescription
taskfunctiona build task that should be timed and reported

series(tasks) ⇒ Promise.<void>

join a set of tasks in series

Kind: global function

ParamTypeDescription
tasksArray.<function()>tasks to join

parallel(tasks) ⇒ Promise.<void>

join a set of tasks in parallel

Kind: global function

ParamTypeDescription
tasksArray.<function()>tasks to join

runTasks(task) ⇒ Promise.<void>

run a task an report it's time and result

Kind: global function

ParamTypeDescription
taskfunctiontask to run and report time and result

webpack(config) ⇒ Promise.<string>

Run webpack and report the result

Kind: global function

ParamTypeDescription
configObjectthe webpack config and report result

zipDirectory(sourceDir, outPath) ⇒ Promise

zip the contents of a directory into a single file

Kind: global function

ParamTypeDescription
sourceDirStringpath to directory to zip
outPathStringpath to zip file to create

getFileMatches(dirPath, isMatch, recurse, parents) ⇒ Promise.<Array.<string>>

get files that match a test

Kind: global function

ParamTypeDescription
dirPathstringthe path of the directory containing the files
isMatchisFileMatchfunction to test if a file is a match
recursebooleanwhether to recurse into child folders
parentsArray.<string>array of parent directories

getFiles(dirPath, recurse) ⇒ Promise.<Array.<string>>

Get the files in a directory

Kind: global function

ParamTypeDescription
dirPathstringthe path of the directory containing the files
recursebooleanwhether to recurse into child folders

getDirs(dirPath, recurse) ⇒ Promise.<Array.<string>>

Get directories in a directory

Kind: global function

ParamTypeDescription
dirPathstringthe path of the directory containing the files
recursebooleanwhether to recurse into child folders

getFileWithName(dirPath, name, extensions) ⇒ Promise.<string>

get a source file by name

Kind: global function

ParamTypeDescription
dirPathstringthe path of the directory containing the files
namestringthe name of the source file
extensionsstring | Array.<string> | '*'the extension of possible extensions of the file

isFileMatch ⇒ boolean

Matcher for getFileMatches

Kind: global typedef

ParamTypeDescription
fileNode.Filefile to check for a match
parentsArray.<string>parents of the file to check