Skip to content

Commit

Permalink
2.5.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Nixinova committed Jun 26, 2022
1 parent 679c798 commit 97b4925
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 60 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

strategy:
matrix:
node-version: [17.x, 16.x, 14.x, 12.x]
node-version: [18.x, 17.x, 16.x, 14.x, 12.x]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 2 additions & 2 deletions build/download-files.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env tsx

import fs from 'fs/promises';
import fs from 'fs';
import path from 'path';

import loadFile from '../src/helpers/load-data';
Expand All @@ -9,7 +9,7 @@ async function writeFile(filename: string) {
const filePath = path.resolve('ext', filename);
const fileData = await loadFile(filename, false);
const fileContent = fileData.replace(/(\s+|^)#.*/g, '').replace(/\s+\n/g, '');
fs.writeFile(filePath, fileContent)
fs.promises.writeFile(filePath, fileContent)
.then(() => console.log(`Successfully wrote ${filename}.`))
.catch(() => console.log(`Failed to write ${filename}.`))
}
Expand Down
3 changes: 2 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Next
## 2.5.1
*2022-06-26*
- Fixed heuristics not being applied to files.
- Fixed heuristics with multiple rules not being parsed.

Expand Down
77 changes: 32 additions & 45 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "linguist-js",
"version": "2.5.0",
"version": "2.5.1",
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.",
"main": "dist/index.js",
"bin": {
Expand Down Expand Up @@ -40,7 +40,7 @@
"homepage": "https://github.com/Nixinova/Linguist#readme",
"dependencies": {
"binary-extensions": "^2.2.0",
"commander": "^9.2.0",
"commander": "^9.3.0",
"common-path-prefix": "^3.0.0",
"cross-fetch": "^3.1.5",
"ignore": "^5.2.0",
Expand All @@ -49,10 +49,9 @@
"node-cache": "^5.1.2"
},
"devDependencies": {
"@types/glob-to-regexp": "ts4.6",
"@types/js-yaml": "ts4.6",
"@types/node": "ts4.6",
"@types/js-yaml": "^4.0.5",
"@types/node": "ts4.7",
"deep-object-diff": "^1.1.7",
"typescript": "~4.6.4"
"typescript": "~4.7.4"
}
}
1 change: 0 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ Running LinguistJS on this folder will return the following JSON:
### Notes

- File paths in the output use only forward slashes as delimiters, even on Windows.
- This tool does not work when offline.
- Do not rely on any language classification output from LinguistJS being unchanged between runs.
Language data is fetched each run from the latest classifications of [`github-linguist`](https://github.com/github/linguist).
This data is subject to change at any time and may change the results of a run even when using the same version of Linguist.
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/load-data.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import fs from 'fs/promises';
import fs from 'fs';
import path from 'path';
import fetch from 'cross-fetch';
import Cache from 'node-cache';
Expand All @@ -18,7 +18,7 @@ async function loadWebFile(file: string): Promise<string> {

async function loadLocalFile(file: string): Promise<string> {
const filePath = path.resolve(__dirname, '../../ext', file);
return fs.readFile(filePath).then(buffer => buffer.toString());
return fs.promises.readFile(filePath).then(buffer => buffer.toString());
}

/** Load a data file from github-linguist. */
Expand Down
4 changes: 2 additions & 2 deletions test/expected.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"count": 7,
"bytes": 46,
"results": {
"~/al.al": "AL",
"~/al.al": "Perl",
"~/file.txt": "JavaScript",
"~/folder/sub.txt": "Text",
"~/hashbang": "JavaScript",
Expand All @@ -16,7 +16,7 @@
"count": 5,
"bytes": 37,
"results": {
"AL": { "type": "programming", "bytes": 0, "color": "#3AA2B5" },
"Perl": { "type": "programming", "bytes": 0, "color": "#0298c3" },
"JavaScript": { "type": "programming", "bytes": 22, "color": "#f1e05a" },
"Text": { "type": "prose", "bytes": 0 },
"C++": { "type": "programming", "bytes": 15, "color": "#f34b7d" },
Expand Down

0 comments on commit 97b4925

Please sign in to comment.