npm

Need private packages and team management tools?Check out npm Orgs. »

tanem-scripts

4.0.0 • Public • Published

tanem-scripts

npm version build status coverage status npm downloads

Common scripts for my projects.

Usage

Usage: tanem-scripts [options] [command]

Common scripts for my projects.

Options:
  -V, --version        output the version number
  -h, --help           output usage information

Commands:
  authors [options]    generates a list of authors in a format suitable for inclusion in an AUTHORS file
  changelog [options]  generates a changelog using GitHub tags and pull requests

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-scripts';
 
(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-scripts';
 
try {
  const result = authors.sync({ isNumbered: true });
  fs.writeFileSync(path.join(__dirname, 'AUTHORS'), result, 'utf-8');
} catch (error) {
  console.error(error);
}

changelog([options])

Returns a Promise that will be resolved with the changelog. 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 {}.
    • futureRelease - Optional Tag to use for PRs merged since the last published tag. If unspecified, those PRs will be excluded.
    • owner - Optional Repo owner. If unspecified, the value will be resolved from the local git config.
    • repo - Optional Repo name. If unspecified, the value will be resolved from the local git config.

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 { changelog } from 'tanem-scripts';
 
(async () => {
  try {
    const result = await changelog({
      futureRelease: 'v2.0.0'
    });
    await fs.writeFile(path.join(__dirname, 'CHANGELOG.md'), result, 'utf-8');
  } catch (error) {
    console.error(error);
  }
})();

Installation

$ npm install tanem-scripts --save-dev

You'll also need to generate a new GitHub personal access token, then set an environment variable by running the following command at the prompt or by adding it to your shell profile:

export CHANGELOG_GITHUB_TOKEN=<your_github_personal_access_token>

License

MIT

install

npm i tanem-scripts

Downloadsweekly downloads

191

version

4.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability