shelit
TypeScript icon, indicating that this package has built-in type declarations

0.0.0 • Public • Published

SHELIT

A small node.js tool to run shell commands

Importing the Library

// using es2015
import { run, runParallel, runSeries } from 'shelit'
 
// or using commonjs
const shelit = require('shelit')

Usage

shelit.run Run a single shell command

// Promises
  shelit.run("rm -rf node_modules").then(() => {
    console.log("command finished");
  }).catch(err => {
    console.log("oops! error happened", err)
  })
 
// async await
async function removeModules() {
  try {
    await shelit.run("rm -rf node_modules")
  } catch(err) {
    console.log("oops! error happened", err)
  }
}

shelit.runSeries Run multiple commands in series

// async await
async function removeModules() {
 
  let commands = [
    "rm -rf node_modules",
    "npm i"
  ];
 
  try {
    await shelit.runSeries(commands)
  } catch(err) {
    console.log("oops! error happened", err)
  }
}

shelit.runParallel Run multiple commands in parallel

// async await
async function removeModules() {
 
  let commands = [
    "rm -rf node_modules",
    "rm -rf dist"
  ];
 
  try {
    await shelit.runParallel(commands)
  } catch(err) {
    console.log("oops! error happened", err)
  }
}

Readme

Keywords

none

Package Sidebar

Install

npm i shelit

Weekly Downloads

0

Version

0.0.0

License

MIT

Unpacked Size

11.2 kB

Total Files

6

Last publish

Collaborators

  • mofax