Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Latest commit

 

History

History
259 lines (187 loc) · 9.92 KB

.verb.md

File metadata and controls

259 lines (187 loc) · 9.92 KB

{%= name %} [![npm version][npmv-img]][npmv-url] github release ![License][license-img]

{%= description %}

Please consider following this project's author, Charlike Mike Reagent, and ⭐ the project to show your ❤️ and support.

Code style CircleCI linux build CodeCov coverage status DavidDM dependency status Renovate App Status Make A Pull Request Semantically Released

If you have any how-to kind of questions, please read the Contributing Guide and Code of Conduct documents.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Become a Patron Conventional Commits [![NPM Downloads Weekly][downloads-weekly-img]][npmv-url] [![NPM Downloads Monthly][downloads-monthly-img]][npmv-url] [![NPM Downloads Total][downloads-total-img]][npmv-url] Share Love Tweet

Project is semantically & automatically released on CircleCI with [new-release][] and its New Release GitHub App.

Table of Contents

Install

This project requires Node.js {%= engines.node %}. Install it using yarn or npm.
We highly recommend to use Yarn when you think to contribute to this project.

$ yarn add {%= name %}

API

Generated using docks.

Uses [execa][] v2, execa.command() method. As stated there, think of it as mix of child_process's .execFile and .spawn. It is pretty similar to the .shell method too, but only visually because it does not uses the system's shell, meaning it does not have access to the system's environment variables.

It also can accept array of multiple strings of commands that will be executed in series.

Params

  • cmds {string|} a commands to execute, if array of strings executes them serially
  • opts {object} directly passed to [execa][] and so to child_process

Returns

  • Promise resolved or rejected promises

Examples

import { exec } from '@tunnckocore/execa';
// or
// const { exec } = require('@tunnckocore/execa');

async function init () {
  await exec('echo "hello world"', { stdio: 'inherit' });

  // executes in series
  await exec([
    'prettier-eslint --write foobar.js',
    'eslint --format codeframe foobar.js --fix'
  ], { stdio: 'inherit', preferLocal: true });
}

init();

Same as .exec method, but also can accept an array of multiple commands that will be executed in the system's shell, meaning that it can access the system's environment variables from the command.

Params

  • cmds {string|} a commands to execute, if array of strings executes them serially
  • opts {object} directly passed to execa.shell method.

Returns

  • Promise resolved or rejected promises

Examples

import { shell } from '@tunnckocore/execa';
// or
// const { shell } = require('@tunnckocore/execa');

async function init () {
  // executes in series
  await shell([
    'echo unicorns',
    'echo "foo-$HOME-bar"',
    'echo dragons'
  ], { stdio: 'inherit' });

  // exits with code 3
  try {
    await shell([
      'exit 3',
      'echo nah'
    ]);
  } catch (er) {
    console.error(er);
    // => {
    //  message: 'Command failed: /bin/sh -c exit 3'
    //  killed: false,
    //  code: 3,
    //  signal: null,
    //  cmd: '/bin/sh -c exit 3',
    //  stdout: '',
    //  stderr: '',
    //  timedOut: false
    // }
  }
}

init();

Same as [execa][]'s default export, see its documentation.

back to top

{% if (verb.related && verb.related.list && verb.related.list.length) { %}

See Also

Some of these projects are used here or were inspiration for this one, others are just related. So, thanks for your existance!

{%= related(verb.related.list, { words: 10 }) %}

back to top {% } %}

Contributing

Follow the Guidelines

Please read the Contributing Guide and Code of Conduct documents for advices.
For bugs reports and feature requests, please create an issue or ping @tunnckoCore at Twitter.

Support the project

Become a Partner or Sponsor? 💵 Check the Partner, Sponsor or Omega-level tiers! 🎉 You can get your company logo, link & name on this file. It's also rendered on package page in [npmjs.com][npmv-url] and [yarnpkg.com](https://yarnpkg.com/en/package/{%= name %}) sites too! 🚀

Not financial support? Okey! Pull requests, stars and all kind of contributions are always welcome. ✨

OPEN Open Source

This project is following OPEN Open Source model

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is built on collective efforts and it's not strongly guarded by its founders.

There are a few basic ground-rules for its contributors

  1. Any significant modifications must be subject to a pull request to get feedback from other contributors.
  2. Pull requests to get feedback are encouraged for any other trivial contributions, but are not required.
  3. Contributors should attempt to adhere to the prevailing code-style and development workflow.

Wonderful Contributors

Thanks to the hard work of these wonderful people this project is alive! It follows the all-contributors specification.
Don't hesitate to add yourself to that list if you have made any contribution! ;) See how, here.


Charlike Mike Reagent

💻 📖 💬 👀 🔍

Consider showing your support to them. 💖

License

Copyright (c) 2017-present, Charlike Mike Reagent <mameto2011@gmail.com> & contributors.
Released under the Apache-2.0 License.

[npmv-url]: https://www.npmjs.com/package/{%= name %} [npmv-img]: https://badgen.net/npm/v/{%= name %}?icon=npm

[license-img]: https://badgen.net/npm/license/{%= name %}

[downloads-weekly-img]: https://badgen.net/npm/dw/{%= name %} [downloads-monthly-img]: https://badgen.net/npm/dm/{%= name %} [downloads-total-img]: https://badgen.net/npm/dt/{%= name %}