0.1.2 • Published 2 years ago

lines-control v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

lines-control

This tool should you control the scope of diff changes

Install

$ npm i lines-control -D
or
$ yarn add lines-control -D

Usage

Terminal example

You can use this module in your terminal.

$ lines-control --rules total,50

You can apply a rule for filtered files. It uses the minimatch library to do its matching.

$ lines-control --rules total,50,src/**/*
$ lines-control --rules total,50,src/**/* totalInsertions,5,webpack/**/*

You can compare the two branches.

$ lines-control --rules total,50,src/**/* --comparisons origin/main
$ lines-control --rules total,50,src/**/* --comparisons origin/main,/feature-x
$ lines-control --rules total,50,src/**/* --comparisons origin/feature-x,origin/feature-y

and combine it

$ lines-control
  --rules total,50,src/**/* totalInsertions,5,webpack/**/*
  --comparisons origin/feature-x,origin/feature-y

lint-staged example

You can check how many lines have been touched each time you create a commit.

{
  "lint-staged": {
    "*": "lines-control --rules total,50,src/**/*"
  }
}

husky and lint-staged example

You can check how many lines have been touched each time you create a commit.

//
{
  "lint-staged": {
    "*": "lines-control --rules total,50,src/**/*"
  }
}

CI:github actions example

You can create a CI step like

  lines-control:
    runs-on: ubuntu-latest

    steps:
      - name: Load current commit
        uses: actions/checkout@v2
        with:
          ref: ${{ github.ref }}

     ...

      - name: Lines control
        run: yarn lines-control --rules totalInsertions,50 --comparisons origin/main

CLI help

$ npx lines-control -h

Usage: lines-control [options]

Options:
  -r, --rules <value...>     Rules for checking.
                             Types: total, totalInsertions;
                             example: total;50;src/**/* (default: [])
  -c, --comparisons <value>  Comparison of commits and branches
  -v, --vers                 output the current version
  -h, --help                 display help for command

  Example call:
    $ lines-control --rules total,25 totalInsertions,5,src/**/*
    $ lines-control --rules total,25 --comparisons master,feature/test-branch-name
    $ lines-control --rules total,25 --comparisons main
0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago