From 1ba8bdb35f7195a8b2e3c444a230d58c47863193 Mon Sep 17 00:00:00 2001 From: Konrad Dzwinel Date: Fri, 6 Apr 2018 11:42:20 +0200 Subject: [PATCH] Update most of libraries. Get rid of Sync and use native promises. --- .gitignore | 1 + bin/cmd.js | 6 +- lib/proofreader.js | 73 +++++----- lib/sourceloader.js | 3 +- package-lock.json | 311 +++++++++++++++++++++++++++--------------- package.json | 23 ++-- specs/proofreader.js | 1 - specs/sourceloader.js | 3 +- test.html | 1 + test.md | 1 + 10 files changed, 255 insertions(+), 168 deletions(-) create mode 100644 test.html create mode 100644 test.md diff --git a/.gitignore b/.gitignore index c3f8b30..ed48e43 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # Editors .idea +launch.json # Logs logs diff --git a/bin/cmd.js b/bin/cmd.js index 0305fd5..36d4815 100755 --- a/bin/cmd.js +++ b/bin/cmd.js @@ -7,7 +7,6 @@ var program = require('commander'); var mime = require('mime'); var marked = require('marked'); var clc = require('cli-color'); -var Promise = require('promise'); var config = require('../settings.json'); var Proofreader = require('../lib/proofreader.js'); var SourceLoader = require('../lib/sourceloader.js'); @@ -51,7 +50,7 @@ if (config.dictionaries['custom']) { } function toHTML(path, content) { - var mimeType = mime.lookup(path); + var mimeType = mime.getType(path); if (mimeType === 'text/markdown') { return marked(content); @@ -115,6 +114,9 @@ sourceLoader .then(function (result) { printResults(source.path, result); return result; + }) + .catch(function (error) { + console.error('Proofreading failed', error); }); })); }) diff --git a/lib/proofreader.js b/lib/proofreader.js index 270a6d9..4645cb7 100644 --- a/lib/proofreader.js +++ b/lib/proofreader.js @@ -1,6 +1,4 @@ -var Sync = require('sync'); var cheerio = require('cheerio'); -var Promise = require('promise'); var fs = require('fs'); var writeGood = require('write-good'); var nodehun = require('nodehun'); @@ -39,7 +37,7 @@ Proofreader.prototype.addDictionary = function (dicFilePath, affFilePath) { * @param {String} value */ Proofreader.prototype.setWhitelist = function (value) { - if(typeof value !== 'string') { + if (typeof value !== 'string') { throw new Error('Whitelist must be a string.'); } this._whitelist = value; @@ -50,7 +48,7 @@ Proofreader.prototype.setWhitelist = function (value) { * @param {String} value */ Proofreader.prototype.setBlacklist = function (value) { - if(typeof value !== 'string') { + if (typeof value !== 'string') { throw new Error('Blacklist must be a string.'); } this._blacklist = value; @@ -62,7 +60,7 @@ Proofreader.prototype.setBlacklist = function (value) { * @param {Object} settings */ Proofreader.prototype.setWriteGoodSettings = function (settings) { - if(settings !== undefined && typeof settings !== 'object') { + if (settings !== undefined && typeof settings !== 'object') { throw new Error('Blacklist must be a string.'); } this._writeGoodSettings = settings; @@ -80,52 +78,51 @@ Proofreader.prototype.proofread = function (html) { var blacklist = this._blacklist; var writeGoodSettings = this._writeGoodSettings; - return new Promise(function(resolve, reject) { - Sync(function () { - var suggestions = []; + return new Promise(function (resolve, reject) { + var suggestions = []; + var promises = []; - //Blacklisted elements are removed before text is processed - if(blacklist) { - $(blacklist).remove(); - } + //Blacklisted elements are removed before text is processed + if (blacklist) { + $(blacklist).remove(); + } + + //Only whitelisted elements are processed + $(whitelist).each(function () { + var text = $(this).text(); - //Only whitelisted elements are processed - $(whitelist).each(function () { - var text = $(this).text(); + //remove linebreaks from text + text = text.replace(/(\r\n|\n|\r)+/gm, " "); - //remove linebreaks from text - text = text.replace(/(\r\n|\n|\r)+/gm," "); + //replace ’ with ' + text = text.replace(/’/g, "'"); - //replace ’ with ' - text = text.replace(/’/g, "'"); + //replace multiple spaces with a single one + text = text.replace(/\s{2,}/g, ' '); - //replace multiple spaces with a single one - text = text.replace(/\s{2,}/g, ' '); + //trim text + text = text.trim(); - //trim text - text = text.trim(); + if (text.length) { + var writeGoodSuggestions = writeGood(text, writeGoodSettings); - if(text.length) { - var writeGoodSuggestions = writeGood(text, writeGoodSettings); - var spellcheckerSuggestions = dictionary ? spellcheck.sync(null, dictionary, text) : []; + var spellcheckResolve = null; + var promise = new Promise(function (r) { spellcheckResolve = r; }); + promises.push(promise); + spellcheck(dictionary, text, function (error, spellcheckerSuggestions) { suggestions.push({ text: text, suggestions: { writeGood: writeGoodSuggestions, - spelling: spellcheckerSuggestions + spelling: spellcheckerSuggestions || [] } - }) - } - }); - - return suggestions; - }, function (err, result) { - if(err) { - reject(err); - } else { - resolve(result); + }); + spellcheckResolve(); + }); } }); + + Promise.all(promises).then(function() {resolve(suggestions);}) }); -}; \ No newline at end of file +}; diff --git a/lib/sourceloader.js b/lib/sourceloader.js index 861f151..1402399 100644 --- a/lib/sourceloader.js +++ b/lib/sourceloader.js @@ -1,6 +1,5 @@ var fs = require('fs'); var request = require('request'); -var Promise = require('promise'); module.exports = SourceLoader; @@ -62,4 +61,4 @@ SourceLoader.prototype.add = function (source) { */ SourceLoader.prototype.load = function () { return Promise.all((this._sources).map(getSource)); -}; \ No newline at end of file +}; diff --git a/package-lock.json b/package-lock.json index 239d097..25dc006 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "proofreader", - "version": "0.6.5", + "version": "0.6.6", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -19,11 +19,6 @@ "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.1.1.tgz", "integrity": "sha1-styOx2XTBlN9cpHg5iHoSdJXPPk=" }, - "asap": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", - "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=" - }, "asn1": { "version": "0.1.11", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.1.11.tgz", @@ -110,15 +105,26 @@ } }, "cheerio": { - "version": "0.19.0", - "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.19.0.tgz", - "integrity": "sha1-dy5wFfLuKZZQltcepBdbdas1SSU=", + "version": "0.22.0", + "resolved": "https://registry.npmjs.org/cheerio/-/cheerio-0.22.0.tgz", + "integrity": "sha1-qbqoYKP5tZWmuBsahocxIe06Jp4=", "requires": { - "css-select": "1.0.0", + "css-select": "1.2.0", "dom-serializer": "0.1.0", "entities": "1.1.1", - "htmlparser2": "3.8.3", - "lodash": "3.10.1" + "htmlparser2": "3.9.2", + "lodash.assignin": "4.2.0", + "lodash.bind": "4.2.1", + "lodash.defaults": "4.2.0", + "lodash.filter": "4.6.0", + "lodash.flatten": "4.4.0", + "lodash.foreach": "4.5.0", + "lodash.map": "4.6.0", + "lodash.merge": "4.6.1", + "lodash.pick": "4.4.0", + "lodash.reduce": "4.6.0", + "lodash.reject": "4.6.0", + "lodash.some": "4.6.0" } }, "cli-color": { @@ -161,20 +167,20 @@ } }, "css-select": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.0.0.tgz", - "integrity": "sha1-sRIcpRhI3SZOIkTQWM7iVN7rRLA=", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/css-select/-/css-select-1.2.0.tgz", + "integrity": "sha1-KzoRBTnFNV8c2NMUYj6HCxIeyFg=", "requires": { "boolbase": "1.0.0", - "css-what": "1.0.0", - "domutils": "1.4.3", + "css-what": "2.1.0", + "domutils": "1.5.1", "nth-check": "1.0.1" } }, "css-what": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/css-what/-/css-what-1.0.0.tgz", - "integrity": "sha1-18wt9FGAZm+Z0rFEYmOUaeAPc2w=" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/css-what/-/css-what-2.1.0.tgz", + "integrity": "sha1-lGfQMsOM+u+58teVASUwYvh/ob0=" }, "ctype": { "version": "0.5.3", @@ -207,6 +213,15 @@ "type-detect": "0.1.1" } }, + "define-properties": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", + "requires": { + "foreach": "2.0.5", + "object-keys": "1.0.11" + } + }, "delayed-stream": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-0.0.5.tgz", @@ -240,21 +255,27 @@ "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=" }, "domhandler": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", - "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", + "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", "requires": { "domelementtype": "1.3.0" } }, "domutils": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.4.3.tgz", - "integrity": "sha1-CGVRN5bGswYDGFDhdVFrr4C3Km8=", + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", + "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", "requires": { + "dom-serializer": "0.1.0", "domelementtype": "1.3.0" } }, + "e-prime": { + "version": "0.10.2", + "resolved": "https://registry.npmjs.org/e-prime/-/e-prime-0.10.2.tgz", + "integrity": "sha1-6pN165hWNt6IATx6n7EprZ4V7/g=" + }, "entities": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", @@ -376,10 +397,10 @@ } } }, - "fibers": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fibers/-/fibers-2.0.0.tgz", - "integrity": "sha512-sLxo4rZVk7xLgAjb/6zEzHJfSALx6u6coN1z61XCOF7i6CyTdJawF4+RdpjCSeS8AP66eR2InScbYAz9RAVOgA==" + "foreach": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=" }, "forever-agent": { "version": "0.5.2", @@ -400,9 +421,19 @@ "version": "0.9.2", "resolved": "https://registry.npmjs.org/async/-/async-0.9.2.tgz", "integrity": "sha1-rqdNXmHB+JlhO/ZL2mbUx48v0X0=" + }, + "mime": { + "version": "1.2.11", + "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", + "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" } } }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, "glob": { "version": "3.2.11", "resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz", @@ -419,6 +450,11 @@ "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", "dev": true }, + "has-symbols": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.0.tgz", + "integrity": "sha1-uhqPGvKg/DllD1yFA2dwQSIGO0Q=" + }, "hawk": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/hawk/-/hawk-1.1.1.tgz", @@ -436,31 +472,16 @@ "integrity": "sha1-PTIkYrrfB3Fup+uFuviAec3c5QU=" }, "htmlparser2": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz", - "integrity": "sha1-mWwosZFRaovoZQGn15dX5ccMEGg=", + "version": "3.9.2", + "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", + "integrity": "sha1-G9+HrMoPP55T+k/M6w9LTLsAszg=", "requires": { "domelementtype": "1.3.0", - "domhandler": "2.3.0", + "domhandler": "2.4.1", "domutils": "1.5.1", - "entities": "1.0.0", - "readable-stream": "1.1.14" - }, - "dependencies": { - "domutils": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", - "requires": { - "dom-serializer": "0.1.0", - "domelementtype": "1.3.0" - } - }, - "entities": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz", - "integrity": "sha1-sph6o4ITR/zeZCsk/fyeT7cSvyY=" - } + "entities": "1.1.1", + "inherits": "2.0.3", + "readable-stream": "2.3.6" } }, "http-signature": { @@ -517,10 +538,65 @@ "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=" }, - "lodash": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-3.10.1.tgz", - "integrity": "sha1-W/Rejkm6QYnhfUgnid/RW9FAt7Y=" + "lodash.assignin": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.assignin/-/lodash.assignin-4.2.0.tgz", + "integrity": "sha1-uo31+4QesKPoBEIysOJjqNxqKKI=" + }, + "lodash.bind": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/lodash.bind/-/lodash.bind-4.2.1.tgz", + "integrity": "sha1-euMBfpOWIqwxt9fX3LGzTbFpDTU=" + }, + "lodash.defaults": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/lodash.defaults/-/lodash.defaults-4.2.0.tgz", + "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" + }, + "lodash.filter": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.filter/-/lodash.filter-4.6.0.tgz", + "integrity": "sha1-ZosdSYFgOuHMWm+nYBQ+SAtMSs4=" + }, + "lodash.flatten": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.flatten/-/lodash.flatten-4.4.0.tgz", + "integrity": "sha1-8xwiIlqWMtK7+OSt2+8kCqdlph8=" + }, + "lodash.foreach": { + "version": "4.5.0", + "resolved": "https://registry.npmjs.org/lodash.foreach/-/lodash.foreach-4.5.0.tgz", + "integrity": "sha1-Gmo16s5AEoDH8G3d7DUWWrJ+PlM=" + }, + "lodash.map": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.map/-/lodash.map-4.6.0.tgz", + "integrity": "sha1-dx7Hg540c9nEzeKLGTlMNWL09tM=" + }, + "lodash.merge": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/lodash.merge/-/lodash.merge-4.6.1.tgz", + "integrity": "sha512-AOYza4+Hf5z1/0Hztxpm2/xiPZgi/cjMqdnKTUWTBSKchJlxXXuUSxCCl8rJlf4g6yww/j6mA8nC8Hw/EZWxKQ==" + }, + "lodash.pick": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", + "integrity": "sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM=" + }, + "lodash.reduce": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reduce/-/lodash.reduce-4.6.0.tgz", + "integrity": "sha1-8atrg5KZrUj3hKu/R2WW8DuRTTs=" + }, + "lodash.reject": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.reject/-/lodash.reject-4.6.0.tgz", + "integrity": "sha1-gNZJLcFHCGS79YNTO2UfQqn1JBU=" + }, + "lodash.some": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/lodash.some/-/lodash.some-4.6.0.tgz", + "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=" }, "lru-cache": { "version": "2.7.3", @@ -537,9 +613,9 @@ } }, "marked": { - "version": "0.3.17", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.17.tgz", - "integrity": "sha512-+AKbNsjZl6jFfLPwHhWmGTqE009wTKn3RTmn9K8oUKHrX/abPJjtcRtXpYB/FFrwPJRUA86LX/de3T0knkPCmQ==" + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", + "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==" }, "memoizee": { "version": "0.3.10", @@ -556,9 +632,9 @@ } }, "mime": { - "version": "1.2.11", - "resolved": "https://registry.npmjs.org/mime/-/mime-1.2.11.tgz", - "integrity": "sha1-WCA+7Ybjpe8XrtK32evUfwpg3RA=" + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/mime/-/mime-2.2.2.tgz", + "integrity": "sha512-A7PDg4s48MkqFEcYg2b069m3DXOEq7hx+9q9rIFrSSYfzsh35GX+LOVMQ8Au0ko7d8bSQCIAuzkjp0vCtwENlQ==" }, "mime-types": { "version": "1.0.2", @@ -617,14 +693,10 @@ } }, "mock-fs": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-2.7.1.tgz", - "integrity": "sha1-xynfQ1stEyL4YIBRysCkwFzPUdc=", - "dev": true, - "requires": { - "rewire": "2.0.1", - "semver": "4.3.6" - } + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/mock-fs/-/mock-fs-4.4.2.tgz", + "integrity": "sha512-dF+yxZSojSiI8AXGoxj5qdFWpucndc54Ug+TwlpHFaV7j22MGG+OML2+FVa6xAZtjb/OFFQhOC37Jegx2GbEwA==", + "dev": true }, "ms": { "version": "0.7.1", @@ -722,23 +794,36 @@ "resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.5.0.tgz", "integrity": "sha1-12f1FpMlYg6rLgh+8MRy53PbZGE=" }, + "object-keys": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", + "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=" + }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "requires": { + "define-properties": "1.1.2", + "function-bind": "1.1.1", + "has-symbols": "1.0.0", + "object-keys": "1.0.11" + } + }, "partial": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/partial/-/partial-0.0.3.tgz", "integrity": "sha1-LRB77Zj86o0o12ZUlbOeYd/NGMY=" }, "passive-voice": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/passive-voice/-/passive-voice-0.0.1.tgz", - "integrity": "sha1-ap4fvBynS1esNfD8+Ku0UL/KKsg=" + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/passive-voice/-/passive-voice-0.1.0.tgz", + "integrity": "sha1-Fv+RrkC6DpLEPmcXY/3IQqcCcLE=" }, - "promise": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/promise/-/promise-7.0.1.tgz", - "integrity": "sha1-ODtJE2yywlniZVIJeCgSg9QPr94=", - "requires": { - "asap": "2.0.6" - } + "process-nextick-args": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", + "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==" }, "propagate": { "version": "0.3.1", @@ -757,14 +842,32 @@ "integrity": "sha1-6eha2+ddoLvkyOBHaghikPhjtAQ=" }, "readable-stream": { - "version": "1.1.14", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.14.tgz", - "integrity": "sha1-fPTFTvZI44EwhMY23SB54WbAgdk=", + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "requires": { "core-util-is": "1.0.2", "inherits": "2.0.3", - "isarray": "0.0.1", - "string_decoder": "0.10.31" + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.1", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + }, + "dependencies": { + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" + }, + "string_decoder": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", + "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", + "requires": { + "safe-buffer": "5.1.1" + } + } } }, "request": { @@ -790,17 +893,10 @@ "tunnel-agent": "0.4.3" } }, - "rewire": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/rewire/-/rewire-2.0.1.tgz", - "integrity": "sha1-luU9clO3v6XYFZ+co5gHNlJE5X8=", - "dev": true - }, - "semver": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/semver/-/semver-4.3.6.tgz", - "integrity": "sha1-MAvG4OhjdPe6YQaLWx7NV/xlMto=", - "dev": true + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "sigmund": { "version": "1.0.1", @@ -832,14 +928,6 @@ "integrity": "sha1-/x7R5hFp0Gs88tWI4YixjYhH4X4=", "dev": true }, - "sync": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/sync/-/sync-0.2.3.tgz", - "integrity": "sha1-OQvJxxjrLoflyybKp13pDG6Om9w=", - "requires": { - "fibers": "2.0.0" - } - }, "timers-ext": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.4.tgz", @@ -894,19 +982,26 @@ "array-unique": "0.1.1" } }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" + }, "weasel-words": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/weasel-words/-/weasel-words-0.1.1.tgz", "integrity": "sha1-cTeUZYXHP+RIggE4U70ADF1oek4=" }, "write-good": { - "version": "0.9.1", - "resolved": "https://registry.npmjs.org/write-good/-/write-good-0.9.1.tgz", - "integrity": "sha1-ouo0hpv6Xv/H+DJUZ+JXFP5QEpo=", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/write-good/-/write-good-0.11.3.tgz", + "integrity": "sha512-fDKIHO5wCzTLCOGNJl1rzzJrZlTIzfZl8msOoJQZzRhYo0X/tFTm4+2B1zTibFYK01Nnd1kLZBjj4xjcFLePNQ==", "requires": { "adverb-where": "0.0.9", + "e-prime": "0.10.2", "no-cliches": "0.1.0", - "passive-voice": "0.0.1", + "object.assign": "4.1.0", + "passive-voice": "0.1.0", "too-wordy": "0.1.4", "weasel-words": "0.1.1" } diff --git a/package.json b/package.json index 51dfcc3..0bb6b9a 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "proofreader", "description": "Simple text proofreader based on 'write-good' (hemingway-app-like suggestions) and 'nodehun' (spelling).", - "version": "0.6.6", + "version": "1.0.0", "repository": { "type": "git", "url": "git://github.com/kdzwinel/Proofreader.git" @@ -10,12 +10,7 @@ "url": "http://github.com/kdzwinel/Proofreader/issues" }, "author": "Konrad Dzwinel ", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/kdzwinel/Proofreader/blob/master/LICENSE" - } - ], + "license": "MIT", "keywords": [ "spelling", "spellcheck", @@ -29,17 +24,15 @@ "test": "mocha specs --require specs/helpers/chai.js" }, "dependencies": { - "cheerio": "^0.19.0", + "cheerio": "^0.22.0", "cli-color": "^1.0.0", "commander": "^2.5.0", - "marked": "^0.3.9", - "mime": "^1.2.11", - "nodehun": "^2.0.4", - "nodehun-sentences": "^1.0.1", - "promise": "^7.0.1", + "marked": "^0.3.18", + "mime": "^2.2.2", + "nodehun": "^2.0.11", + "nodehun-sentences": "^1.0.4", "request": "^2.49.0", - "sync": "^0.2.3", - "write-good": "^0.9.1" + "write-good": "^0.11.3" }, "devDependencies": { "chai": "^2.0.0", diff --git a/specs/proofreader.js b/specs/proofreader.js index be856d7..9f0af33 100644 --- a/specs/proofreader.js +++ b/specs/proofreader.js @@ -1,5 +1,4 @@ var Proofreader = require('../lib/proofreader.js'); -var Promise = require('promise'); //FIXME: hack that fixes the tests, more info here: https://stackoverflow.com/questions/30683061/testing-synchronous-code setInterval(function(){}, 10); diff --git a/specs/sourceloader.js b/specs/sourceloader.js index 4535149..f2effb2 100644 --- a/specs/sourceloader.js +++ b/specs/sourceloader.js @@ -1,4 +1,3 @@ -var Promise = require('promise'); var nock = require('nock'); var mockfs = require('mock-fs'); var SourceLoader = require('../lib/sourceloader.js'); @@ -78,4 +77,4 @@ describe("SourceLoader", function() { }); }); }); -}); \ No newline at end of file +}); diff --git a/test.html b/test.html new file mode 100644 index 0000000..c0940c3 --- /dev/null +++ b/test.html @@ -0,0 +1 @@ +

Some expmle text with errrors.

diff --git a/test.md b/test.md new file mode 100644 index 0000000..db6a69d --- /dev/null +++ b/test.md @@ -0,0 +1 @@ +Some expmle text with errrors.