simple_build_tools v1.0.3
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
Param | Type | Description |
---|---|---|
fcn | function | asynchronous function that executes a callback |
copyFile(src, dest) ⇒ Promise.<void>
Copy a single file
Kind: global function
Param | Type | Description |
---|---|---|
src | string | path to the source file |
dest | string | path to the destination file |
copyDir(src, dest) ⇒ Promise.<void>
Copy an entire directory
Kind: global function
Param | Type | Description |
---|---|---|
src | string | path to the source directory |
dest | string | path to the destination directory |
transformFile(src, dest, transform) ⇒ Promise.<void>
Copy and transorm a file
Kind: global function
Param | Type | Description |
---|---|---|
src | string | path to the source file |
dest | string | path to the destination file |
transform | function | text transforming funciton |
assertDir(dir) ⇒ Promise.<void>
Ensure that a directory exists
Kind: global function
Param | Type | Description |
---|---|---|
dir | string | the path to the directory that must exist |
assertParentDir(file) ⇒ Promise.<void>
Ensure that a file's parent directory exists
Kind: global function
Param | Type | Description |
---|---|---|
file | string | the path to the file whose parent must exist |
rmrf(path) ⇒ Promise.<void>
remove contents recursively
Kind: global function
Param | Type | Description |
---|---|---|
path | string | the 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
Param | Type | Description |
---|---|---|
task | function | a build task that should be timed and reported |
series(tasks) ⇒ Promise.<void>
join a set of tasks in series
Kind: global function
Param | Type | Description |
---|---|---|
tasks | Array.<function()> | tasks to join |
parallel(tasks) ⇒ Promise.<void>
join a set of tasks in parallel
Kind: global function
Param | Type | Description |
---|---|---|
tasks | Array.<function()> | tasks to join |
runTasks(task) ⇒ Promise.<void>
run a task an report it's time and result
Kind: global function
Param | Type | Description |
---|---|---|
task | function | task to run and report time and result |
webpack(config) ⇒ Promise.<string>
Run webpack and report the result
Kind: global function
Param | Type | Description |
---|---|---|
config | Object | the webpack config and report result |
zipDirectory(sourceDir, outPath) ⇒ Promise
zip the contents of a directory into a single file
Kind: global function
Param | Type | Description |
---|---|---|
sourceDir | String | path to directory to zip |
outPath | String | path to zip file to create |
getFileMatches(dirPath, isMatch, recurse, parents) ⇒ Promise.<Array.<string>>
get files that match a test
Kind: global function
Param | Type | Description |
---|---|---|
dirPath | string | the path of the directory containing the files |
isMatch | isFileMatch | function to test if a file is a match |
recurse | boolean | whether to recurse into child folders |
parents | Array.<string> | array of parent directories |
getFiles(dirPath, recurse) ⇒ Promise.<Array.<string>>
Get the files in a directory
Kind: global function
Param | Type | Description |
---|---|---|
dirPath | string | the path of the directory containing the files |
recurse | boolean | whether to recurse into child folders |
getDirs(dirPath, recurse) ⇒ Promise.<Array.<string>>
Get directories in a directory
Kind: global function
Param | Type | Description |
---|---|---|
dirPath | string | the path of the directory containing the files |
recurse | boolean | whether to recurse into child folders |
getFileWithName(dirPath, name, extensions) ⇒ Promise.<string>
get a source file by name
Kind: global function
Param | Type | Description |
---|---|---|
dirPath | string | the path of the directory containing the files |
name | string | the name of the source file |
extensions | string | Array.<string> | '*' | the extension of possible extensions of the file |
isFileMatch ⇒ boolean
Matcher for getFileMatches
Kind: global typedef
Param | Type | Description |
---|---|---|
file | Node.File | file to check for a match |
parents | Array.<string> | parents of the file to check |