From d924bb8ba99685bd5549caa2a06ab9f62d4ba36a Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Thu, 26 Jul 2018 16:21:48 +0800 Subject: [PATCH 1/7] [feat] Support inspect .vue files. --- bin/jsinspect | 24 +-- lib/inspector.js | 5 + lib/vue-parser.js | 77 ++++++++ package-lock.json | 463 ++++++++++++++++++++++++++++++++++++++++++++++ package.json | 4 +- 5 files changed, 560 insertions(+), 13 deletions(-) create mode 100644 lib/vue-parser.js create mode 100644 package-lock.json diff --git a/bin/jsinspect b/bin/jsinspect index dc15bef..a1b5dd7 100755 --- a/bin/jsinspect +++ b/bin/jsinspect @@ -1,11 +1,11 @@ #!/usr/bin/env node -var fs = require('fs'); -var path = require('path'); -var strip = require('strip-json-comments'); -var chalk = require('chalk'); +var fs = require('fs'); +var path = require('path'); +var strip = require('strip-json-comments'); +var chalk = require('chalk'); var filepaths = require('filepaths'); -var program = require('commander'); +var program = require('commander'); var Inspector = require('../lib/inspector'); var reporters = require('../lib/reporters'); @@ -49,7 +49,7 @@ if (fs.existsSync(rcPath) && fs.lstatSync(rcPath).isFile()) { } ['threshold', 'identifiers', 'literals', 'ignore', 'minInstances', - 'reporter', 'truncate'].forEach((option) => { + 'reporter', 'truncate'].forEach((option) => { if (program[option] === undefined && (option in rc)) { program[option] = rc[option]; } @@ -73,13 +73,13 @@ if (program.ignore) { ignorePatterns.push(program.ignore); } -var extensions = ['.js', '.jsx']; +var extensions = ['.js', '.jsx', '.vue']; try { paths = filepaths.getSync(suppliedPaths, { ext: extensions, ignore: ignorePatterns }); -} catch(e) { +} catch (e) { console.log(e.message); process.exit(4); } @@ -90,9 +90,9 @@ if (!paths.length) { } var inspector = new Inspector(paths, { - threshold: program.threshold, - identifiers: program.identifiers, - literals: program.literals, + threshold: program.threshold, + identifiers: program.identifiers, + literals: program.literals, minInstances: program.minInstances }); @@ -109,7 +109,7 @@ inspector.on('match', () => matches++); try { inspector.run(); process.exit(matches ? 5 : 0); -} catch(err) { +} catch (err) { console.log(err); process.exit(1); } diff --git a/lib/inspector.js b/lib/inspector.js index a257dcc..44d8f62 100644 --- a/lib/inspector.js +++ b/lib/inspector.js @@ -4,6 +4,8 @@ var fs = require('fs'); var parse = require('./parser').parse; var Match = require('./match'); var NodeUtils = require('./nodeUtils'); +var parseVueFile = require('./vue-parser').parseVueFile; +var path = require('path'); var crypto = require('crypto'); var stable = require('stable'); @@ -54,6 +56,9 @@ class Inspector extends EventEmitter { // File contents are split to allow for specific line extraction this._filePaths.forEach((filePath) => { var src = fs.readFileSync(filePath, {encoding: 'utf8'}); + if (path.extname(filePath) === '.vue') { + src = parseVueFile(src); + } this._fileContents[filePath] = src.split('\n'); try { var syntaxTree = parse(src, filePath); diff --git a/lib/vue-parser.js b/lib/vue-parser.js new file mode 100644 index 0000000..f93d8e9 --- /dev/null +++ b/lib/vue-parser.js @@ -0,0 +1,77 @@ +var parse5 = require('parse5'); +var deindent = require('de-indent'); + +var splitRE = /\r?\n/g; +var emptyRE = /^\s*$/; +var commentSymbols = { + 'iced': '#', + 'iced-jsx': '#', + 'iced-redux': '#', + 'coffee': '#', + 'coffee-jsx': '#', + 'coffee-redux': '#', + 'purs': '--', + 'ulmus': '--' +}; + +exports.parseVueFile = function (content) { + var result = ''; + + var fragment = parse5.parseFragment(content, { + locationInfo: true + }); + + fragment.childNodes.forEach(function (node) { + var type = node.tagName; + var lang = getAttribute(node, 'lang'); + + // skip empty script tags + if (type === 'script') { + if (!node.childNodes || !node.childNodes.length) { + return; + } + + // extract part + var start = node.childNodes[0].__location.startOffset; + var end = node.childNodes[node.childNodes.length - 1].__location.endOffset; + + // preserve other parts as commenets so that linters + // and babel can output correct line numbers in warnings + result = commentScript(content.slice(0, start), lang) + + deindent(content.slice(start, end)) + + commentScript(content.slice(end), lang); + } + }); + + return result; +} + +function commentScript(content, lang) { + var symbol = getCommentSymbol(lang); + var lines = content.split(splitRE); + return lines.map(function (line, index) { + // preserve EOL + if (index === lines.length - 1 && emptyRE.test(line)) { + return ''; + } else { + return symbol + (emptyRE.test(line) ? '' : ' ' + line); + } + }).join('\n'); +} + +function getCommentSymbol(lang) { + return commentSymbols[lang] || '//'; +} + +function getAttribute(node, name) { + if (node.attrs) { + var i = node.attrs.length; + var attr; + while (i--) { + attr = node.attrs[i]; + if (attr.name === name) { + return attr.value; + } + } + } +} diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..1db0019 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,463 @@ +{ + "name": "jsinspect", + "version": "0.12.7", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "requires": { + "color-convert": "1.9.2" + } + }, + "babylon": { + "version": "6.16.1", + "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.16.1.tgz", + "integrity": "sha1-MMWiL0gZeKnn+M399JaxHZS0BNM=" + }, + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "1.0.0", + "concat-map": "0.0.1" + } + }, + "browser-stdout": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.0.tgz", + "integrity": "sha1-81HTKWnTL6XXpVZxVCY9korjvR8=", + "dev": true + }, + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" + } + }, + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", + "requires": { + "color-name": "1.1.1" + } + }, + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=" + }, + "commander": { + "version": "2.16.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.16.0.tgz", + "integrity": "sha512-sVXqklSaotK9at437sFlFpyOcJonxe0yST/AG9DkQKUdIE6IqGIMv4SfAQSKaJbSdVEJYItASCrBiVQHq1HQew==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "concat-stream": { + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", + "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", + "dev": true, + "requires": { + "buffer-from": "1.1.0", + "inherits": "2.0.3", + "readable-stream": "2.3.6", + "typedarray": "0.0.6" + } + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true + }, + "de-indent": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/de-indent/-/de-indent-1.0.2.tgz", + "integrity": "sha1-sgOOhG3DO6pXlhKNCAS0VbjB4h0=" + }, + "debug": { + "version": "2.6.8", + "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.8.tgz", + "integrity": "sha1-5zFTHKLt4n0YgiJCfaF4IdaP9Pw=", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "diff": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.2.0.tgz", + "integrity": "sha1-yc45Okt8vQsFinJck98pkCeGj/k=", + "dev": true + }, + "dirmap": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/dirmap/-/dirmap-0.0.2.tgz", + "integrity": "sha1-f4Cn2ZLZ/q2talqww90okesF5+Q=", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" + }, + "expect.js": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/expect.js/-/expect.js-0.3.1.tgz", + "integrity": "sha1-sKWaDS7/VDdUTr8M6qYBWEHQm1s=", + "dev": true + }, + "filepaths": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/filepaths/-/filepaths-0.3.0.tgz", + "integrity": "sha1-ocmkYBturn+4dvwayYR5zrVXwXc=" + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "dev": true + }, + "get-stdin": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-4.0.1.tgz", + "integrity": "sha1-uWjGsKBDhDJJAui/Gl3zJXmkUP4=" + }, + "glob": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.1.tgz", + "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", + "dev": true, + "requires": { + "fs.realpath": "1.0.0", + "inflight": "1.0.6", + "inherits": "2.0.3", + "minimatch": "3.0.4", + "once": "1.4.0", + "path-is-absolute": "1.0.1" + } + }, + "graceful-readlink": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/graceful-readlink/-/graceful-readlink-1.0.1.tgz", + "integrity": "sha1-TK+tdrxi8C+gObL5Tpo906ORpyU=", + "dev": true + }, + "growl": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.9.2.tgz", + "integrity": "sha1-Dqd0NxXbjY3ixe3hd14bRayFwC8=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", + "dev": true + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "dev": true, + "requires": { + "once": "1.4.0", + "wrappy": "1.0.2" + } + }, + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", + "dev": true + }, + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", + "dev": true + }, + "json3": { + "version": "3.3.2", + "resolved": "https://registry.npmjs.org/json3/-/json3-3.3.2.tgz", + "integrity": "sha1-PAQ0dD35Pi9cQq7nsZvLSDV19OE=", + "dev": true + }, + "lodash._baseassign": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/lodash._baseassign/-/lodash._baseassign-3.2.0.tgz", + "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", + "dev": true, + "requires": { + "lodash._basecopy": "3.0.1", + "lodash.keys": "3.1.2" + } + }, + "lodash._basecopy": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/lodash._basecopy/-/lodash._basecopy-3.0.1.tgz", + "integrity": "sha1-jaDmqHbPNEwK2KVIghEd08XHyjY=", + "dev": true + }, + "lodash._basecreate": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash._basecreate/-/lodash._basecreate-3.0.3.tgz", + "integrity": "sha1-G8ZhYU2qf8MRt9A78WgGoCE8+CE=", + "dev": true + }, + "lodash._getnative": { + "version": "3.9.1", + "resolved": "https://registry.npmjs.org/lodash._getnative/-/lodash._getnative-3.9.1.tgz", + "integrity": "sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U=", + "dev": true + }, + "lodash._isiterateecall": { + "version": "3.0.9", + "resolved": "https://registry.npmjs.org/lodash._isiterateecall/-/lodash._isiterateecall-3.0.9.tgz", + "integrity": "sha1-UgOte6Ql+uhCRg5pbbnPPmqsBXw=", + "dev": true + }, + "lodash.create": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/lodash.create/-/lodash.create-3.1.1.tgz", + "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", + "dev": true, + "requires": { + "lodash._baseassign": "3.2.0", + "lodash._basecreate": "3.0.3", + "lodash._isiterateecall": "3.0.9" + } + }, + "lodash.isarguments": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/lodash.isarguments/-/lodash.isarguments-3.1.0.tgz", + "integrity": "sha1-L1c9hcaiQon/AGY7SRwdM4/zRYo=", + "dev": true + }, + "lodash.isarray": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/lodash.isarray/-/lodash.isarray-3.0.4.tgz", + "integrity": "sha1-eeTriMNqgSKvhvhEqpvNhRtfu1U=", + "dev": true + }, + "lodash.keys": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/lodash.keys/-/lodash.keys-3.1.2.tgz", + "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", + "dev": true, + "requires": { + "lodash._getnative": "3.9.1", + "lodash.isarguments": "3.1.0", + "lodash.isarray": "3.0.4" + } + }, + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "dev": true, + "requires": { + "brace-expansion": "1.1.11" + } + }, + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", + "dev": true + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "dev": true, + "requires": { + "minimist": "0.0.8" + } + }, + "mocha": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-3.5.3.tgz", + "integrity": "sha512-/6na001MJWEtYxHOV1WLfsmR4YIynkUEhBwzsb+fk2qmQ3iqsi258l/Q2MWHJMImAcNpZ8DEdYAK72NHoIQ9Eg==", + "dev": true, + "requires": { + "browser-stdout": "1.3.0", + "commander": "2.9.0", + "debug": "2.6.8", + "diff": "3.2.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.1", + "growl": "1.9.2", + "he": "1.1.1", + "json3": "3.3.2", + "lodash.create": "3.1.1", + "mkdirp": "0.5.1", + "supports-color": "3.1.2" + }, + "dependencies": { + "commander": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.9.0.tgz", + "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", + "dev": true, + "requires": { + "graceful-readlink": "1.0.1" + } + }, + "has-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz", + "integrity": "sha1-nZ55MWXOAXoA8AQYxD+UKnsdEfo=", + "dev": true + }, + "supports-color": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz", + "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", + "dev": true, + "requires": { + "has-flag": "1.0.0" + } + } + } + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "dev": true, + "requires": { + "wrappy": "1.0.2" + } + }, + "parse5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/parse5/-/parse5-2.2.3.tgz", + "integrity": "sha1-DE/EHBAAxea5PUiwP4CDg3g06fY=" + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "dev": true + }, + "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==", + "dev": true + }, + "readable-stream": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", + "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", + "dev": true, + "requires": { + "core-util-is": "1.0.2", + "inherits": "2.0.3", + "isarray": "1.0.0", + "process-nextick-args": "2.0.0", + "safe-buffer": "5.1.2", + "string_decoder": "1.1.1", + "util-deprecate": "1.0.2" + } + }, + "safe-buffer": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", + "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", + "dev": true + }, + "stable": { + "version": "0.1.8", + "resolved": "https://registry.npmjs.org/stable/-/stable-0.1.8.tgz", + "integrity": "sha512-ji9qxRnOVfcuLDySj9qzhGSEFVobyt1kIOSkj1qZzYLzq7Tos/oUUWvotUPQLlrsidqsK6tBH89Bc9kL5zHA6w==" + }, + "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==", + "dev": true, + "requires": { + "safe-buffer": "5.1.2" + } + }, + "strip-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", + "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", + "requires": { + "get-stdin": "4.0.1" + } + }, + "strip-json-comments": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz", + "integrity": "sha1-WkirlgI9usG3uND/q/b2PxZ3vp8=" + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "3.0.0" + } + }, + "typedarray": { + "version": "0.0.6", + "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", + "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "dev": true + }, + "util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "dev": true + } + } +} diff --git a/package.json b/package.json index 319b456..96d9c96 100644 --- a/package.json +++ b/package.json @@ -25,7 +25,9 @@ "filepaths": "0.3.0", "stable": "^0.1.6", "strip-indent": "^1.0.1", - "strip-json-comments": "1.0.2" + "strip-json-comments": "1.0.2", + "de-indent": "^1.0.2", + "parse5": "^2.1.0" }, "devDependencies": { "concat-stream": "^1.5.0", From 58044da4eb0901f80b1e256d7efb6dad2d2cc119 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Thu, 26 Jul 2018 16:23:27 +0800 Subject: [PATCH 2/7] [test] Add .vue file inspect feature test --- spec/fixtures/vueFile.vue | 29 ++++++++++++++++ spec/inspectorSpec.js | 71 +++++++++++++++++++++++++-------------- 2 files changed, 74 insertions(+), 26 deletions(-) create mode 100644 spec/fixtures/vueFile.vue diff --git a/spec/fixtures/vueFile.vue b/spec/fixtures/vueFile.vue new file mode 100644 index 0000000..66a15bc --- /dev/null +++ b/spec/fixtures/vueFile.vue @@ -0,0 +1,29 @@ + + + + + \ No newline at end of file diff --git a/spec/inspectorSpec.js b/spec/inspectorSpec.js index a135fc2..53ae23e 100644 --- a/spec/inspectorSpec.js +++ b/spec/inspectorSpec.js @@ -1,47 +1,47 @@ -var expect = require('expect.js'); +var expect = require('expect.js'); var EventEmitter = require('events').EventEmitter; -var Inspector = require('../lib/inspector'); -var fixtures = require('./fixtures'); +var Inspector = require('../lib/inspector'); +var fixtures = require('./fixtures'); -describe('Inspector', function() { +describe('Inspector', function () { // Used to test emitted events var found; - var listener = function(match) { + var listener = function (match) { found.push(match); }; - beforeEach(function() { + beforeEach(function () { found = []; }); - describe('constructor', function() { - it('inherits from EventEmitter', function() { + describe('constructor', function () { + it('inherits from EventEmitter', function () { expect(new Inspector()).to.be.an(EventEmitter); }); - it('accepts an array of file paths', function() { + it('accepts an array of file paths', function () { var filePaths = ['path1.js', 'path2.js']; var inspector = new Inspector(filePaths); expect(inspector._filePaths).to.be(filePaths); }); - it('assigns a default threshold of 30', function() { + it('assigns a default threshold of 30', function () { var inspector = new Inspector([]); expect(inspector._threshold).to.be(30); }); - it('accepts an options object', function() { + it('accepts an options object', function () { var opts = {threshold: 12}; var inspector = new Inspector([], opts); expect(inspector._threshold).to.be(opts.threshold); }); }); - describe('run', function() { - it('emits a start event', function() { + describe('run', function () { + it('emits a start event', function () { var emitted; var inspector = new Inspector([fixtures.intersection]); - inspector.on('start', function() { + inspector.on('start', function () { emitted = true; }); @@ -49,10 +49,10 @@ describe('Inspector', function() { expect(emitted).to.be(true); }); - it('emits an end event', function() { + it('emits an end event', function () { var emitted; var inspector = new Inspector([fixtures.intersection]); - inspector.on('end', function() { + inspector.on('end', function () { emitted = true; }); @@ -60,7 +60,7 @@ describe('Inspector', function() { expect(emitted).to.be(true); }); - it('emits the "match" event when a match is found', function() { + it('emits the "match" event when a match is found', function () { var inspector = new Inspector([fixtures.intersection], { threshold: 10 }); @@ -71,7 +71,7 @@ describe('Inspector', function() { }); }); - it('can find an exact match between instances', function() { + it('can find an exact match between instances', function () { var inspector = new Inspector([fixtures.intersection], { threshold: 15 }); @@ -88,7 +88,7 @@ describe('Inspector', function() { expect(match.instances[1].end).to.eql({line: 11, column: 1}); }); - it('can find the largest match between two instances', function() { + it('can find the largest match between two instances', function () { var inspector = new Inspector([fixtures.redundantIntersection], { threshold: 11 }); @@ -105,7 +105,7 @@ describe('Inspector', function() { expect(match.instances[1].end).to.eql({line: 19, column: 1}); }); - it('supports ES6', function() { + it('supports ES6', function () { var inspector = new Inspector([fixtures.es6ClassExport], { threshold: 20 }); @@ -122,7 +122,7 @@ describe('Inspector', function() { expect(match.instances[1].end).to.eql({line: 12, column: 3}); }); - it('supports JSX', function() { + it('supports JSX', function () { var inspector = new Inspector([fixtures.jsxTodo], { threshold: 20 }); @@ -139,7 +139,7 @@ describe('Inspector', function() { expect(match.instances[1].end).to.eql({line: 17, column: 1}); }); - it('supports Flow', function() { + it('supports Flow', function () { var inspector = new Inspector([fixtures.flowIntersection], { threshold: 20 }); @@ -156,7 +156,7 @@ describe('Inspector', function() { expect(match.instances[1].end).to.eql({line: 11, column: 1}); }); - it('includes the lines with the match', function() { + it('includes the lines with the match', function () { var inspector = new Inspector([fixtures.intersection], { threshold: 11, }); @@ -183,7 +183,7 @@ describe('Inspector', function() { ); }); - it('ignores matches with less than the supplied minimum', function() { + it('ignores matches with less than the supplied minimum', function () { var inspector = new Inspector([fixtures.matches], { threshold: 2, minInstances: 3 @@ -195,7 +195,7 @@ describe('Inspector', function() { expect(found[0].instances).to.have.length(3); }); - it('ignores CommonJS require statements', function() { + it('ignores CommonJS require statements', function () { var inspector = new Inspector([fixtures.commonjs], { threshold: 3 }); @@ -205,7 +205,7 @@ describe('Inspector', function() { expect(found).to.have.length(0); }); - it('ignores AMD define expressions', function() { + it('ignores AMD define expressions', function () { var inspector = new Inspector([fixtures.amd], { threshold: 5 }); @@ -214,4 +214,23 @@ describe('Inspector', function() { inspector.run(); expect(found).to.have.length(0); }); + + it('supports Vue', function () { + console.log(fixtures.vueFile) + var inspector = new Inspector([fixtures.vueFile], { + threshold: 10 + }); + + inspector.on('match', listener); + inspector.run(); + + var match = found[0]; + expect(found).to.have.length(1); + expect(match.instances).to.have.length(2); + expect(match.instances[0].start.line).to.eql(12); + expect(match.instances[0].end.line).to.eql(16); + expect(match.instances[1].start.line).to.eql(17); + expect(match.instances[1].end.line).to.eql(22); + }) }); + From 0394908ce22e04a642dbd0fcf0b8c0a52041a712 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Thu, 26 Jul 2018 16:24:02 +0800 Subject: [PATCH 3/7] ignore .idea/ folder --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 8eb574b..04927c1 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,5 @@ node_modules .grunt .DS_Store + +.idea/ From 5a2e2594a0021715ae5e81c7a3c661ca90ff2f69 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Thu, 26 Jul 2018 16:34:02 +0800 Subject: [PATCH 4/7] revert code format --- bin/jsinspect | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/bin/jsinspect b/bin/jsinspect index a1b5dd7..33b3cac 100755 --- a/bin/jsinspect +++ b/bin/jsinspect @@ -1,11 +1,11 @@ #!/usr/bin/env node -var fs = require('fs'); -var path = require('path'); -var strip = require('strip-json-comments'); -var chalk = require('chalk'); +var fs = require('fs'); +var path = require('path'); +var strip = require('strip-json-comments'); +var chalk = require('chalk'); var filepaths = require('filepaths'); -var program = require('commander'); +var program = require('commander'); var Inspector = require('../lib/inspector'); var reporters = require('../lib/reporters'); @@ -49,7 +49,7 @@ if (fs.existsSync(rcPath) && fs.lstatSync(rcPath).isFile()) { } ['threshold', 'identifiers', 'literals', 'ignore', 'minInstances', - 'reporter', 'truncate'].forEach((option) => { + 'reporter', 'truncate'].forEach((option) => { if (program[option] === undefined && (option in rc)) { program[option] = rc[option]; } @@ -79,7 +79,7 @@ try { ext: extensions, ignore: ignorePatterns }); -} catch (e) { +} catch(e) { console.log(e.message); process.exit(4); } @@ -90,9 +90,9 @@ if (!paths.length) { } var inspector = new Inspector(paths, { - threshold: program.threshold, - identifiers: program.identifiers, - literals: program.literals, + threshold: program.threshold, + identifiers: program.identifiers, + literals: program.literals, minInstances: program.minInstances }); @@ -109,7 +109,7 @@ inspector.on('match', () => matches++); try { inspector.run(); process.exit(matches ? 5 : 0); -} catch (err) { +} catch(err) { console.log(err); process.exit(1); } From 5848345e2add22a99d734e87063ee1f4b2dbb481 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Thu, 26 Jul 2018 16:36:25 +0800 Subject: [PATCH 5/7] revert test code format --- spec/inspectorSpec.js | 52 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/spec/inspectorSpec.js b/spec/inspectorSpec.js index 53ae23e..02cc4dc 100644 --- a/spec/inspectorSpec.js +++ b/spec/inspectorSpec.js @@ -1,47 +1,47 @@ -var expect = require('expect.js'); +var expect = require('expect.js'); var EventEmitter = require('events').EventEmitter; -var Inspector = require('../lib/inspector'); -var fixtures = require('./fixtures'); +var Inspector = require('../lib/inspector'); +var fixtures = require('./fixtures'); -describe('Inspector', function () { +describe('Inspector', function() { // Used to test emitted events var found; - var listener = function (match) { + var listener = function(match) { found.push(match); }; - beforeEach(function () { + beforeEach(function() { found = []; }); - describe('constructor', function () { - it('inherits from EventEmitter', function () { + describe('constructor', function() { + it('inherits from EventEmitter', function() { expect(new Inspector()).to.be.an(EventEmitter); }); - it('accepts an array of file paths', function () { + it('accepts an array of file paths', function() { var filePaths = ['path1.js', 'path2.js']; var inspector = new Inspector(filePaths); expect(inspector._filePaths).to.be(filePaths); }); - it('assigns a default threshold of 30', function () { + it('assigns a default threshold of 30', function() { var inspector = new Inspector([]); expect(inspector._threshold).to.be(30); }); - it('accepts an options object', function () { + it('accepts an options object', function() { var opts = {threshold: 12}; var inspector = new Inspector([], opts); expect(inspector._threshold).to.be(opts.threshold); }); }); - describe('run', function () { - it('emits a start event', function () { + describe('run', function() { + it('emits a start event', function() { var emitted; var inspector = new Inspector([fixtures.intersection]); - inspector.on('start', function () { + inspector.on('start', function() { emitted = true; }); @@ -49,10 +49,10 @@ describe('Inspector', function () { expect(emitted).to.be(true); }); - it('emits an end event', function () { + it('emits an end event', function() { var emitted; var inspector = new Inspector([fixtures.intersection]); - inspector.on('end', function () { + inspector.on('end', function() { emitted = true; }); @@ -60,7 +60,7 @@ describe('Inspector', function () { expect(emitted).to.be(true); }); - it('emits the "match" event when a match is found', function () { + it('emits the "match" event when a match is found', function() { var inspector = new Inspector([fixtures.intersection], { threshold: 10 }); @@ -71,7 +71,7 @@ describe('Inspector', function () { }); }); - it('can find an exact match between instances', function () { + it('can find an exact match between instances', function() { var inspector = new Inspector([fixtures.intersection], { threshold: 15 }); @@ -88,7 +88,7 @@ describe('Inspector', function () { expect(match.instances[1].end).to.eql({line: 11, column: 1}); }); - it('can find the largest match between two instances', function () { + it('can find the largest match between two instances', function() { var inspector = new Inspector([fixtures.redundantIntersection], { threshold: 11 }); @@ -105,7 +105,7 @@ describe('Inspector', function () { expect(match.instances[1].end).to.eql({line: 19, column: 1}); }); - it('supports ES6', function () { + it('supports ES6', function() { var inspector = new Inspector([fixtures.es6ClassExport], { threshold: 20 }); @@ -122,7 +122,7 @@ describe('Inspector', function () { expect(match.instances[1].end).to.eql({line: 12, column: 3}); }); - it('supports JSX', function () { + it('supports JSX', function() { var inspector = new Inspector([fixtures.jsxTodo], { threshold: 20 }); @@ -139,7 +139,7 @@ describe('Inspector', function () { expect(match.instances[1].end).to.eql({line: 17, column: 1}); }); - it('supports Flow', function () { + it('supports Flow', function() { var inspector = new Inspector([fixtures.flowIntersection], { threshold: 20 }); @@ -156,7 +156,7 @@ describe('Inspector', function () { expect(match.instances[1].end).to.eql({line: 11, column: 1}); }); - it('includes the lines with the match', function () { + it('includes the lines with the match', function() { var inspector = new Inspector([fixtures.intersection], { threshold: 11, }); @@ -183,7 +183,7 @@ describe('Inspector', function () { ); }); - it('ignores matches with less than the supplied minimum', function () { + it('ignores matches with less than the supplied minimum', function() { var inspector = new Inspector([fixtures.matches], { threshold: 2, minInstances: 3 @@ -195,7 +195,7 @@ describe('Inspector', function () { expect(found[0].instances).to.have.length(3); }); - it('ignores CommonJS require statements', function () { + it('ignores CommonJS require statements', function() { var inspector = new Inspector([fixtures.commonjs], { threshold: 3 }); @@ -205,7 +205,7 @@ describe('Inspector', function () { expect(found).to.have.length(0); }); - it('ignores AMD define expressions', function () { + it('ignores AMD define expressions', function() { var inspector = new Inspector([fixtures.amd], { threshold: 5 }); From 54ffb9b57de131bc0cf38953fe9cb20ae0ff7a17 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Wed, 5 Jun 2019 10:25:35 +0800 Subject: [PATCH 6/7] rename --- package-lock.json | 78 +++++++++++++++++++++++------------------------ package.json | 6 ++-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/package-lock.json b/package-lock.json index 1db0019..87d2406 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,7 @@ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "requires": { - "color-convert": "1.9.2" + "color-convert": "^1.9.0" } }, "babylon": { @@ -29,7 +29,7 @@ "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", "dev": true, "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, @@ -50,9 +50,9 @@ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "requires": { - "ansi-styles": "3.2.1", - "escape-string-regexp": "1.0.5", - "supports-color": "5.4.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, "color-convert": { @@ -85,10 +85,10 @@ "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", "dev": true, "requires": { - "buffer-from": "1.1.0", - "inherits": "2.0.3", - "readable-stream": "2.3.6", - "typedarray": "0.0.6" + "buffer-from": "^1.0.0", + "inherits": "^2.0.3", + "readable-stream": "^2.2.2", + "typedarray": "^0.0.6" } }, "core-util-is": { @@ -156,12 +156,12 @@ "integrity": "sha1-gFIR3wT6rxxjo2ADBs31reULLsg=", "dev": true, "requires": { - "fs.realpath": "1.0.0", - "inflight": "1.0.6", - "inherits": "2.0.3", - "minimatch": "3.0.4", - "once": "1.4.0", - "path-is-absolute": "1.0.1" + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.2", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, "graceful-readlink": { @@ -193,8 +193,8 @@ "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -221,8 +221,8 @@ "integrity": "sha1-jDigmVAPIVrQnlnxci/QxSv+Ck4=", "dev": true, "requires": { - "lodash._basecopy": "3.0.1", - "lodash.keys": "3.1.2" + "lodash._basecopy": "^3.0.0", + "lodash.keys": "^3.0.0" } }, "lodash._basecopy": { @@ -255,9 +255,9 @@ "integrity": "sha1-1/KEnw29p+BGgruM1yqwIkYd6+c=", "dev": true, "requires": { - "lodash._baseassign": "3.2.0", - "lodash._basecreate": "3.0.3", - "lodash._isiterateecall": "3.0.9" + "lodash._baseassign": "^3.0.0", + "lodash._basecreate": "^3.0.0", + "lodash._isiterateecall": "^3.0.0" } }, "lodash.isarguments": { @@ -278,9 +278,9 @@ "integrity": "sha1-TbwEcrFWvlCgsoaFXRvQsMZWCYo=", "dev": true, "requires": { - "lodash._getnative": "3.9.1", - "lodash.isarguments": "3.1.0", - "lodash.isarray": "3.0.4" + "lodash._getnative": "^3.0.0", + "lodash.isarguments": "^3.0.0", + "lodash.isarray": "^3.0.0" } }, "minimatch": { @@ -289,7 +289,7 @@ "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "dev": true, "requires": { - "brace-expansion": "1.1.11" + "brace-expansion": "^1.1.7" } }, "minimist": { @@ -333,7 +333,7 @@ "integrity": "sha1-nJkJQXbhIkDLItbFFGCYQA/g99Q=", "dev": true, "requires": { - "graceful-readlink": "1.0.1" + "graceful-readlink": ">= 1.0.0" } }, "has-flag": { @@ -348,7 +348,7 @@ "integrity": "sha1-cqJiiU2dQIuVbKBf83su2KbiotU=", "dev": true, "requires": { - "has-flag": "1.0.0" + "has-flag": "^1.0.0" } } } @@ -365,7 +365,7 @@ "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, "parse5": { @@ -391,13 +391,13 @@ "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", "dev": true, "requires": { - "core-util-is": "1.0.2", - "inherits": "2.0.3", - "isarray": "1.0.0", - "process-nextick-args": "2.0.0", - "safe-buffer": "5.1.2", - "string_decoder": "1.1.1", - "util-deprecate": "1.0.2" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~2.0.0", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.1.1", + "util-deprecate": "~1.0.1" } }, "safe-buffer": { @@ -417,7 +417,7 @@ "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", "dev": true, "requires": { - "safe-buffer": "5.1.2" + "safe-buffer": "~5.1.0" } }, "strip-indent": { @@ -425,7 +425,7 @@ "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-1.0.1.tgz", "integrity": "sha1-DHlipq3vp7vUrDZkYKY4VSrhoKI=", "requires": { - "get-stdin": "4.0.1" + "get-stdin": "^4.0.1" } }, "strip-json-comments": { @@ -438,7 +438,7 @@ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", "requires": { - "has-flag": "3.0.0" + "has-flag": "^3.0.0" } }, "typedarray": { diff --git a/package.json b/package.json index 96d9c96..e24e21a 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { - "name": "jsinspect", + "name": "jsinspect-next", "version": "0.12.7", "description": "Detect structural similarities in your code", "keywords": [ "inspect", - "detect", + "detect", "code", "duplicate", "structure", @@ -16,7 +16,7 @@ "homepage": "https://github.com/danielstjules/jsinspect", "repository": { "type": "git", - "url": "https://github.com/danielstjules/jsinspect.git" + "url": "https://github.com/ustbhuangyi/jsinspect" }, "dependencies": { "babylon": "6.16.1", From 89b1c00a85b6774eefd7ea3269191d00be533ed6 Mon Sep 17 00:00:00 2001 From: ustbhuangyi <280309453@qq.com> Date: Wed, 5 Jun 2019 10:28:15 +0800 Subject: [PATCH 7/7] update --- README.md | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 7eb2169..34a13bf 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ ignored. It can be installed via `npm` using: ``` bash -npm install -g jsinspect +npm install -g jsinspect-next ``` ## Usage diff --git a/package.json b/package.json index e24e21a..9c3f6c5 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "Detect structural similarities in your code", "keywords": [ "inspect", - "detect", + "detect", "code", "duplicate", "structure",