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

0.0.2 • Public • Published

VonCount

I vant to count your lines

Count VonCount

Usage

$ npm install -g voncount
$ voncount COMMAND
running command...
$ voncount (--version)
voncount/0.0.2 darwin-x64 node-v14.15.4
$ voncount --help [COMMAND]
USAGE
  $ voncount COMMAND
...

Commands

voncount help [COMMAND]

Display help for voncount.

USAGE
  $ voncount help [COMMAND] [-n]

ARGUMENTS
  COMMAND  Command to show help for.

FLAGS
  -n, --nested-commands  Include all nested commands in the output.

DESCRIPTION
  Display help for voncount.

See code: @oclif/plugin-help

voncount run PATH

run a count of a codebase

USAGE
  $ voncount run [PATH] [-c <value>]

ARGUMENTS
  PATH  location of codebase

FLAGS
  -c, --config=<value>

DESCRIPTION
  run a count of a codebase

See code: dist/commands/run/index.ts

Config

Configuration for voncount is totally optional, and can either live in a count.json file in the root of your code directory be explicitly provided with the -c or --config flag.

What Goes in Config?

include

An array of glob patterns to include, defaults to ['*'].

Examples

Typescript would be:

{
  "include": ["**/*.ts", "**/*.tsx"]
}

Go would be:

{
  "include": ["**/*.go"]
}

exclude

An array of glob patterns to exclude, defaults to [].

Examples

For node you would probably want

{
  "exclude": ["node_modules"]
}

groups

A group is a specific criteria to search for in the code. It will then be presented back as number of lines that qualify for the group, and as a percentage what that group represents in the code. This is useful for comment, documentation blocks or specific class/function detection (detecting reuse). A block is defined in terms of a regex that matches the start of that block, and another regex that matches the end of that block (with lines counted between those blocks)

Examples

For something like comment/documentation blocks where the code looks like:

/**
 * A button.
 *
 * @param label: Text to show on the button
 *
 * @example
 *
 * <Button
 *   label="Hello World"
 * />
 *
 * @returns JSX.Element
 *
 * @alpha
 */

You would want to match everything between /** and */:

{
  "groups": [
    {
      "name": "documentation",
      "between": {
        "start": "^\\/\\*\\*",
        "end": "^ \\*/$"
      }
    }
  ]
}

Be careful to correctly escape your regexs

/voncount/

    Package Sidebar

    Install

    npm i voncount

    Weekly Downloads

    3

    Version

    0.0.2

    License

    MIT

    Unpacked Size

    14.2 kB

    Total Files

    12

    Last publish

    Collaborators

    • royletron