linguist-js
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -31,7 +31,14 @@ "use strict"; | ||
for (const arg in args) { | ||
if (typeof args[arg] !== 'string') | ||
continue; | ||
args[arg] = args[arg].replace(/^=/, ''); | ||
if (args[arg].match(/true$|false$/)) | ||
args[arg] = args[arg] === 'true'; | ||
const normalise = (val) => { | ||
if (typeof val !== 'string') | ||
return val; | ||
val = val.replace(/^=/, ''); | ||
if (val.match(/true$|false$/)) | ||
val = val === 'true'; | ||
return val; | ||
}; | ||
if (Array.isArray(args[arg])) | ||
args[arg] = args[arg].map(normalise); | ||
else | ||
args[arg] = normalise(args[arg]); | ||
} | ||
@@ -42,3 +49,2 @@ // Run Linguist | ||
var _a, _b; | ||
const root = args.analyze === true ? '.' : args.analyze; | ||
// Normalise array arguments | ||
@@ -50,8 +56,9 @@ if ((_a = args.ignore) === null || _a === void 0 ? void 0 : _a[0].match(/(?<!\\)[:;|]/)) | ||
// Fetch language data | ||
const root = args.analyze === true ? '.' : args.analyze; | ||
const { count, languages, results } = await index_1.default(root, args); | ||
// Make file paths relative | ||
for (const [file, lang] of Object.entries(results)) { | ||
const relFile = file.replace(path_1.default.resolve(root).replace(/\\/g, '/'), '.'); | ||
const relFile = file.replace(path_1.default.resolve().replace(/\\/g, '/'), '.'); | ||
delete results[file]; | ||
results[relFile] = lang; | ||
delete results[file]; | ||
} | ||
@@ -58,0 +65,0 @@ // Print output |
@@ -80,3 +80,3 @@ "use strict"; | ||
const ignoredPaths = opts.ignore.map(path => glob_to_regexp_1.default('*' + path + '*', { extended: true }).source); | ||
vendorData.push(...ignoredPaths); | ||
files = files.filter(file => !ignoredPaths.some(ignore => RegExp(ignore).test(file))); | ||
} | ||
@@ -83,0 +83,0 @@ // Load gitattributes |
{ | ||
"name": "linguist-js", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"description": "Analyse languages used in a folder. Powered by GitHub Linguist, although it doesn't need to be installed.", | ||
@@ -45,8 +45,8 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@types/glob-to-regexp": "^0.4.1", | ||
"@types/js-yaml": "^4.0.2", | ||
"@types/node": "ts4.3", | ||
"@types/glob-to-regexp": "ts4.4", | ||
"@types/js-yaml": "ts4.4", | ||
"@types/node": "ts4.4", | ||
"fast-deep-equal": "^3.1.3", | ||
"typescript": "~4.3.5" | ||
"typescript": "~4.4.1-rc" | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
28964
13
473