linguist-js 2.6.0 → 2.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +107 -107
- package/dist/helpers/convert-pcre.d.ts +2 -0
- package/dist/helpers/convert-pcre.js +38 -38
- package/dist/helpers/load-data.d.ts +4 -0
- package/dist/helpers/load-data.js +38 -31
- package/dist/helpers/read-file.d.ts +5 -0
- package/dist/helpers/read-file.js +23 -23
- package/dist/helpers/walk-tree.d.ts +20 -0
- package/dist/helpers/walk-tree.js +69 -64
- package/dist/index.d.ts +4 -4
- package/dist/index.js +418 -389
- package/dist/schema.d.ts +37 -37
- package/dist/schema.js +2 -2
- package/dist/types.d.ts +48 -48
- package/dist/types.js +2 -2
- package/ext/generated.rb +24 -399
- package/package.json +3 -4
- package/readme.md +33 -25
package/readme.md
CHANGED
|
@@ -4,13 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
# LinguistJS
|
|
6
6
|
|
|
7
|
-
Analyses the languages of all files in a given folder and collates the results.
|
|
7
|
+
Analyses the languages of all files in a given folder or folders and collates the results.
|
|
8
8
|
|
|
9
9
|
Powered by [github-linguist](https://github.com/github/linguist), although it doesn't need to be installed.
|
|
10
10
|
|
|
11
11
|
## Install
|
|
12
12
|
|
|
13
|
-
[Node.js](https://nodejs.org) must be installed to be able to use
|
|
13
|
+
[Node.js](https://nodejs.org) must be installed to be able to use LinguistJS.
|
|
14
|
+
|
|
14
15
|
LinguistJS is available [on npm](https://npmjs.com/package/linguist-js) as `linguist-js`.
|
|
15
16
|
|
|
16
17
|
Install locally using `npm install linguist-js` and import it into your code like so:
|
|
@@ -19,15 +20,16 @@ Install locally using `npm install linguist-js` and import it into your code lik
|
|
|
19
20
|
const linguist = require('linguist-js');
|
|
20
21
|
```
|
|
21
22
|
|
|
22
|
-
Or install globally using `npm install -g linguist-js` and run using the CLI command `linguist`.
|
|
23
|
+
Or install globally using `npm install -g linguist-js` and run using the CLI command `linguist` or `linguist-js`.
|
|
23
24
|
|
|
24
25
|
```
|
|
25
26
|
linguist --help
|
|
27
|
+
linguist-js --help
|
|
26
28
|
```
|
|
27
29
|
|
|
28
30
|
## Usage
|
|
29
31
|
|
|
30
|
-
LinguistJS contains one function which analyses a given folder.
|
|
32
|
+
LinguistJS contains one function which analyses a given folder or folders.
|
|
31
33
|
|
|
32
34
|
As an example, take the following file structure:
|
|
33
35
|
|
|
@@ -56,7 +58,7 @@ Running LinguistJS on this folder will return the following JSON:
|
|
|
56
58
|
"/x.pluginspec": "Ruby",
|
|
57
59
|
},
|
|
58
60
|
"alternatives": {
|
|
59
|
-
".pluginspec": ["XML"],
|
|
61
|
+
"/x.pluginspec": ["XML"],
|
|
60
62
|
},
|
|
61
63
|
},
|
|
62
64
|
"languages": {
|
|
@@ -99,7 +101,7 @@ const { files, languages, unknown } = linguist(folder, options);
|
|
|
99
101
|
```
|
|
100
102
|
|
|
101
103
|
- `linguist(entry?, opts?)` (default export):
|
|
102
|
-
Analyse the language of all files found in a folder.
|
|
104
|
+
Analyse the language of all files found in a folder or folders.
|
|
103
105
|
- `entry` (optional; string or string array):
|
|
104
106
|
The folder(s) to analyse (defaults to `./`).
|
|
105
107
|
- `opts` (optional; object):
|
|
@@ -143,50 +145,56 @@ const { files, languages, unknown } = linguist(folder, options);
|
|
|
143
145
|
### Command-line
|
|
144
146
|
|
|
145
147
|
```
|
|
146
|
-
linguist --analyze [<
|
|
148
|
+
linguist --analyze [<folders...>] [<options...>]
|
|
147
149
|
linguist --help
|
|
150
|
+
linguist --version
|
|
148
151
|
```
|
|
149
152
|
|
|
150
153
|
- `--analyze`:
|
|
151
|
-
Analyse the language of all files found in a folder.
|
|
152
|
-
-
|
|
154
|
+
Analyse the language of all files found in a folder or folders.
|
|
155
|
+
- `[<folders...>]`:
|
|
153
156
|
The folders to analyse (defaults to `./`).
|
|
154
|
-
- `--ignoredFiles <
|
|
157
|
+
- `--ignoredFiles <globs...>`:
|
|
155
158
|
A list of file path globs to ignore.
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
A list of languages to ignore.
|
|
159
|
+
- `--ignoredLanguages <languages...>`:
|
|
160
|
+
A list of languages to exclude from the output.
|
|
159
161
|
- `--categories <categories...>`:
|
|
160
|
-
A list of
|
|
162
|
+
A list of language categories that should be displayed in the output.
|
|
163
|
+
Must be one or more of `data`, `prose`, `programming`, `markup`.
|
|
161
164
|
- `--childLanguages`:
|
|
162
|
-
|
|
165
|
+
Display sub-languages instead of their parents, when possible.
|
|
163
166
|
- `--json`:
|
|
164
167
|
Display the outputted language data as JSON.
|
|
165
168
|
- `--tree <traversal>`:
|
|
166
169
|
A dot-delimited traversal to the nested object that should be logged to the console instead of the entire output.
|
|
167
170
|
Requires `--json` to be specified.
|
|
168
171
|
- `--quick`:
|
|
169
|
-
|
|
172
|
+
Skip the checking of `.gitattributes` and `.gitignore` files for manual language classifications.
|
|
170
173
|
Alias for `--checkAttributes=false --checkIgnored=false --checkHeuristics=false --checkShebang=false --checkModeline=false`.
|
|
171
174
|
- `--offline`:
|
|
172
175
|
Use pre-packaged metadata files instead of fetching them from GitHub at runtime.
|
|
173
176
|
- `--keepVendored`:
|
|
174
|
-
|
|
177
|
+
Include vendored files (auto-generated files, dependencies folder, etc) in the output.
|
|
175
178
|
- `--keepBinary`:
|
|
176
|
-
|
|
179
|
+
Include binary files in the output.
|
|
177
180
|
- `--relativePaths`:
|
|
178
181
|
Change the absolute file paths in the output to be relative to the current working directory.
|
|
179
182
|
- `--checkAttributes`:
|
|
180
|
-
Force the checking of `.gitatributes` files
|
|
183
|
+
Force the checking of `.gitatributes` files.
|
|
184
|
+
Use alongside `--quick` to override it disabling this option.
|
|
181
185
|
- `--checkIgnored`:
|
|
182
|
-
Force the checking of `.gitignore` files
|
|
186
|
+
Force the checking of `.gitignore` files.
|
|
187
|
+
Use alongside `--quick` to override it disabling this option.
|
|
183
188
|
- `--checkHeuristics`:
|
|
184
|
-
Apply heuristics to ambiguous languages
|
|
189
|
+
Apply heuristics to ambiguous languages.
|
|
190
|
+
Use alongside `--quick` to override it disabling this option.
|
|
185
191
|
- `--checkShebang`:
|
|
186
|
-
Check shebang (`#!`) lines for explicit classification
|
|
192
|
+
Check shebang (`#!`) lines for explicit classification.
|
|
193
|
+
Use alongside `--quick` to override it disabling this option.
|
|
187
194
|
- `--checkModeline`:
|
|
188
|
-
Check modelines for explicit classification
|
|
195
|
+
Check modelines for explicit classification.
|
|
196
|
+
Use alongside `--quick` to override it disabling this option.
|
|
189
197
|
- `--help`:
|
|
190
|
-
Display
|
|
198
|
+
Display the help message.
|
|
191
199
|
- `--version`:
|
|
192
|
-
Display the current version of
|
|
200
|
+
Display the current installed version of LinguistJS.
|