@tanem/authors
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

authors

npm version build status coverage status npm downloads

Generates a list of authors in a format suitable for inclusion in an AUTHORS file.

Usage

Usage: authors [options]

Generates a list of authors in a format suitable for inclusion in an AUTHORS file.

Options:
  -V, --version   output the version number
  -n, --numbered  sort by number of commits per author
  -h, --help      output usage information

Examples:
  $ authors
  $ authors -n

The list of authors is printed to stdout, so can be redirected to a file:

$ authors > AUTHORS

API

authors([options])

Returns a Promise that will be resolved with a list of authors sorted alphabetically by author name. If an error occurs during execution, the Promise is rejected with an Error object.

Arguments

  • options - Optional An object containing the optional arguments defined below. Defaults to {}.
    • isNumbered - Optional Sort the list by number of commits per author.

Example

// Note: The `fs.promises` API was added in Node.js v10.0.0.
import { promises as fs } from 'fs';
import path from 'path';
import authors from '@tanem/authors';

(async () => {
  try {
    const result = await authors({ isNumbered: true });
    await fs.writeFile(path.join(__dirname, 'AUTHORS'), result, 'utf-8');
  } catch (error) {
    console.error(error);
  }
})();

authors.sync([options])

Synchronously returns a list of authors sorted alphabetically by author name. If an error occurs during execution, an Error object will be thrown.

Arguments

  • options - Optional An object containing the optional arguments defined below. Defaults to {}.
    • isNumbered - Optional Sort the list by number of commits per author.

Example

import fs from 'fs';
import path from 'path';
import authors from '@tanem/authors';

try {
  const result = authors.sync({ isNumbered: true });
  fs.writeFileSync(path.join(__dirname, 'AUTHORS'), result, 'utf-8');
} catch (error) {
  console.error(error);
}

Installation

$ npm install @tanem/authors --save-dev

License

MIT

Package Sidebar

Install

npm i @tanem/authors

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9.99 kB

Total Files

10

Last publish

Collaborators

  • tanem