Skip to content

sehrope/node-async-main

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

async-main

NPM

Build Status

Overview

Simple wrapper for async main functions.

Combined with async/await, this makes it very easy to write simple async node scripts.

Install

$ npm install async-main --save

Usage

With JavaScript:

const main = require('async-main').default;
main(async () => {
    // Do stuff
})

With Typescript:

import main from 'async-main';
main(async () => {
    // Do stuff
})

Dependencies

None!

Features

  • Wraps a promisifed main function and executes it.
  • ... if the promise resolves then the program exits with a success exit code (0).
  • ... if the promise rejects then it prints the stack trace of the Error and exits with a non-success exit code (1).

Building and Testing

To build the module run:

$ make

Then, to run the tests run:

$ make test

License

ISC. See the file LICENSE.

About

Wrapper for invoking async main functions

Resources

License

Stars

Watchers

Forks

Packages

No packages published