diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..82f732f67 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +[*{js,jsx}] +charset = utf-8 +indent_style = space +indent_size = 2 +trim_trailing_whitespace = true diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 000000000..5c1e14b58 --- /dev/null +++ b/.eslintrc @@ -0,0 +1,7 @@ +{ + "extends": ["airbnb-base", "prettier"], + "rules": { + "no-console": 0, + "func-names": ["error", "never"], + } +} diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..53d7f9b6e --- /dev/null +++ b/.prettierrc @@ -0,0 +1,5 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, +} diff --git a/api.js b/api.js index fc50864f2..056b6fcb2 100644 --- a/api.js +++ b/api.js @@ -1,65 +1,42 @@ -var colors = require('colors'); -var crypto = require('crypto'); -var fs = require('fs'); -var jsonfile = require('jsonfile'); -var path = require('path'); -var request = require('request'); +require('colors'); -var utils = require('./utils'); +const path = require('path'); -exports.api = function(args, opts) { - opts = opts || {}; +const utils = require('./utils'); - var action = args[0]; - var config = utils.config(opts.env); +exports.api = function(args, opts = {}) { + const action = args[0]; + const config = utils.config(opts.env); - var actionObj = exports.load(config, action); + const actionObj = exports.load(config, action); - if(!actionObj) { + if (!actionObj) { return; } - var info = { - 'args': args, - 'opts': opts, + const info = { + args, + opts, }; actionObj.run(config, info); }; -exports.load = function(config, action) { - if(!action) action = 'start'; - - var file = path.join(__dirname, 'lib', `${action}.js`); - if(utils.fileExists(file)) { +exports.load = function(config, action = 'start') { + const file = path.join(__dirname, 'lib', `${action}.js`); + if (utils.fileExists(file)) { + // eslint-disable-next-line global-require, import/no-dynamic-require return require(file); } - var alias = utils.getAliasFile(action); - if(alias) { - var file = path.join(__dirname, 'lib', `${alias}.js`); - return require(file); + const alias = utils.getAliasFile(action); + if (alias) { + // eslint-disable-next-line global-require, import/no-dynamic-require + return require(path.join(__dirname, 'lib', `${alias}.js`)); } - console.log('Action not found.'.red); - console.log('Type ' + `${config.cli} help`.yellow + ' to see all commands'); - process.exit(); -}; - -function exampleId(file, apiId) { - if(file.match(/json$/)) { - console.log(""); - console.log(" {".grey); - console.log(" \"swagger\": \"2.0\",".grey); - console.log(" \"x-api-id\": \""+apiId+"\","); - console.log(" \"info\": {".grey); - console.log(" ...".grey); - } else { - console.log(""); - console.log(" swagger: \"2.0\"".grey); - console.log(" x-api-id: \""+apiId+"\""); - console.log(" info:".grey); - console.log(" ...".grey); - } + console.error('Action not found.'.red); + console.warn(`Type ${`${config.cli} help`.yellow} to see all commands`); + process.exitCode = 1; + return undefined; }; - diff --git a/index.js b/index.js index 55fa5e74c..b5e708ea5 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,10 @@ #! /usr/bin/env node -var _ = require('lodash'); +const _ = require('lodash'); -var parseArgs = require('minimist')(process.argv.slice(2)) -var args = parseArgs._; -var opts = _.clone(parseArgs); -delete opts['_']; +const parseArgs = require('minimist')(process.argv.slice(2)); + +const args = parseArgs._; +const opts = _.clone(parseArgs); +delete opts._; require('./api').api(args, opts); diff --git a/lib/add.js b/lib/add.js index 11bf94e47..87e0d1fd2 100644 --- a/lib/add.js +++ b/lib/add.js @@ -1,25 +1,29 @@ -var request = require('request'); -var jsonfile = require('jsonfile'); +const request = require('request'); +const jsonfile = require('jsonfile'); exports.swagger = true; exports.login = true; -exports.desc = "Add a user"; +exports.desc = 'Add a user'; exports.run = function(config, info) { - var email = info.args[1]; - console.log("Granting " + email.yellow + " push access to " + info.swagger['x-api-id'].yellow + "!"); - console.log(""); + const email = info.args[1]; + console.log(`Granting ${email.yellow} push access to ${info.swagger['x-api-id'].yellow}!`); + console.log(''); - var user = jsonfile.readFileSync(config.apiFile); + const user = jsonfile.readFileSync(config.apiFile); - request.post(config.host.url + '/add', { - 'form': { - 'user': user.token, - 'email': email, - 'repo': info.swagger['x-api-id'], - } - }, function() { - console.log("Success! ".green + "User has been added."); - process.exit(); - }); + request.post( + `${config.host.url}/add`, + { + form: { + user: user.token, + email, + repo: info.swagger['x-api-id'], + }, + }, + () => { + console.log(`${'Success! '.green}User has been added.`); + process.exit(); + }, + ); }; diff --git a/lib/docs.js b/lib/docs.js index 65d5092cd..abd4bc4ca 100644 --- a/lib/docs.js +++ b/lib/docs.js @@ -1,21 +1,22 @@ -var utils = require('../utils'); -var open = require('open'); +const open = require('open'); exports.swagger = true; exports.swaggerUrl = true; exports.login = true; -exports.desc = "Host your docs on ReadMe"; -exports.category = "services"; +exports.desc = 'Host your docs on ReadMe'; +exports.category = 'services'; exports.run = function(config, info) { - console.log(""); - console.log("Success! ".green + "You can now access your Swagger from the following publicly sharable URL:"); - console.log(""); - console.log(" " + info.swaggerUrl + "?docs"); - console.log(""); - console.log("To use in ReadMe for documentation, follow the URL for setup information."); + console.log(''); + console.log( + `${'Success! '.green}You can now access your Swagger from the following publicly sharable URL:`, + ); + console.log(''); + console.log(` ${info.swaggerUrl}?docs`); + console.log(''); + console.log('To use in ReadMe for documentation, follow the URL for setup information.'); - open(info.swaggerUrl + "?docs", info); + open(`${info.swaggerUrl}?docs`, info); process.exit(); }; diff --git a/lib/endpoint.js b/lib/endpoint.js index abb60f5d0..314805a79 100644 --- a/lib/endpoint.js +++ b/lib/endpoint.js @@ -1,32 +1,32 @@ -var colors = require('colors'); -var utils = require('../utils'); +const utils = require('../utils'); exports.swagger = false; exports.login = false; -exports.category = "basic"; -exports.desc = "Learn how to document an endpoint"; +exports.category = 'basic'; +exports.desc = 'Learn how to document an endpoint'; exports.weight = 3; -exports.run = function(config, info) { - console.log("You can document each endpoint right above the code. Just use the"); - console.log("following syntax in a comment above the code:"); - console.log(""); +exports.run = function() { + console.log('You can document each endpoint right above the code. Just use the'); + console.log('following syntax in a comment above the code:'); + console.log(''); console.log(utils.swaggerInlineExample(utils.guessLanguage())); console.log(''); - console.log('Param shorthand: '.blue + 'Since params are very verbose, we have a shorthand'); + console.log(`${'Param shorthand: '.blue}Since params are very verbose, we have a shorthand`); console.log('for describing them.'); console.log(''); console.log(' - (in) name=default* {type:format} description'.grey); console.log(''); - console.log("This will be expanded when the Swagger file is compiled."); + console.log('This will be expanded when the Swagger file is compiled.'); console.log(''); - console.log('For more information on this syntax, see https://github.com/readmeio/swagger-inline'); + console.log( + 'For more information on this syntax, see https://github.com/readmeio/swagger-inline', + ); process.exit(); }; - diff --git a/lib/generate.js b/lib/generate.js index d605f32cb..17da623b3 100644 --- a/lib/generate.js +++ b/lib/generate.js @@ -1,9 +1,9 @@ -var cardinal = require('cardinal'); +const cardinal = require('cardinal'); exports.swagger = true; exports.login = false; -exports.desc = "Output your Swagger file"; -exports.category = "utility"; +exports.desc = 'Output your Swagger file'; +exports.category = 'utility'; exports.run = function(config, info) { console.log(cardinal.highlight(JSON.stringify(info.swagger, undefined, 2))); diff --git a/lib/help.js b/lib/help.js index 8fc0d37cc..4d8897727 100644 --- a/lib/help.js +++ b/lib/help.js @@ -1,62 +1,63 @@ -var glob = require('glob'); -var path = require('path'); -var _ = require('lodash'); +const glob = require('glob'); +const path = require('path'); +const _ = require('lodash'); exports.swagger = false; exports.login = false; -exports.category = "basic"; +exports.category = 'basic'; exports.desc = 'Learn what you can do with this tool'; exports.weight = 2; -exports.run = function(config, info) { - console.log(""); +function pad(text) { + return `${text} `.substr(0, 15); +} + +exports.run = function(config) { + console.log(''); console.log(`Usage: ${config.cli} [swagger url]`); - var files = glob.sync(path.join(__dirname, "*")); + const files = glob.sync(path.join(__dirname, '*')); - var categories = { - 'basic': { + const categories = { + basic: { desc: 'Commands for getting started', commands: [], }, - 'services': { - desc: 'Hosted third-party services ' + '(Will post to the Internet)'.grey, + services: { + desc: `Hosted third-party services ${'(Will post to the Internet)'.grey}`, commands: [], }, - 'utility': { + utility: { desc: 'Utility functions', commands: [], }, }; - _.each(files, function(file) { - var action = file.match(/(\w+).js/)[1]; - var f = require(file); - var info = f.desc || ""; + _.each(files, file => { + const action = file.match(/(\w+).js/)[1]; + // eslint-disable-next-line global-require, import/no-dynamic-require + const f = require(file); + const info = f.desc || ''; - if(f.category) { + if (f.category) { categories[f.category].commands.push({ - text: " $".grey + pad(` ${config.cli} ${action}`) + " " + info.grey, + text: `${' $'.grey + pad(` ${config.cli} ${action}`)} ${info.grey}`, weight: f.weight, }); } }); - _.each(categories, function(category) { - console.log(""); + _.each(categories, category => { + console.log(''); console.log(category.desc); - _.each(_.sortBy(category.commands, 'weight'), function(command) { + _.each(_.sortBy(category.commands, 'weight'), command => { console.log(command.text); }); }); - console.log(""); - console.log("Just getting started?".green); - console.log("Run " + `${config.cli} init`.yellow + " to create your Swagger file."); - console.log(""); + console.log(''); + console.log('Just getting started?'.green); + console.log(`Run ${`${config.cli} init`.yellow} to create your Swagger file.`); + console.log(''); process.exit(); - - function pad(text) { - return (text + " ").substr(0,15) - } }; diff --git a/lib/init.js b/lib/init.js index 70ad7162c..7b1acd1f6 100644 --- a/lib/init.js +++ b/lib/init.js @@ -1,43 +1,60 @@ -var colors = require('colors'); -var path = require('path'); -var inquirer = require('inquirer'); -var fs = require('fs'); -var crypto = require('crypto'); -var YAML = require('json2yaml'); -var utils = require('../utils'); -var uslug = require('uslug'); +const path = require('path'); +const inquirer = require('inquirer'); +const fs = require('fs'); +const crypto = require('crypto'); +const YAML = require('json2yaml'); +const utils = require('../utils'); +const uslug = require('uslug'); exports.swagger = false; exports.login = false; -exports.category = "basic"; -exports.desc = "Create a new API specification"; +exports.category = 'basic'; +exports.desc = 'Create a new API specification'; exports.weight = 0; -var types = [ - { "name": "application/json", "checked": true }, - { "name": "application/xml" }, - { "name": "application/x-www-form-urlencoded" }, - { "name": "multipart/form-data" }, -]; +function getDefaultSwagger() { + /* eslint-disable */ + let i = 0; + while ((file = utils.fileExists(_file(i)))) { + i++; + } + return _file(i); + + function _file(i) { + return `swagger${i || ''}.json`; + } +} -exports.run = function(config, info) { +const types = [ + { name: 'application/json', checked: true }, + { name: 'application/xml' }, + { name: 'application/x-www-form-urlencoded' }, + { name: 'multipart/form-data' }, +]; +exports.run = function() { console.log("This will help you set up an 'Open API' (formerly 'Swagger') spec in your"); - console.log("repo, so you can start documenting your API!"); + console.log('repo, so you can start documenting your API!'); - console.log(""); + console.log(''); - var pkg = {}; - if (fs.existsSync('./package.json')) { + let pkg = {}; + try { + // eslint-disable-next-line pkg = require(path.join(process.cwd(), '/package.json')); - } + } catch (e) {} // eslint-disable-line - var questions = [ + const questions = [ { type: 'input', name: 'info.title', message: 'Name of the API', - default: pkg.name || process.cwd().split('/').slice(-1)[0], + default: + pkg.name || + process + .cwd() + .split('/') + .slice(-1)[0], }, { type: 'input', @@ -55,15 +72,15 @@ exports.run = function(config, info) { type: 'input', name: 'url', message: 'Full Base URL', - validate: function (value) { - var pass = /^(http|https|ws|wss):\/\/[^ "]+$/.test(value); + validate(value) { + const pass = /^(http|https|ws|wss):\/\/[^ "]+$/.test(value); if (pass) { return true; } return 'Please enter a valid URL, including protocol'; - } + }, }, { type: 'checkbox', @@ -83,102 +100,90 @@ exports.run = function(config, info) { message: 'Output JSON or YAML file', default: getDefaultSwagger(), choices: types, - validate: function (value) { - var pass = /.(json|yaml|yml)$/.test(value); - var doesntExist = !utils.fileExists(value); + validate(value) { + const pass = /.(json|yaml|yml)$/.test(value); + const doesntExist = !utils.fileExists(value); if (pass && doesntExist) { return true; } - if(!pass) { + if (!pass) { return 'Your file must end with .json or .yaml'; } - if(!doesntExist) { + if (!doesntExist) { return 'This file already exists'; } - } - } + }, + }, ]; - inquirer.prompt(questions).then(function (answers) { - var swagger = { - 'swagger': '2.0', + inquirer.prompt(questions).then(answers => { + const swagger = { + swagger: '2.0', 'x-api-id': uslug(answers['info.title']) || crypto.randomBytes(7).toString('hex'), - 'info': { - 'version': answers['info.version'], - 'title': answers['info.title'], + info: { + version: answers['info.version'], + title: answers['info.title'], }, - 'paths': {}, + paths: {}, }; - if(answers['info.license']) { + if (answers['info.license']) { swagger.info.license = { - 'name': answers['info.license'] + name: answers['info.license'], }; } - if(answers.produces.length) { + if (answers.produces.length) { swagger.produces = answers.produces; } - if(answers.consumes.length) { + if (answers.consumes.length) { swagger.consumes = answers.consumes; } - var url = answers.url.match(/^(.*):\/\/([^\/]*)(.*)?$/); + const url = answers.url.match(/^(.*):\/\/([^\/]*)(.*)?$/); swagger.schemes = [url[1]]; swagger.host = url[2]; - if(url[3]) { + if (url[3]) { swagger.basePath = url[3]; } writeFile(answers.output, swagger); - console.log(""); - console.log("======================"); - console.log(""); - console.log("SUCCESS!".green); - console.log(""); - console.log("We've created your new Open API file at " + answers.output.yellow + "."); - console.log(""); - console.log("You can document each endpoint right above the code. Just use the"); - console.log("following syntax in a comment above the code:"); - console.log(""); + console.log(''); + console.log('======================'); + console.log(''); + console.log('SUCCESS!'.green); + console.log(''); + console.log(`We've created your new Open API file at ${answers.output.yellow}.`); + console.log(''); + console.log('You can document each endpoint right above the code. Just use the'); + console.log('following syntax in a comment above the code:'); + console.log(''); console.log(utils.swaggerInlineExample(utils.guessLanguage())); console.log(''); - console.log('For more information on this syntax, see https://github.com/readmeio/swagger-inline'); + console.log( + 'For more information on this syntax, see https://github.com/readmeio/swagger-inline', + ); console.log(''); - console.log('To see what you can do with your API, type ' + 'oas help'.yellow + '.'); + console.log(`To see what you can do with your API, type ${'oas help'.yellow}.`); console.log(''); - console.log('To publish your OAS file, type ' + 'oas host'.yellow + '!'); + console.log(`To publish your OAS file, type ${'oas host'.yellow}!`); console.log(''); process.exit(); }); - }; function writeFile(output, swagger) { - var body = JSON.stringify(swagger, undefined, 2) - if(output.match(/.(yaml|yml)/)) { + let body = JSON.stringify(swagger, undefined, 2); + if (output.match(/.(yaml|yml)/)) { body = YAML.stringify(swagger); body = body.replace(/^\s\s/gm, '').replace(/^---\n/, ''); } - fs.writeFileSync(output, body) + fs.writeFileSync(output, body); } - -function getDefaultSwagger() { - var i = 0; - while(file = utils.fileExists(_file(i))) { - i++; - } - return _file(i); - - function _file(i) { - return 'swagger' + (i ? i : '') + '.json'; - } -} - diff --git a/lib/login.js b/lib/login.js index 752ff0e2b..4135101d7 100644 --- a/lib/login.js +++ b/lib/login.js @@ -1,11 +1,9 @@ -var jsonfile = require('jsonfile') - exports.swagger = false; exports.login = false; -exports.desc = "Authenticate this computer"; -exports.category = "utility"; +exports.desc = 'Authenticate this computer'; +exports.category = 'utility'; -exports.run = function(config, info) { +exports.run = function() { console.log('Log in to your ReadMe account!'); console.log(''); }; diff --git a/lib/manage.js b/lib/manage.js index 12be44d81..55aef0df7 100644 --- a/lib/manage.js +++ b/lib/manage.js @@ -1,21 +1,17 @@ -var colors = require('colors'); -var utils = require('../utils'); - exports.swagger = false; exports.login = false; -exports.category = "utility"; -exports.desc = "Manage users and versions"; +exports.category = 'utility'; +exports.desc = 'Manage users and versions'; -exports.run = function(config, info) { - console.log("You can modify your settings from here!"); - console.log(""); - console.log("GRANT PUSH ACCESS".cyan); - console.log("Run the following command to add them (must match their GitHub email):"); - console.log(""); - console.log(" $ oas add user@email.com".grey); - console.log(""); - console.log(""); +exports.run = function() { + console.log('You can modify your settings from here!'); + console.log(''); + console.log('GRANT PUSH ACCESS'.cyan); + console.log('Run the following command to add them (must match their GitHub email):'); + console.log(''); + console.log(' $ oas add user@email.com'.grey); + console.log(''); + console.log(''); process.exit(); }; - diff --git a/lib/start.js b/lib/start.js index 888917955..cf2003ca7 100644 --- a/lib/start.js +++ b/lib/start.js @@ -1,13 +1,15 @@ exports.swagger = false; exports.login = false; -//exports.category = "basic"; -//exports.desc = "Learn what you can do with oas"; +// exports.category = "basic"; +// exports.desc = "Learn what you can do with oas"; exports.weight = 2; -exports.run = function(config, info) { +exports.run = function(config) { console.log('Welcome to the OpenAPI/Swagger uploader for ReadMe!'); console.log(''); - console.log('Have a Swagger file? ' + `${config.cli} swagger swagger.json --token=[token]`.yellow); - console.log('Need a Swagger file? ' + `${config.cli} init`.yellow); + console.log( + `Have a Swagger file? ${`${config.cli} swagger swagger.json --token=[token]`.yellow}`, + ); + console.log(`Need a Swagger file? ${`${config.cli} init`.yellow}`); process.exit(); }; diff --git a/lib/swagger.js b/lib/swagger.js index 1cd39a3b4..8686967e7 100644 --- a/lib/swagger.js +++ b/lib/swagger.js @@ -1,37 +1,36 @@ -var utils = require('../utils'); -var request = require('request'); -var fs = require('fs'); -var path = require('path'); +const request = require('request'); +const fs = require('fs'); +const path = require('path'); exports.swagger = true; exports.login = true; exports.desc = 'Upload your swagger file to ReadMe'; -exports.category = "services"; +exports.category = 'services'; -exports.run = function(config, info, cb) { - if (!cb) cb = (err) => { - if (err) { - console.error(err) - return process.exit(1); - } +function defaultCallback(err) { + if (err) { + console.error(err); + return process.exit(1); + } - process.exit(); - }; + return process.exit(); +} +exports.run = function(config, info, cb = defaultCallback) { const [apiKey, id] = info.opts.token.split('-'); function callback(err, response, data) { if (err) return cb(err); if (response.statusCode === 201 || response.statusCode === 200) { console.log(data); - console.log("Success! ".green); + console.log('Success! '.green); } else { console.log(data); - console.error("There was an error uploading!".red); + console.error('There was an error uploading!'.red); } if (cb) return cb(); - process.exit(); + return process.exit(); } const options = { @@ -42,8 +41,8 @@ exports.run = function(config, info, cb) { }; if (!id) { - request.post(`${config.host.url}/api/v1/swagger`, options, callback); + request.post(`${config.host.url}/api/v1/swagger`, options, callback); } else { - request.put(`${config.host.url}/api/v1/swagger/${id}`, options, callback); + request.put(`${config.host.url}/api/v1/swagger/${id}`, options, callback); } }; diff --git a/lib/validate.js b/lib/validate.js index d53b32f25..3ec2bb961 100644 --- a/lib/validate.js +++ b/lib/validate.js @@ -1,12 +1,11 @@ -var figures = require('figures'); +const figures = require('figures'); exports.swagger = true; exports.login = false; -exports.desc = "Validate your Swagger file"; -exports.category = "utility"; +exports.desc = 'Validate your Swagger file'; +exports.category = 'utility'; -exports.run = function(config, info) { - console.log(figures.tick.green + " Success!".green + " Valid Swagger file"); +exports.run = function() { + console.log(`${figures.tick.green + ' Success!'.green} Valid Swagger file`); process.exit(); }; - diff --git a/package-lock.json b/package-lock.json index f148845d1..2b4dc387e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,29 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "acorn": { + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz", + "integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==", + "dev": true + }, + "acorn-jsx": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz", + "integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=", + "dev": true, + "requires": { + "acorn": "3.3.0" + }, + "dependencies": { + "acorn": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz", + "integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=", + "dev": true + } + } + }, "ajv": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.3.0.tgz", @@ -15,6 +38,12 @@ "json-schema-traverse": "0.3.1" } }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=", + "dev": true + }, "ansi-escapes": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-1.4.0.tgz", @@ -43,6 +72,27 @@ "sprintf-js": "1.0.3" } }, + "array-union": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", + "integrity": "sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk=", + "dev": true, + "requires": { + "array-uniq": "1.0.3" + } + }, + "array-uniq": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/array-uniq/-/array-uniq-1.0.3.tgz", + "integrity": "sha1-r2rId6Jcx/dOBYiUdThY39sk/bY=", + "dev": true + }, + "arrify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-1.0.1.tgz", + "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", + "dev": true + }, "asn1": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.3.tgz", @@ -538,11 +588,32 @@ "concat-map": "0.0.1" } }, + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, "call-me-maybe": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/call-me-maybe/-/call-me-maybe-1.0.1.tgz", "integrity": "sha1-JtII6onje1y95gJQoV8DHBak1ms=" }, + "caller-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", + "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", + "dev": true, + "requires": { + "callsites": "0.2.0" + } + }, + "callsites": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", + "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", + "dev": true + }, "cardinal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/cardinal/-/cardinal-1.0.0.tgz", @@ -569,12 +640,24 @@ "supports-color": "2.0.0" } }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, + "circular-json": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", + "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", + "dev": true + }, "cli-cursor": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-1.0.2.tgz", @@ -598,6 +681,21 @@ "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=" }, + "color-convert": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.1.tgz", + "integrity": "sha512-mjGanIiwQJskCC18rPR6OmrZ6fm2Lc7PeGFYwCmy5J34wC6F1PzdGL6xeMfmgicfYcNLGuVFA3WzXtIDCQSZxQ==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "dev": true + }, "colors": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", @@ -647,6 +745,12 @@ "typedarray": "0.0.6" } }, + "contains-path": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz", + "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", + "dev": true + }, "core-js": { "version": "2.5.1", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", @@ -657,6 +761,29 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=" }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "dev": true, + "requires": { + "lru-cache": "4.1.2", + "shebang-command": "1.2.0", + "which": "1.3.0" + }, + "dependencies": { + "lru-cache": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.2.tgz", + "integrity": "sha512-wgeVXhrDwAWnIF/yZARsFnMBtdFXOg1b8RIrhilp+0iDYN4mdQcNZElDZ0e4B64BhaxeQ5zN7PMyvu7we1kPeQ==", + "dev": true, + "requires": { + "pseudomap": "1.0.2", + "yallist": "2.1.2" + } + } + } + }, "cryptiles": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-3.1.2.tgz", @@ -697,6 +824,27 @@ "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", "dev": true }, + "deep-is": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.3.tgz", + "integrity": "sha1-s2nW+128E+7PUk+RsHD+7cNXzzQ=", + "dev": true + }, + "del": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", + "integrity": "sha1-wSyYHQZ4RshLyvhiz/kw2Qf/0ag=", + "dev": true, + "requires": { + "globby": "5.0.0", + "is-path-cwd": "1.0.0", + "is-path-in-cwd": "1.0.1", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1", + "rimraf": "2.6.2" + } + }, "delayed-stream": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", @@ -708,6 +856,15 @@ "integrity": "sha1-fyjS657nsVqX79ic5j3P2qPMur8=", "dev": true }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "dev": true, + "requires": { + "esutils": "2.0.2" + } + }, "ecc-jsbn": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.1.tgz", @@ -717,6 +874,15 @@ "jsbn": "0.1.1" } }, + "error-ex": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.1.tgz", + "integrity": "sha1-+FWobOYa3E6GIcPNoh56dhLDqNw=", + "dev": true, + "requires": { + "is-arrayish": "0.2.1" + } + }, "es6-promise": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.1.1.tgz", @@ -727,11 +893,349 @@ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=" }, + "eslint": { + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", + "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "babel-code-frame": "6.26.0", + "chalk": "2.4.1", + "concat-stream": "1.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.1.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", + "espree": "3.5.4", + "esquery": "1.0.1", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "functional-red-black-tree": "1.0.1", + "glob": "7.1.2", + "globals": "11.5.0", + "ignore": "3.3.8", + "imurmurhash": "0.1.4", + "inquirer": "3.3.0", + "is-resolvable": "1.1.0", + "js-yaml": "3.10.0", + "json-stable-stringify-without-jsonify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "7.0.0", + "progress": "2.0.0", + "regexpp": "1.1.0", + "require-uncached": "1.0.3", + "semver": "5.5.0", + "strip-ansi": "4.0.0", + "strip-json-comments": "2.0.1", + "table": "4.0.2", + "text-table": "0.2.0" + }, + "dependencies": { + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "dev": true + }, + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "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==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "dev": true, + "requires": { + "restore-cursor": "2.0.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "dev": true, + "requires": { + "ms": "2.0.0" + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "0.4.2", + "iconv-lite": "0.4.21", + "tmp": "0.0.33" + } + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "dev": true, + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "globals": { + "version": "11.5.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.5.0.tgz", + "integrity": "sha512-hYyf+kI8dm3nORsiiXUQigOU62hDLfJ9G01uyGMxhc6BKsircrUhC4uJPQPUSuq2GrTmiiEt7ewxlMdBewfmKQ==", + "dev": true + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "dev": true, + "requires": { + "ansi-escapes": "3.1.0", + "chalk": "2.4.1", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.2.0", + "figures": "2.0.0", + "lodash": "4.17.4", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", + "dev": true + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "dev": true, + "requires": { + "mimic-fn": "1.2.0" + } + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "dev": true, + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "requires": { + "os-tmpdir": "1.0.2" + } + } + } + }, + "eslint-config-airbnb-base": { + "version": "12.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-12.1.0.tgz", + "integrity": "sha512-/vjm0Px5ZCpmJqnjIzcFb9TKZrKWz0gnuG/7Gfkt0Db1ELJR51xkZth+t14rYdqWgX836XbuxtArbIHlVhbLBA==", + "dev": true, + "requires": { + "eslint-restricted-globals": "0.1.1" + } + }, + "eslint-config-prettier": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-2.9.0.tgz", + "integrity": "sha512-ag8YEyBXsm3nmOv1Hz991VtNNDMRa+MNy8cY47Pl4bw6iuzqKbJajXdqUpiw13STdLLrznxgm1hj9NhxeOYq0A==", + "dev": true, + "requires": { + "get-stdin": "5.0.1" + } + }, + "eslint-import-resolver-node": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz", + "integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==", + "dev": true, + "requires": { + "debug": "2.6.9", + "resolve": "1.7.1" + } + }, + "eslint-module-utils": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.2.0.tgz", + "integrity": "sha1-snA2LNiLGkitMIl2zn+lTphBF0Y=", + "dev": true, + "requires": { + "debug": "2.6.9", + "pkg-dir": "1.0.0" + } + }, + "eslint-plugin-import": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.11.0.tgz", + "integrity": "sha1-Fa7qN6Z0mdhI6OmBgG1GJ7VQOBY=", + "dev": true, + "requires": { + "contains-path": "0.1.0", + "debug": "2.6.9", + "doctrine": "1.5.0", + "eslint-import-resolver-node": "0.3.2", + "eslint-module-utils": "2.2.0", + "has": "1.0.1", + "lodash": "4.17.4", + "minimatch": "3.0.4", + "read-pkg-up": "2.0.0", + "resolve": "1.7.1" + }, + "dependencies": { + "doctrine": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", + "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", + "dev": true, + "requires": { + "esutils": "2.0.2", + "isarray": "1.0.0" + } + } + } + }, + "eslint-restricted-globals": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", + "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", + "dev": true + }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "dev": true, + "requires": { + "esrecurse": "4.2.1", + "estraverse": "4.2.0" + } + }, + "eslint-visitor-keys": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", + "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", + "dev": true + }, + "espree": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", + "integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==", + "dev": true, + "requires": { + "acorn": "5.5.3", + "acorn-jsx": "3.0.1" + } + }, "esprima": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.0.0.tgz", "integrity": "sha1-U88kes2ncxPlUcOqLnM0LT+099k=" }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "esrecurse": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", + "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", + "dev": true, + "requires": { + "estraverse": "4.2.0" + } + }, + "estraverse": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", + "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", + "dev": true + }, "esutils": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", @@ -772,6 +1276,12 @@ "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=" }, + "fast-levenshtein": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz", + "integrity": "sha1-PYpcZog6FqMMqGQ+hR8Zuqd5eRc=", + "dev": true + }, "figures": { "version": "1.7.0", "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", @@ -781,6 +1291,38 @@ "object-assign": "4.1.1" } }, + "file-entry-cache": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", + "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", + "dev": true, + "requires": { + "flat-cache": "1.3.0", + "object-assign": "4.1.1" + } + }, + "find-up": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz", + "integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=", + "dev": true, + "requires": { + "path-exists": "2.1.0", + "pinkie-promise": "2.0.1" + } + }, + "flat-cache": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz", + "integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=", + "dev": true, + "requires": { + "circular-json": "0.3.3", + "del": "2.2.2", + "graceful-fs": "4.1.11", + "write": "0.2.1" + } + }, "forever-agent": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", @@ -818,12 +1360,30 @@ "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "dev": true + }, + "functional-red-black-tree": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz", + "integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=", + "dev": true + }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, + "get-stdin": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-5.0.1.tgz", + "integrity": "sha1-Ei4WFZHiH/TFJTAwVpPyDmOTo5g=", + "dev": true + }, "getpass": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz", @@ -850,6 +1410,20 @@ "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==" }, + "globby": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-5.0.0.tgz", + "integrity": "sha1-69hGZ8oNuzMLmbz8aOrCvFQ3Dg0=", + "dev": true, + "requires": { + "array-union": "1.0.2", + "arrify": "1.0.1", + "glob": "7.1.2", + "object-assign": "4.1.1", + "pify": "2.3.0", + "pinkie-promise": "2.0.1" + } + }, "graceful-fs": { "version": "4.1.11", "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", @@ -875,6 +1449,15 @@ "har-schema": "2.0.0" } }, + "has": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", + "dev": true, + "requires": { + "function-bind": "1.1.1" + } + }, "has-ansi": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", @@ -883,6 +1466,12 @@ "ansi-regex": "2.1.1" } }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, "hawk": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/hawk/-/hawk-6.0.2.tgz", @@ -899,6 +1488,12 @@ "resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.0.tgz", "integrity": "sha512-v0XCLxICi9nPfYrS9RL8HbYnXi9obYAeLbSP00BmnZwCK9+Ih9WOjoZ8YoHCoav2csqn4FOz4Orldsy2dmDwmQ==" }, + "hosted-git-info": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.6.0.tgz", + "integrity": "sha512-lIbgIIQA3lz5XaB6vxakj6sDHADJiZadYEJB+FgA+C4nubM1NwcuvUr9EJPmnH1skZqpqUzWborWo8EIUi0Sdw==", + "dev": true + }, "http-signature": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", @@ -909,6 +1504,27 @@ "sshpk": "1.13.1" } }, + "iconv-lite": { + "version": "0.4.21", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.21.tgz", + "integrity": "sha512-En5V9za5mBt2oUA03WGD3TwDv0MKAruqsuxstbMUZaj9W9k/m1CV/9py3l0L5kw9Bln8fdHQmzHSYtvpvTLpKw==", + "dev": true, + "requires": { + "safer-buffer": "2.1.2" + } + }, + "ignore": { + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.8.tgz", + "integrity": "sha512-pUh+xUQQhQzevjRHHFqqcTy0/dP/kS9I8HSrUydhihjuD09W6ldVWFtIrwhXdUJHis3i2rZNqEHpZH/cbinFbg==", + "dev": true + }, + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", + "dev": true + }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -949,7 +1565,22 @@ "resolved": "https://registry.npmjs.org/invariant/-/invariant-2.2.2.tgz", "integrity": "sha1-nh9WrArNtr8wMwbzOL47IErmA2A=", "requires": { - "loose-envify": "1.3.1" + "loose-envify": "1.3.1" + } + }, + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha1-d8mYQFJ6qOyxqLppe4BkWnqSap0=", + "dev": true + }, + "is-builtin-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-builtin-module/-/is-builtin-module-1.0.0.tgz", + "integrity": "sha1-VAVy0096wxGfj3bDDLwbHgN6/74=", + "dev": true, + "requires": { + "builtin-modules": "1.1.1" } }, "is-fullwidth-code-point": { @@ -960,11 +1591,41 @@ "number-is-nan": "1.0.1" } }, + "is-path-cwd": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-path-cwd/-/is-path-cwd-1.0.0.tgz", + "integrity": "sha1-0iXsIxMuie3Tj9p2dHLmLmXxEG0=", + "dev": true + }, + "is-path-in-cwd": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-in-cwd/-/is-path-in-cwd-1.0.1.tgz", + "integrity": "sha512-FjV1RTW48E7CWM7eE/J2NJvAEEVektecDBVBE5Hh3nM1Jd0kvhHtX68Pr3xsDf857xt3Y4AkwVULK1Vku62aaQ==", + "dev": true, + "requires": { + "is-path-inside": "1.0.1" + } + }, + "is-path-inside": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/is-path-inside/-/is-path-inside-1.0.1.tgz", + "integrity": "sha1-jvW33lBDej/cprToZe96pVy0gDY=", + "dev": true, + "requires": { + "path-is-inside": "1.0.2" + } + }, "is-promise": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" }, + "is-resolvable": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", + "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", + "dev": true + }, "is-typedarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz", @@ -975,6 +1636,12 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -1070,6 +1737,12 @@ "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.3.1.tgz", "integrity": "sha1-NJptRMU6Ud6JtAgFxdXlm0F9M0A=" }, + "json-stable-stringify-without-jsonify": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz", + "integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=", + "dev": true + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -1110,11 +1783,51 @@ "graceful-fs": "4.1.11" } }, + "levn": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/levn/-/levn-0.3.0.tgz", + "integrity": "sha1-OwmSTt+fCDwEkP3UwLxEIeBHZO4=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2", + "type-check": "0.3.2" + } + }, "line-counter": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/line-counter/-/line-counter-1.1.0.tgz", "integrity": "sha1-EN8sBGrTVG5yT7pV+nLN4YpqAfM=" }, + "load-json-file": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", + "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", + "dev": true, + "requires": { + "graceful-fs": "4.1.11", + "parse-json": "2.2.0", + "pify": "2.3.0", + "strip-bom": "3.0.0" + } + }, + "locate-path": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", + "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", + "dev": true, + "requires": { + "p-locate": "2.0.0", + "path-exists": "3.0.0" + }, + "dependencies": { + "path-exists": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", + "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "dev": true + } + } + }, "lodash": { "version": "4.17.4", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.4.tgz", @@ -1157,6 +1870,12 @@ "mime-db": "1.30.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", + "dev": true + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -1317,6 +2036,12 @@ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.6.tgz", "integrity": "sha1-SJYrGeFp/R38JAs/HnMXYnu8R9s=" }, + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=", + "dev": true + }, "nock": { "version": "9.2.3", "resolved": "https://registry.npmjs.org/nock/-/nock-9.2.3.tgz", @@ -1380,6 +2105,18 @@ } } }, + "normalize-package-data": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/normalize-package-data/-/normalize-package-data-2.4.0.tgz", + "integrity": "sha512-9jjUFbTPfEy3R/ad/2oNbKtW9Hgovl5O1FvFWKkKblNXoN/Oou6+9+KKohPK13Yc3/TyunyWhJp6gvRNR/PPAw==", + "dev": true, + "requires": { + "hosted-git-info": "2.6.0", + "is-builtin-module": "1.0.0", + "semver": "5.5.0", + "validate-npm-package-license": "3.0.3" + } + }, "number-is-nan": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", @@ -1421,6 +2158,20 @@ "resolved": "https://registry.npmjs.org/open/-/open-0.0.5.tgz", "integrity": "sha1-QsPhjslUZra/DcQvOilFw/DK2Pw=" }, + "optionator": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.2.tgz", + "integrity": "sha1-NkxeQJ0/TWMB1sC0wFu6UBgK62Q=", + "dev": true, + "requires": { + "deep-is": "0.1.3", + "fast-levenshtein": "2.0.6", + "levn": "0.3.0", + "prelude-ls": "1.1.2", + "type-check": "0.3.2", + "wordwrap": "1.0.0" + } + }, "os-shim": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/os-shim/-/os-shim-0.1.3.tgz", @@ -1431,16 +2182,79 @@ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=" }, + "p-limit": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.2.0.tgz", + "integrity": "sha512-Y/OtIaXtUPr4/YpMv1pCL5L5ed0rumAaAeBSj12F+bSlMdys7i8oQF/GUJmfpTS/QoaRrS/k6pma29haJpsMng==", + "dev": true, + "requires": { + "p-try": "1.0.0" + } + }, + "p-locate": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", + "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "dev": true, + "requires": { + "p-limit": "1.2.0" + } + }, + "p-try": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", + "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "dev": true + }, "parse-code-context": { "version": "0.1.3", "resolved": "https://registry.npmjs.org/parse-code-context/-/parse-code-context-0.1.3.tgz", "integrity": "sha1-sMr+ZcNLkWQ0EAAz6zNOnSgstGE=" }, + "parse-json": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-2.2.0.tgz", + "integrity": "sha1-9ID0BDTvgHQfhGkJn43qGPVaTck=", + "dev": true, + "requires": { + "error-ex": "1.3.1" + } + }, + "path-exists": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz", + "integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=", + "dev": true, + "requires": { + "pinkie-promise": "2.0.1" + } + }, "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=" }, + "path-is-inside": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", + "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", + "dev": true + }, + "path-parse": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", + "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", + "dev": true + }, + "path-type": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", + "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", + "dev": true, + "requires": { + "pify": "2.3.0" + } + }, "pathval": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", @@ -1452,6 +2266,12 @@ "resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz", "integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=" }, + "pify": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-2.3.0.tgz", + "integrity": "sha1-7RQaasBDqEnqWISY59yosVMw6Qw=", + "dev": true + }, "pinkie": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/pinkie/-/pinkie-2.0.4.tgz", @@ -1465,6 +2285,33 @@ "pinkie": "2.0.4" } }, + "pkg-dir": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz", + "integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=", + "dev": true, + "requires": { + "find-up": "1.1.2" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", + "dev": true + }, + "prelude-ls": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.1.2.tgz", + "integrity": "sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ=", + "dev": true + }, + "prettier": { + "version": "1.12.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.12.1.tgz", + "integrity": "sha1-wa0g6APndJ+vkFpAnSNn4Gu+cyU=", + "dev": true + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", @@ -1475,12 +2322,24 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=" }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, "propagate": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", "dev": true }, + "pseudomap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", + "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", + "dev": true + }, "punycode": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", @@ -1496,6 +2355,38 @@ "resolved": "https://registry.npmjs.org/quotemeta/-/quotemeta-0.0.0.tgz", "integrity": "sha1-UdOgbuD81uO1AdvSiQQ1Gtelo4w=" }, + "read-pkg": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", + "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", + "dev": true, + "requires": { + "load-json-file": "2.0.0", + "normalize-package-data": "2.4.0", + "path-type": "2.0.0" + } + }, + "read-pkg-up": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", + "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", + "dev": true, + "requires": { + "find-up": "2.1.0", + "read-pkg": "2.0.0" + }, + "dependencies": { + "find-up": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", + "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "dev": true, + "requires": { + "locate-path": "2.0.0" + } + } + } + }, "readable-stream": { "version": "2.3.3", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", @@ -1538,6 +2429,12 @@ "private": "0.1.8" } }, + "regexpp": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", + "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==", + "dev": true + }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -1595,6 +2492,31 @@ "uuid": "3.1.0" } }, + "require-uncached": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", + "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", + "dev": true, + "requires": { + "caller-path": "0.1.0", + "resolve-from": "1.0.1" + } + }, + "resolve": { + "version": "1.7.1", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.7.1.tgz", + "integrity": "sha512-c7rwLofp8g1U+h1KNyHL/jicrKg1Ek4q+Lr33AL65uZTinUZHe30D5HlyN5V9NW0JX1D5dXQ4jqW5l7Sy/kGfw==", + "dev": true, + "requires": { + "path-parse": "1.0.5" + } + }, + "resolve-from": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", + "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", + "dev": true + }, "restore-cursor": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-1.0.1.tgz", @@ -1625,23 +2547,82 @@ "resolved": "https://registry.npmjs.org/rx/-/rx-4.1.0.tgz", "integrity": "sha1-pfE/957zt0D+MKqAP7CfmIBdR4I=" }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=", + "dev": true + }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "dev": true, + "requires": { + "rx-lite": "4.0.8" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, + "safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, "semver": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", "dev": true }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "dev": true, + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", + "dev": true + }, "sigmund": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz", "integrity": "sha1-P/IfGYytIXX587eBhT/ZTQ0ZtZA=", "dev": true }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "dev": true + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0" + }, + "dependencies": { + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + } + } + }, "sntp": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/sntp/-/sntp-2.1.0.tgz", @@ -1659,6 +2640,38 @@ "os-shim": "0.1.3" } }, + "spdx-correct": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-correct/-/spdx-correct-3.0.0.tgz", + "integrity": "sha512-N19o9z5cEyc8yQQPukRCZ9EUmb4HUpnrmaL/fxS2pBo2jbfcFRVuFZ/oFC+vZz0MNNk0h80iMn5/S6qGZOL5+g==", + "dev": true, + "requires": { + "spdx-expression-parse": "3.0.0", + "spdx-license-ids": "3.0.0" + } + }, + "spdx-exceptions": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/spdx-exceptions/-/spdx-exceptions-2.1.0.tgz", + "integrity": "sha512-4K1NsmrlCU1JJgUrtgEeTVyfx8VaYea9J9LvARxhbHtVtohPs/gFGG5yy49beySjlIMhhXZ4QqujIZEfS4l6Cg==", + "dev": true + }, + "spdx-expression-parse": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-expression-parse/-/spdx-expression-parse-3.0.0.tgz", + "integrity": "sha512-Yg6D3XpRD4kkOmTpdgbUiEJFKghJH03fiC1OPll5h/0sO6neh2jqRDVHOQ4o/LMea0tgCkbMgea5ip/e+MkWyg==", + "dev": true, + "requires": { + "spdx-exceptions": "2.1.0", + "spdx-license-ids": "3.0.0" + } + }, + "spdx-license-ids": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/spdx-license-ids/-/spdx-license-ids-3.0.0.tgz", + "integrity": "sha512-2+EPwgbnmOIl8HjGBXXMd9NAu02vLjOO1nWw4kmeRDFyHn+M/ETfHxQUK0oXg8ctgVnl9t3rosNVsZ1jG61nDA==", + "dev": true + }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", @@ -1710,6 +2723,18 @@ "ansi-regex": "2.1.1" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", + "dev": true + }, + "strip-json-comments": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", + "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", + "dev": true + }, "supports-color": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", @@ -1767,6 +2792,88 @@ "resolved": "https://registry.npmjs.org/swagger-schema-official/-/swagger-schema-official-2.0.0-bab6bed.tgz", "integrity": "sha1-cAcEaNbSl3ylI3suUZyn0Gouo/0=" }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "dev": true, + "requires": { + "ajv": "5.3.0", + "ajv-keywords": "2.1.1", + "chalk": "2.4.1", + "lodash": "4.17.4", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + }, + "dependencies": { + "ansi-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", + "dev": true + }, + "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==", + "dev": true, + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "dev": true, + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", + "dev": true + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "dev": true, + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "dev": true, + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "dev": true, + "requires": { + "has-flag": "3.0.0" + } + } + } + }, + "text-table": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", + "integrity": "sha1-f17oI66AUgfACvLfSoTsP8+lcLQ=", + "dev": true + }, "through": { "version": "2.3.8", "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", @@ -1813,6 +2920,15 @@ "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=", "optional": true }, + "type-check": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", + "integrity": "sha1-WITKtRLPHTVeP7eE8wgEsrUg23I=", + "dev": true, + "requires": { + "prelude-ls": "1.1.2" + } + }, "typedarray": { "version": "0.0.6", "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", @@ -1841,6 +2957,16 @@ "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.1.0.tgz", "integrity": "sha512-DIWtzUkw04M4k3bf1IcpS2tngXEL26YUD2M0tMDUpnUrz2hgzUBlD55a4FjdLGPvfHxS6uluGWvaVEqgBcVa+g==" }, + "validate-npm-package-license": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/validate-npm-package-license/-/validate-npm-package-license-3.0.3.tgz", + "integrity": "sha512-63ZOUnL4SIXj4L0NixR3L1lcjO38crAbgrTpl28t8jjrfuiOBL5Iygm+60qPs/KsZGzPNg6Smnc/oY16QTjF0g==", + "dev": true, + "requires": { + "spdx-correct": "3.0.0", + "spdx-expression-parse": "3.0.0" + } + }, "validator": { "version": "8.2.0", "resolved": "https://registry.npmjs.org/validator/-/validator-8.2.0.tgz", @@ -1856,11 +2982,41 @@ "extsprintf": "1.3.0" } }, + "which": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.0.tgz", + "integrity": "sha512-xcJpopdamTuY5duC/KnTTNBraPK54YwpenP4lzxU8H91GudWpFv38u0CKjclE1Wi2EH2EDz5LRcHcKbCIzqGyg==", + "dev": true, + "requires": { + "isexe": "2.0.0" + } + }, + "wordwrap": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", + "integrity": "sha1-J1hIEIkUVqQXHI0CJkQa3pDLyus=", + "dev": true + }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, + "write": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", + "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "dev": true, + "requires": { + "mkdirp": "0.5.1" + } + }, + "yallist": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", + "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", + "dev": true + }, "yamljs": { "version": "0.2.10", "resolved": "https://registry.npmjs.org/yamljs/-/yamljs-0.2.10.tgz", diff --git a/package.json b/package.json index dcf57f3bf..a9d1ae07e 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,18 @@ "yamljs": "^0.2.8" }, "devDependencies": { + "eslint": "^4.19.1", + "eslint-config-airbnb-base": "^12.1.0", + "eslint-config-prettier": "^2.9.0", + "eslint-plugin-import": "^2.11.0", "mocha": "^2.5.3", - "nock": "^9.2.3" + "nock": "^9.2.3", + "prettier": "^1.12.1" }, "scripts": { + "lint": "eslint -f unix .", + "prettier": "prettier --list-different \"./**/**.js\"", + "pretest": "npm run lint && npm run prettier", "test": "mocha" }, "license": "see LICENSE file" diff --git a/test/.eslintrc b/test/.eslintrc new file mode 100644 index 000000000..7eeefc33b --- /dev/null +++ b/test/.eslintrc @@ -0,0 +1,5 @@ +{ + "env": { + "mocha": true + } +} diff --git a/test/api.test.js b/test/api.test.js new file mode 100644 index 000000000..322847ada --- /dev/null +++ b/test/api.test.js @@ -0,0 +1,24 @@ +const assert = require('assert'); + +const api = require('../api'); + +describe('api', () => { + let error; + before(() => { + error = { console }; + }); + + after(() => { + console.error = error; + }); + + describe('#api()', () => { + it('action not found', done => { + console.error = message => { + assert(message.includes('Action not found')); + return done(); + }; + api.api('notARealAction'); + }); + }); +}); diff --git a/test/swagger.test.js b/test/swagger.test.js index 7ea632b84..6f4a2f4f8 100644 --- a/test/swagger.test.js +++ b/test/swagger.test.js @@ -4,35 +4,48 @@ const utils = require('../utils'); const swagger = require('../lib/swagger'); const config = utils.config('test'); -const apiKey = 'Xmw4bGctRVIQz7R7dQXqH9nQe5d0SPQs' +const apiKey = 'Xmw4bGctRVIQz7R7dQXqH9nQe5d0SPQs'; describe('swagger action', () => { after(() => nock.cleanAll()); - it('should POST to the swagger api if no id provided', (done) => { - const mock = nock(config.host.url).post('/api/v1/swagger', (body) => { - return body.match('form-data; name=\"swagger\"'); - }).basicAuth({ user: apiKey }).reply(201); - - swagger.run(config, { args: ['swagger', './test/fixtures/json/swagger.json'], opts: { token: apiKey } }, (err) => { - if (err) return done(err); - mock.done(); - - return done(); - }); + it('should POST to the swagger api if no id provided', done => { + const mock = nock(config.host.url) + .post('/api/v1/swagger', body => body.match('form-data; name="swagger"')) + .basicAuth({ user: apiKey }) + .reply(201); + + swagger.run( + config, + { args: ['swagger', './test/fixtures/json/swagger.json'], opts: { token: apiKey } }, + err => { + if (err) return done(err); + mock.done(); + + return done(); + }, + ); }); - it('should PUT to the swagger api if id is provided', (done) => { + it('should PUT to the swagger api if id is provided', done => { const id = '5aa0409b7cf527a93bfb44df'; - const mock = nock(config.host.url).put(`/api/v1/swagger/${id}`, (body) => { - return body.match('form-data; name=\"swagger\"'); - }).basicAuth({ user: apiKey }).reply(201); - - swagger.run(config, { args: ['swagger', './test/fixtures/json/swagger.json'], opts: { token: `${apiKey}-${id}` } }, (err) => { - if (err) return done(err); - mock.done(); - - return done(); - }); + const mock = nock(config.host.url) + .put(`/api/v1/swagger/${id}`, body => body.match('form-data; name="swagger"')) + .basicAuth({ user: apiKey }) + .reply(201); + + swagger.run( + config, + { + args: ['swagger', './test/fixtures/json/swagger.json'], + opts: { token: `${apiKey}-${id}` }, + }, + err => { + if (err) return done(err); + mock.done(); + + return done(); + }, + ); }); -}); \ No newline at end of file +}); diff --git a/test/utils.test.js b/test/utils.test.js index 67e28d63f..b05721d09 100644 --- a/test/utils.test.js +++ b/test/utils.test.js @@ -1,65 +1,48 @@ -var assert = require('assert'); - -var path = require('path'); - -describe('utils.js', function() { - var utils = require('../utils'); - describe('#findSwagger()', function() { - - it.skip('find a YAML file', function(done) { - utils.findSwagger(function(err, swagger, file) { - if(err) return done(err); - assert(file.endsWith('PetStore.yaml')) - assert.equal('2.0', swagger.swagger); - done(); - }, { - dir: path.join(__dirname, 'fixtures', 'yaml') - }); +const assert = require('assert'); +const path = require('path'); + +const utils = require('../utils'); + +describe('utils.js', () => { + describe('#findSwagger()', () => { + it.skip('find a YAML file', done => { + utils.findSwagger( + (err, swagger, file) => { + if (err) return done(err); + assert(file.endsWith('PetStore.yaml')); + assert.equal('2.0', swagger.swagger); + return done(); + }, + { + dir: path.join(__dirname, 'fixtures', 'yaml'), + }, + ); }); - it.skip('find a JSON file', function(done) { - utils.findSwagger(function(err, swagger, file) { - if(err) return done(err); - assert(file.endsWith('swagger.json')) - assert.equal('2.0', swagger.swagger); - done(); - }, { - dir: path.join(__dirname, 'fixtures', 'json') - }); + it.skip('find a JSON file', done => { + utils.findSwagger( + (err, swagger, file) => { + if (err) return done(err); + assert(file.endsWith('swagger.json')); + assert.equal('2.0', swagger.swagger); + return done(); + }, + { + dir: path.join(__dirname, 'fixtures', 'json'), + }, + ); }); - it('loads main config', function() { - var config = utils.config('config'); - assert(Object.keys(config).length > 0) + it('loads main config', () => { + const config = utils.config('config'); + assert(Object.keys(config).length > 0); assert.notEqual(config, 'test'); }); - it.skip('loads test config', function() { - var config = utils.config('test'); - assert(Object.keys(config).length > 0) + it.skip('loads test config', () => { + const config = utils.config('test'); + assert(Object.keys(config).length > 0); assert.equal(config.env, 'test'); }); - - }); -}); - -describe('api.js', function() { - var api = require('../api'); - beforeEach(function() { - var log = console.log; - this.sinon.stub(console, 'log', function() { - return log.apply(log, arguments); - }); - }); - - afterEach(function() { - console.log.restore(); - }); - - describe('#api()', function() { - it.skip('action not found', function() { - api.api('notARealAction'); - expect(console.log).to.have.been.calledWithMatch('not found'); - }); }); }); diff --git a/utils.js b/utils.js index 14255b270..49a36a37a 100644 --- a/utils.js +++ b/utils.js @@ -1,19 +1,17 @@ -var fs = require('fs'); -var cardinal = require('cardinal'); -var os = require('os'); -var path = require('path'); -var glob = require('glob') -var figures = require('figures'); -var jsonfile = require('jsonfile'); - -var _ = require('lodash'); -var swagger = require('swagger-parser'); -var yaml = require('yamljs'); -var request = require('request'); -var swaggerInline = require('swagger-inline'); +const fs = require('fs'); +const cardinal = require('cardinal'); +const os = require('os'); +const path = require('path'); +const glob = require('glob'); +const figures = require('figures'); + +const _ = require('lodash'); +const swagger = require('swagger-parser'); +const swaggerInline = require('swagger-inline'); exports.config = function(env) { - var config = require('./config/' + (env || 'config')); + // eslint-disable-next-line global-require, import/no-dynamic-require + const config = require(`./config/${env || 'config'}`); // TODO: Make config a JS file; do this there. config.apiFile = path.join(os.homedir(), '.readme.json'); @@ -23,22 +21,23 @@ exports.config = function(env) { exports.findSwagger = function(info, cb) { swaggerInline('**/*', { - format: '.json', - metadata: true, - base: info.opts.in, - }).then((generatedSwaggerString) => { - var generatedSwagger = JSON.parse(generatedSwaggerString); + format: '.json', + metadata: true, + base: info.opts.in, + }).then(generatedSwaggerString => { + const generatedSwagger = JSON.parse(generatedSwaggerString); - if(!generatedSwagger['x-si-base']) { + if (!generatedSwagger['x-si-base']) { console.log("We couldn't find a Swagger file.".red); - console.log("Don't worry, it's easy to get started! Run " + "oas init".yellow + " to get started."); + console.log( + `Don't worry, it's easy to get started! Run ${'oas init'.yellow} to get started.`, + ); process.exit(); } - var generatedSwaggerClone = JSON.parse(generatedSwaggerString); // Becasue swagger.validate modifies the original JSON - swagger.validate(generatedSwaggerClone, function(err, api) { - if(err) { - + const generatedSwaggerClone = JSON.parse(generatedSwaggerString); // Becasue swagger.validate modifies the original JSON + swagger.validate(generatedSwaggerClone, err => { + if (err) { // TODO: We should go through the crappy validation stuff // and try to make it easier to understand @@ -46,22 +45,22 @@ exports.findSwagger = function(info, cb) { console.log(cardinal.highlight(JSON.stringify(generatedSwagger, undefined, 2))); } - console.log(""); - console.log("Error validating Swagger!".red); - console.log(""); + console.log(''); + console.log('Error validating Swagger!'.red); + console.log(''); if (!info.opts.v) { - console.log("Run with " + "-v".grey + " to see the invalid Swagger"); - console.log(""); + console.log(`Run with ${'-v'.grey} to see the invalid Swagger`); + console.log(''); } - if(err.details) { - _.each(err.details, function(detail) { - var at = detail.path && detail.path.length ? " (at " + detail.path.join('.') + ")" : ""; - console.log(" " + figures.cross.red + " " + detail.message + at.grey); - }); + if (err.details) { + _.each(err.details, detail => { + const at = detail.path && detail.path.length ? ` (at ${detail.path.join('.')})` : ''; + console.log(` ${figures.cross.red} ${detail.message}${at.grey}`); + }); } else { - console.log(figures.cross.red + " " + err.message); + console.log(`${figures.cross.red} ${err.message}`); } - console.log(""); + console.log(''); process.exit(); return; } @@ -69,16 +68,16 @@ exports.findSwagger = function(info, cb) { cb(undefined, generatedSwagger, generatedSwagger['x-si-base']); }); }); - }; exports.getAliasFile = function(unknownAction) { - var files = glob.sync(path.join(__dirname, "lib", "*")); - var foundAction = false; - _.each(files, function(file) { - var actionInfo = require(file); - if(actionInfo.aliases && actionInfo.aliases.indexOf(unknownAction) >= 0) { - foundAction = file.match(/(\w+).js/)[1]; + const files = glob.sync(path.join(__dirname, 'lib', '*')); + let foundAction = false; + _.each(files, file => { + // eslint-disable-next-line global-require, import/no-dynamic-require + const actionInfo = require(file); + if (actionInfo.aliases && actionInfo.aliases.indexOf(unknownAction) >= 0) { + [foundAction] = file.match(/(\w+).js/); } }); return foundAction; @@ -92,33 +91,33 @@ exports.fileExists = function(file) { } }; -exports.guessLanguage = function(cb) { +exports.guessLanguage = function() { // Really simple way at guessing the language. // If we're wrong, it's not a big deal... and // way better than asking them what language // they're writing (since the UI was confusing). - var language = 'js'; - var languages = { + let language = 'js'; + const languages = { rb: 0, coffee: 0, py: 0, js: 0, java: 0, php: 0, - go: 0 + go: 0, }; - var files = glob.sync("*"); - _.each(files, function(f) { - var ext = f.split('.').slice(-1)[0]; - if(typeof languages[ext] !== 'undefined') { - languages[ext]++; + const files = glob.sync('*'); + _.each(files, f => { + const ext = f.split('.').slice(-1)[0]; + if (typeof languages[ext] !== 'undefined') { + languages[ext] += 1; } }); - _.each(languages, function(i, l) { - if(i > languages[language]) { + _.each(languages, (i, l) => { + if (i > languages[language]) { language = l; } }); @@ -126,10 +125,10 @@ exports.guessLanguage = function(cb) { return language; }; -exports.swaggerInlineExample = function(_lang) { - var prefix = ' '; +exports.swaggerInlineExample = function(lang) { + const prefix = ' '; - var annotation = [ + const annotation = [ '@api [get] /pet/{petId}', 'description: Returns all pets from the system that the user has access to', 'parameters:', @@ -137,32 +136,29 @@ exports.swaggerInlineExample = function(_lang) { ' - (query) limit {Integer:int32} The number of resources to return', ]; - var languages = { - 'js': ['/*', ' * ', ' */', 'route.get("/pet/:petId", pet.show);'], - 'java': ['/*', ' * ', ' */', 'public String getPet(id) {'], - 'php': ['/*', ' * ', ' */', 'function showPet($id) {'], - 'coffee': ['###', '', '###', "route.get '/pet/:petId', pet.show"], - 'rb': ['=begin', '', '=end', "get '/pet/:petId' do"], - 'py': ['"""', '', '"""', "def getPet(id):"], - 'go': ['/*', ' * ', ' */', 'func getPet(id) {'], + const languages = { + js: ['/*', ' * ', ' */', 'route.get("/pet/:petId", pet.show);'], + java: ['/*', ' * ', ' */', 'public String getPet(id) {'], + php: ['/*', ' * ', ' */', 'function showPet($id) {'], + coffee: ['###', '', '###', "route.get '/pet/:petId', pet.show"], + rb: ['=begin', '', '=end', "get '/pet/:petId' do"], + py: ['"""', '', '"""', 'def getPet(id):'], + go: ['/*', ' * ', ' */', 'func getPet(id) {'], }; - _lang = _lang.toLowerCase(); - if(!_lang || !languages[_lang]) _lang = 'javascript'; + let lowercaseLang = lang.toLowerCase(); + if (!lang || !languages[lang]) lowercaseLang = 'javascript'; - var lang = languages[_lang]; + const language = languages[lowercaseLang]; - var out = [ - prefix + lang[0].cyan, - ]; + const out = [prefix + language[0].cyan]; - _.each(annotation, function(line) { - out.push(prefix + lang[1].cyan + line.cyan); + _.each(annotation, line => { + out.push(prefix + language[1].cyan + line.cyan); }); - out.push(prefix + lang[2].cyan); - out.push(prefix + lang[3].grey); - - return out.join("\n"); -} + out.push(prefix + language[2].cyan); + out.push(prefix + language[3].grey); + return out.join('\n'); +};