CLI to build code metrics charts for your projects
npm install cmetrix  
_CLI to build code metrics charts for your projects_

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)
- Install NodeJS
- Install cloc
- Then run npx cmetrix --help
First, you have to describe your projects in a JSON configuration file.
Then, just run npx cmetrix charts -c
(npx cmetrix charts --help for more options)
A simple JSON configuration file example is available in the ./examples directory. You can add languages and excludeDirs to have a better repository analysis.
``json5`
{
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' },
],
}
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
``
npm run build
npm start -- charts --help
Note: you can run the example: npm run build && npm start -- charts -c examples/conf.json --open`