Add the github-linguist package
This commit only adds a single package and all of its transitive dependencies. The github-linguist package will be used for counting lines of code as a baseline for databases we are analyzing.
This commit is contained in:
parent
896b4ff181
commit
c4a84a93d4
152 changed files with 17057 additions and 24 deletions
71
node_modules/github-linguist/README.md
generated
vendored
Normal file
71
node_modules/github-linguist/README.md
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
# github-linguist
|
||||
|
||||
💻 Counts the number of lines of code, written in TypeScript.
|
||||
|
||||
**Warning:** This package uses regular expressions to approximate the lines of code in a project. The
|
||||
results are not 100% precise because the regular expressions can return mistakes in edge
|
||||
cases, for example if comment tokens are present inside of multiline strings.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- Node.js 6+
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
npm install github-linguist
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```bash
|
||||
yarn add github-linguist
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
You can use `loc` in you ternimal, or as a npm package in your projects.
|
||||
|
||||
### Command line mode
|
||||
|
||||
Supports counting lines of code of a file or directory.
|
||||
|
||||
#### 1. Lines of code in a single file
|
||||
|
||||
```bash
|
||||
# loc file <path>
|
||||
loc file src/index.ts
|
||||
```
|
||||
|
||||

|
||||
|
||||
#### 2. Lines of code in a directory
|
||||
|
||||
```bash
|
||||
# loc <pattern>
|
||||
loc dir **/*.ts
|
||||
```
|
||||
|
||||

|
||||
|
||||
### Third-party mode
|
||||
|
||||
```ts
|
||||
import { LocFile, LocDir } from 'github-linguist';
|
||||
|
||||
// for a file.
|
||||
const file = new LocFile(filePath);
|
||||
const { info } = file.getInfo();
|
||||
|
||||
// for a directory.
|
||||
const dir = new LocDir({
|
||||
cwd: // root directory, or leave blank to use process.cwd()
|
||||
include: // string or string[] containing path patterns to include (default include all)
|
||||
exclude: // string or string[] containing path patterns to exclude (default exclude none)
|
||||
});
|
||||
const { info } = dir.getInfo();
|
||||
```
|
||||
|
||||
## License
|
||||
|
||||
MIT License.
|
||||
Loading…
Add table
Add a link
Reference in a new issue