node-promise-process
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Prerequisites:

  • node
  • npm
  • yarn optional

Download this repo

git clone https://github.com/inspiraller/node-promise-process.git

cd into folder

cd node-promise-process

install dependencies

yarn install

or

npm install

Create your example

myprocess.js

const sync = require('node-promise-process').default;

const helloworld = () => 'hello world';

const init = async () => {
  await sync([
    helloworld,
    'mkdir steve'
  ]);
};

init();

run

node myprocess.js

How to test as typescript version

  • prerequisites - will need dependencies

package.json - script

"scripts": {
  "example-process": "cross-env-shell babel-node --extensions '.ts,.tsx' src/example-process.ts"
},

example-process.ts

import sync, {TcmdOrFunc} from 'node-promise-process';

const hello1 = () => {
  console.log('hello world!');
  return 'hello - success'; // need to return something... handleFunc is expecting a string result.
};
const hello2 = hello1;

const init = async () => {
  const arrNext: TcmdOrFunc[] = [
    hello1,
    hello2,
    'mkdir steve'
  ];
  await sync(arrNext);
};
init();

Done !

Readme

Keywords

Package Sidebar

Install

npm i node-promise-process

Weekly Downloads

10

Version

2.0.1

License

MIT

Unpacked Size

28.7 kB

Total Files

36

Last publish

Collaborators

  • inspiraller