Comparing version 7.2.1 to 8.0.0
# Changelog | ||
## v8.0.0 | ||
- Yaspeller requires Node.js 12 or higher. | ||
- Reducing the size of dependencies #178 @alchazov. | ||
- CLI `no-colors` option replaced with `no-color`. | ||
## v7.2.1 | ||
@@ -4,0 +9,0 @@ - --ignore-tags Not work properly in Markdown files with HTML #176 |
'use strict'; | ||
const async = require('async'); | ||
const chalk = require('chalk'); | ||
const program = require('commander'); | ||
@@ -20,5 +19,2 @@ | ||
setDebugMode(program.debug); | ||
if (!program.colors) { | ||
chalk.level = 0; | ||
} | ||
@@ -25,0 +21,0 @@ const mergedOptions = getMergedOptions(program.config); |
@@ -33,3 +33,3 @@ 'use strict'; | ||
.option('--dictionary <file>', 'json file for own dictionary', value => splitTrim(value, ':')) | ||
.option('--no-colors', 'clean output without colors') | ||
.option('--no-color', 'clean output without colors') | ||
.option('--report <type>', 'generate a report: console, text, html or json. Default: "console"', splitByCommas) | ||
@@ -36,0 +36,0 @@ .option('--ignore-tags <tags>', `ignore tags. Default: "${defaultConfig.ignoreTags.join(',')}"`, splitByCommas) |
'use strict'; | ||
const cosmiconfig = require('cosmiconfig').cosmiconfigSync; | ||
const lilconfig = require('lilconfig').lilconfigSync; | ||
const stripJsonComments = require('strip-json-comments'); | ||
const parseJson = require('parse-json'); | ||
const sjson = require('secure-json-parse'); | ||
const path = require('path'); | ||
@@ -15,3 +15,3 @@ | ||
try { | ||
return parseJson(stripJsonComments(content)); | ||
return sjson.parse(stripJsonComments(content)); | ||
} catch (err) { | ||
@@ -34,3 +34,3 @@ err.message = `JSON Error in ${filepath}:\n${err.message}`; | ||
function getConfig(file) { | ||
const explorer = cosmiconfig('yaspeller', { | ||
const explorer = lilconfig('yaspeller', { | ||
loaders: { | ||
@@ -37,0 +37,0 @@ '.json': loadJson, |
const chalk = require('chalk'); | ||
const pico = require('picocolors'); | ||
@@ -12,15 +12,15 @@ const { jsonStringify } = require('./string'); | ||
function consoleInfo(data) { | ||
console.info(chalk.cyan(data)); | ||
console.info(pico.cyan(data)); | ||
} | ||
function consoleWarn(data) { | ||
console.warn(chalk.yellow(data)); | ||
console.warn(pico.yellow(data)); | ||
} | ||
function consoleError(data) { | ||
console.error(chalk.red(data)); | ||
console.error(pico.red(data)); | ||
} | ||
function consoleOk(data) { | ||
console.log(chalk.green(data)); | ||
console.log(pico.green(data)); | ||
} | ||
@@ -35,3 +35,3 @@ | ||
if (isDebugMode()) { | ||
const prefix = chalk.cyan('[DEBUG]'); | ||
const prefix = pico.cyan('[DEBUG]'); | ||
if (typeof text === 'object' && text) { | ||
@@ -41,3 +41,3 @@ console.log(prefix); | ||
Object.keys(text).forEach(key => { | ||
console.log(chalk.cyan(' ' + key + ': ') + jsonStringify(text[key])); | ||
console.log(pico.cyan(' ' + key + ': ') + jsonStringify(text[key])); | ||
}); | ||
@@ -44,0 +44,0 @@ } else { |
'use strict'; | ||
const chalk = require('chalk'); | ||
const pico = require('picocolors'); | ||
const program = require('commander'); | ||
@@ -39,16 +39,16 @@ | ||
if (pos.length) { | ||
comment.push(chalk.cyan(pos[0].line + ':' + pos[0].column)); | ||
comment.push(pico.cyan(pos[0].line + ':' + pos[0].column)); | ||
} | ||
if (el.count > 1) { | ||
comment.push(chalk.cyan('count: ' + el.count)); | ||
comment.push(pico.cyan('count: ' + el.count)); | ||
} | ||
if (hasEngRusLetters(el.word)) { | ||
comment.push(chalk.red('en: ' + replaceRusLettersWithAsterisk(el.word))); | ||
comment.push(chalk.green('ru: ' + replaceEngLettersWithAsterisk(el.word))); | ||
comment.push(pico.red('en: ' + replaceRusLettersWithAsterisk(el.word))); | ||
comment.push(pico.green('ru: ' + replaceEngLettersWithAsterisk(el.word))); | ||
} | ||
if (el.suggest) { | ||
comment.push(chalk.cyan('suggest: ' + el.suggest.join(', '))); | ||
comment.push(pico.cyan('suggest: ' + el.suggest.join(', '))); | ||
} | ||
@@ -74,3 +74,3 @@ | ||
if (hasManyErrors(data.data)) { | ||
errors.push(chalk.red('Too many errors\n')); | ||
errors.push(pico.red('Too many errors\n')); | ||
} | ||
@@ -81,3 +81,3 @@ | ||
if (typos.length) { | ||
errors.push(chalk.red(el.title + ': ' + | ||
errors.push(pico.red(el.title + ': ' + | ||
typos.length + '\n') + | ||
@@ -88,4 +88,4 @@ typos.join('\n') + '\n'); | ||
const time = data.time ? ' ' + chalk.magenta(data.time + ' ms') : ''; | ||
const separator = chalk.red('-----\n'); | ||
const time = data.time ? ' ' + pico.magenta(data.time + ' ms') : ''; | ||
const separator = pico.red('-----\n'); | ||
@@ -95,10 +95,10 @@ let res = data.resource; | ||
if (isUrl(res)) { | ||
res = chalk.underline(res); | ||
res = pico.underline(res); | ||
} | ||
if (errors.length) { | ||
console.error(chalk.red(errorSymbol) + ' ' + res + time + '\n' + | ||
console.error(pico.red(errorSymbol) + ' ' + res + time + '\n' + | ||
separator + errors.join('\n') + separator); | ||
} else { | ||
console.log(chalk.green(okSymbol) + ' ' + res + time); | ||
console.log(pico.green(okSymbol) + ' ' + res + time); | ||
} | ||
@@ -105,0 +105,0 @@ } |
@@ -11,4 +11,3 @@ 'use strict'; | ||
const yaspellerApi = require('yandex-speller'); | ||
const MarkdownIt = require('markdown-it'); | ||
const md = new MarkdownIt({ html: true }); | ||
const marked = require('marked'); | ||
@@ -67,3 +66,3 @@ const eyo = require('./plugins/eyo'); | ||
if (format === 'markdown') { | ||
text = md.render(text); | ||
text = marked(text); | ||
} | ||
@@ -70,0 +69,0 @@ |
@@ -13,3 +13,3 @@ { | ||
"description": "Search tool typos in the text, files and websites", | ||
"version": "7.2.1", | ||
"version": "8.0.0", | ||
"license": "MIT", | ||
@@ -36,6 +36,4 @@ "homepage": "https://github.com/hcodes/yaspeller", | ||
"dependencies": { | ||
"async": "^3.2.1", | ||
"chalk": "^4.1.2", | ||
"async": "^3.2.2", | ||
"commander": "^3.0.0", | ||
"cosmiconfig": "^7.0.1", | ||
"entities": "^3.0.1", | ||
@@ -46,6 +44,8 @@ "escape-html": "^1.0.3", | ||
"isutf8": "^3.1.1", | ||
"markdown-it": "^12.2.0", | ||
"lilconfig": "^2.0.3", | ||
"marked": "^3.0.8", | ||
"minimatch": "^3.0.4", | ||
"node-fetch": "^2.6.2", | ||
"parse-json": "^5.2.0", | ||
"picocolors": "^1.0.0", | ||
"secure-json-parse": "^2.4.0", | ||
"strip-json-comments": "^3.1.1", | ||
@@ -63,3 +63,3 @@ "xml2js": "^0.4.23", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12" | ||
}, | ||
@@ -66,0 +66,0 @@ "scripts": { |
@@ -6,2 +6,3 @@ yaspeller | ||
[![Coverage Status](https://img.shields.io/coveralls/hcodes/yaspeller.svg)](https://coveralls.io/r/hcodes/yaspeller) | ||
[![install size](https://packagephobia.com/badge?p=yaspeller)](https://packagephobia.com/result?p=yaspeller) | ||
@@ -135,3 +136,3 @@ <img align="right" width="200" src="https://raw.githubusercontent.com/hcodes/yaspeller/master/images/logo.png" /> | ||
#### `--no-colors` | ||
#### `--no-color` | ||
Clean output without colors. | ||
@@ -138,0 +139,0 @@ |
@@ -126,3 +126,3 @@ yaspeller | ||
#### `--no-colors` | ||
#### `--no-color` | ||
Консольный вывод без цвета. | ||
@@ -129,0 +129,0 @@ |
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
96185
308
2310
+ Addedlilconfig@^2.0.3
+ Addedmarked@^3.0.8
+ Addedpicocolors@^1.0.0
+ Addedsecure-json-parse@^2.4.0
+ Addedlilconfig@2.1.0(transitive)
+ Addedmarked@3.0.8(transitive)
+ Addedsecure-json-parse@2.7.0(transitive)
- Removedchalk@^4.1.2
- Removedcosmiconfig@^7.0.1
- Removedmarkdown-it@^12.2.0
- Removedparse-json@^5.2.0
- Removed@babel/code-frame@7.26.2(transitive)
- Removed@babel/helper-validator-identifier@7.25.9(transitive)
- Removed@types/parse-json@4.0.2(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedargparse@2.0.1(transitive)
- Removedcallsites@3.1.0(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcosmiconfig@7.1.0(transitive)
- Removedentities@2.1.0(transitive)
- Removederror-ex@1.3.2(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedimport-fresh@3.3.0(transitive)
- Removedis-arrayish@0.2.1(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjson-parse-even-better-errors@2.3.1(transitive)
- Removedlines-and-columns@1.2.4(transitive)
- Removedlinkify-it@3.0.3(transitive)
- Removedmarkdown-it@12.3.2(transitive)
- Removedmdurl@1.0.1(transitive)
- Removedparent-module@1.0.1(transitive)
- Removedparse-json@5.2.0(transitive)
- Removedpath-type@4.0.0(transitive)
- Removedresolve-from@4.0.0(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removeduc.micro@1.0.6(transitive)
- Removedyaml@1.10.2(transitive)
Updatedasync@^3.2.2