stdtodo
This package will be deprecated and unmaintained unless someone takes over development. Open an issue on github if you would like to continue maintainance of this module
stdtodo
is a development module to help in the logging of asynchronous tasks.
The difference between this and other list loggers it that this will actually
print out all of the initial list in it's incomplete state, then you can mark of
tasks by their index as complete (or mark as errored) so you can see a realtime
list of which tasks haven't been completed yet. After it's done, it will print
out all of the errors that happened at once.
NOTICE: This is a highly experimental module. Please see caveats below.
Installation
$ npm install stdtodo --save
Usage
Todo is an object prototype in which you pass in options to create a new Todo list
var Todo = ;
You need an array of strings to define the list you wish to check off
var data = 'item 1' 'item 2' 'item 3';
Then you instantiate your todo list
var todo = data: todo;
To 'start' your todo list:
todostart;
To check off the first item:
todo;
To mark an item as errored out:
todo;
Example
var Todo = data = todo ; data; todo = data: data; // Start the task listtodostart; // Do some async task...todo;; // Some error happenedtodo;
Which outputs:
✓ copy filesx lint files✓ delete all the stuffs-------Errorslint files: Error when linting files!-------
Caveats
You need to make sure you don't console.log
anything while the todo list is
running. If you do, the list will become misaligned.
Also, your list items shouldn't exceed the width of your terminal.
You list length shouldn't exceed the number of rows in your terminal window. If it does, it will just sequentially print out each of the tasks as they are completed.
Development
This project uses gulp
for task automation.
$ npm install -g gulp
Here are the three tasks available to use:
-
gulp hint
: runs all pertinent code against jshint. The rules are the ones defined in.jshintrc
-
gulp test
: runs all tests withmocha
for passing andinstanbul
for code coverage. It generates html files showing the code coverage. -
gulp docs
: builds out all of the documentation usingdocco
. Note that you need to have docco installed (npm install -g docco
). I at one time at docco part of the dev dependencies, but now I don't. I may be open to putting it back, but I just wanted to keep the package as small as possible.
You can also run npm test
, and it does basically does the same thing as
gulp test
, but an error will be thrown because it does some more istanbul
stuff to send data to the coverage server. When this project runs through
travis, it also sends coverage data to coveralls.io.
When forking and doing pull requests, work off of the develop
branch. I won't
be super strict on this, but it's what I would prefer. That way we can keep
master
clean.