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

1.2.5 • Public • Published

cmetrix

Build Status npm version code style: prettier

CLI to build code metrics charts for your projects

Purpose

Your team is working on several projects. Each project is composed of several repositories. You would like to have an overview of the amazing work that has been done.

Run cmetrix and you will get beautiful charts (thanks to cloc and apexcharts used under the hood)

Installation

  • Install NodeJS
  • Install cloc
  • Then run npx cmetrix --help

Usage

First, you have to describe your projects in a JSON configuration file. Then, just run npx cmetrix charts -c <configuration-file>.json

(npx cmetrix charts --help for more options)

Configuration file

A simple JSON configuration file example is available in the ./examples directory. You can add languages and excludeDirs to have a better repository analysis.

{
  projects: [
    {
      name: 'project 1',
      repositories: [
        { name: 'lodash' },
        { name: 'shelljs' },
        { name: 'pelican' },
      ],
    },
    {
      name: 'project 2',
      repositories: [{ name: 'lodash' }, { name: 'quart' }],
    },
  ],
  repositories: [
    {
      name: 'lodash',
      url: 'git@github.com:lodash/lodash.git',
      excludeDirs: ['node_modules'], // <- you can exclude dirs from analysis
      tag: '3.10.1', // <- you can checkout a given tag
    },
    {
      name: 'shelljs',
      url: 'https://github.com/shelljs/shelljs.git',
      languages: ['JavaScript', 'TypeScript'], // <- you can filter on languages
    },
    { name: 'quart', url: 'https://gitlab.com/pgjones/quart.git' },
    { name: 'pelican', url: 'https://github.com/getpelican/pelican.git' },
  ],
}

Authentication

You can pass authentication tokens to cmetrix when accessing private repositories through https:// using the following environment variables: CMETRIX_GITHUB_TOKEN, CMETRIX_GITLAB_TOKEN, CMETRIX_BITBUCKET_TOKEN.

⚠️ Do not fill your configuration file with tokens: cmetrix will do the job for you.

Example if you have private repos in github and gitlab: CMETRIX_GITHUB_TOKEN=aabbccddaabbccdd CMETRIX_GITLAB_TOKEN=1122334455 npx cmetrix charts -c <configuration-file>.json

Development

  npm run build
  npm start -- charts --help

Note: you can run the example: npm run build && npm start -- charts -c examples/conf.json --open

Package Sidebar

Install

npm i cmetrix

Weekly Downloads

1

Version

1.2.5

License

MIT

Unpacked Size

316 kB

Total Files

31

Last publish

Collaborators

  • peio