diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 0000000..f627402 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,31 @@ +{ + "env": { + "browser": true, + "es6": true, + "amd": true, + "node": true + }, + "extends": "eslint:recommended", + "parserOptions": { + "ecmaVersion": 2018, + "sourceType": "module" + }, + "rules": { + "indent": [ + "error", + "tab" + ], + "linebreak-style": [ + "error", + "unix" + ], + "quotes": [ + "error", + "single" + ], + "semi": [ + "error", + "never" + ] + } +} \ No newline at end of file diff --git a/helpers/change-relative-path-to-absolute.js b/helpers/change-relative-path-to-absolute.js index 3e276ba..225c5d5 100644 --- a/helpers/change-relative-path-to-absolute.js +++ b/helpers/change-relative-path-to-absolute.js @@ -1,16 +1,17 @@ function changeRelativePathToAbsolute(fileContent, srcFile, importObjs) { //replace relative paths to absolute path for imports - for (var i = 0; i < importObjs.length; i++) { - let isAbsolutePath = importObjs[i].dependencyPath.indexOf(".") != 0 + importObjs.forEach((importObj) => { + let isAbsolutePath = importObj.dependencyPath.indexOf('.') != 0 if (!isAbsolutePath) { - let _fullImportStatement = importObjs[i].fullImportStatement - let srcFileDir = srcFile.substring(0, srcFile.lastIndexOf("/")); - _fullImportStatement = _fullImportStatement.replace(importObjs[i].dependencyPath, srcFileDir + "/" + importObjs[i].dependencyPath) - fileContent = fileContent.replace(importObjs[i].fullImportStatement, _fullImportStatement) + let _fullImportStatement = importObj.fullImportStatement + let srcFileDir = srcFile.substring(0, srcFile.lastIndexOf('/')) + const { dependencyPath } = importObj + _fullImportStatement = _fullImportStatement.replace(dependencyPath, srcFileDir + '/' + dependencyPath) + fileContent = fileContent.replace(importObj.fullImportStatement, _fullImportStatement) } - } + }) - return fileContent; + return fileContent } -module.exports = changeRelativePathToAbsolute; \ No newline at end of file +module.exports = changeRelativePathToAbsolute \ No newline at end of file diff --git a/helpers/find-all-import-paths.js b/helpers/find-all-import-paths.js index f9475a9..fe395de 100644 --- a/helpers/find-all-import-paths.js +++ b/helpers/find-all-import-paths.js @@ -1,64 +1,64 @@ -const fs = require('fs'); -const path = require('path'); -var decomment = require('decomment'); -const findFile = require("./find-file.js"); +const fs = require('fs') +const path = require('path') +let decomment = require('decomment') +const findFile = require('./find-file') function findAllImportPaths(dir, content, cb) { - //strip comments from content + //strip comments from content content = decomment(content, {safe: true}) - const subStr = "import "; - let allImports = []; - let regex = new RegExp(subStr,"gi"); - var importsCount = (content.match(regex) || []).length; - let importsIterator = 0; + const subStr = 'import ' + let allImports = [] + let regex = new RegExp(subStr,'gi') + var importsCount = (content.match(regex) || []).length + let importsIterator = 0 + let result while ( (result = regex.exec(content)) ) { - let startImport = result.index; - let endImport = startImport + content.substr(startImport).indexOf(";") + 1; - let fullImportStatement = content.substring(startImport, endImport); - let dependencyPath = fullImportStatement.split("\"").length > 1 ? fullImportStatement.split("\"")[1]: fullImportStatement.split("'")[1]; - let alias = fullImportStatement.split(" as ").length > 1?fullImportStatement.split(" as ")[1].split(";")[0]:null; - let contractName; + let startImport = result.index + let endImport = startImport + content.substr(startImport).indexOf(';') + 1 + let fullImportStatement = content.substring(startImport, endImport) + let dependencyPath = fullImportStatement.split('"').length > 1 ? fullImportStatement.split('"')[1]: fullImportStatement.split('\'')[1] + let alias = fullImportStatement.split(' as ').length > 1?fullImportStatement.split(' as ')[1].split(';')[0]:null - importObj = { - "startIndex": startImport, - "endIndex": endImport, - "dependencyPath": dependencyPath, - "fullImportStatement": fullImportStatement, - "alias": alias, - "contractName": null - }; + let importObj = { + 'startIndex': startImport, + 'endIndex': endImport, + 'dependencyPath': dependencyPath, + 'fullImportStatement': fullImportStatement, + 'alias': alias, + 'contractName': null + } if (alias) { - alias = alias.replace(/\s/g,''); - var fileExists = fs.existsSync(dependencyPath, fs.F_OK); + alias = alias.replace(/\s/g,'') + var fileExists = fs.existsSync(dependencyPath, fs.F_OK) if (fileExists) { - importsIterator++; - let fileContent = fs.readFileSync(dependencyPath, "utf8"); - if (fileContent.indexOf("contract ") > -1) { - importObj.contractName = getContractName(fileContent); + importsIterator++ + let fileContent = fs.readFileSync(dependencyPath, 'utf8') + if (fileContent.indexOf('contract ') > -1) { + importObj.contractName = getContractName(fileContent) } - allImports.push(importObj); + allImports.push(importObj) } else { - findFile.byName(dir.substring(0, dir.lastIndexOf("/")), path.basename(dependencyPath), function(fileContent) { - importsIterator++; - if (fileContent.indexOf("contract ") > -1) { - importObj.contractName = getContractName(fileContent); + findFile.byName(dir.substring(0, dir.lastIndexOf('/')), path.basename(dependencyPath), function(fileContent) { + importsIterator++ + if (fileContent.indexOf('contract ') > -1) { + importObj.contractName = getContractName(fileContent) } - allImports.push(importObj); + allImports.push(importObj) - if (importsIterator == importsCount) cb(allImports); - }); + if (importsIterator == importsCount) cb(allImports) + }) } } else { - importsIterator++; - allImports.push(importObj); + importsIterator++ + allImports.push(importObj) } } - if (importsIterator == importsCount) cb(allImports); + if (importsIterator == importsCount) cb(allImports) } function getContractName(fileContent) { - return fileContent.substring((fileContent.indexOf("contract ") + ("contract ").length), fileContent.indexOf("{")).replace(/\s/g,'') + return fileContent.substring((fileContent.indexOf('contract ') + ('contract ').length), fileContent.indexOf('{')).replace(/\s/g,'') } -module.exports = findAllImportPaths; +module.exports = findAllImportPaths diff --git a/helpers/find-file.js b/helpers/find-file.js index ac782ea..a0779c8 100644 --- a/helpers/find-file.js +++ b/helpers/find-file.js @@ -1,88 +1,88 @@ -const fs = require('fs'); -const glob = require("glob"); -const path = require("path"); -const variables = require("./variables.js"); -const changeRelativePathToAbsolute = require("./change-relative-path-to-absolute.js"); +const fs = require('fs') +const glob = require('glob') +const path = require('path') +const variables = require('./variables') +const changeRelativePathToAbsolute = require('./change-relative-path-to-absolute') +const log = require('./logger') function byName(dir, fileName, cb) { - glob(dir + "/**/*.sol", function(err, srcFiles) { - if (err) return console.log(err.message); - + glob(dir + '/**/*.sol', function(err, srcFiles) { + if (err) return log.error(err.message) + for (var j = 0; j < srcFiles.length; j++) { if (path.basename(srcFiles[j]) == fileName) { - var fileContent = fs.readFileSync(srcFiles[j], "utf8"); - cb(fileContent); - return; + var fileContent = fs.readFileSync(srcFiles[j], 'utf8') + cb(fileContent) + return } } - dir = dir.substring(0, dir.lastIndexOf("/")); - byName(dir, fileName, cb); - }); + dir = dir.substring(0, dir.lastIndexOf('/')) + byName(dir, fileName, cb) + }) } function byNameAndReplace(dir, filePath, updatedFileContent, importStatement, cb) { - glob(dir + "/**/*.sol", function(err, srcFiles) { - if (err) return console.log(err.message); + glob(dir + '/**/*.sol', function(err, srcFiles) { + if (err) return log.error(err.message) - var importIsReplacedBefore = false; + let importIsReplacedBefore = false byNameAndReplaceInner(importStatement, updatedFileContent, dir, filePath, srcFiles, 0, cb, function() { if (importIsReplacedBefore) { - updatedFileContent = updatedFileContent.replace(importStatement, ""); - cb(updatedFileContent); + updatedFileContent = updatedFileContent.replace(importStatement, '') + cb(updatedFileContent) } else { - if (dir.indexOf("/") > -1) { - dir = dir.substring(0, dir.lastIndexOf("/")); - byNameAndReplace(dir, filePath, updatedFileContent, importStatement, cb); + if (dir.indexOf('/') > -1) { + dir = dir.substring(0, dir.lastIndexOf('/')) + byNameAndReplace(dir, filePath, updatedFileContent, importStatement, cb) } else { - updatedFileContent = updatedFileContent.replace(importStatement, ""); - cb(updatedFileContent); + updatedFileContent = updatedFileContent.replace(importStatement, '') + cb(updatedFileContent) } } }) - }); + }) } function byNameAndReplaceInner(importStatement, updatedFileContent, dir, filePath, srcFiles, j, cb, cbInner) { if (j >= srcFiles.length) return cbInner() - const findAllImportPaths = require("./find-all-import-paths.js"); - let isAbsolutePath = filePath.indexOf(".") != 0 + const findAllImportPaths = require('./find-all-import-paths.js') + let isAbsolutePath = filePath.indexOf('.') != 0 if (isAbsolutePath && srcFiles[j].indexOf(filePath) > -1) { if (!variables.importedSrcFiles.hasOwnProperty(path.basename(srcFiles[j])) || fs.existsSync(filePath)) { let fileContent - if (fs.existsSync(filePath)) fileContent = fs.readFileSync(filePath, "utf8") - else fileContent = fs.readFileSync(srcFiles[j], "utf8"); + if (fs.existsSync(filePath)) fileContent = fs.readFileSync(filePath, 'utf8') + else fileContent = fs.readFileSync(srcFiles[j], 'utf8') findAllImportPaths(dir, fileContent, function(_importObjs) { - fileContent = changeRelativePathToAbsolute(fileContent, srcFiles[j], _importObjs); + fileContent = changeRelativePathToAbsolute(fileContent, srcFiles[j], _importObjs) - if (fileContent.indexOf(" is ") > -1) { - updatedFileContent = updatedFileContent.replace(importStatement, fileContent); + if (fileContent.indexOf(' is ') > -1) { + updatedFileContent = updatedFileContent.replace(importStatement, fileContent) } else { //updatedFileContent = updatedFileContent.replace(importStatement, fileContent); - updatedFileContent = updatedFileContent.replace(importStatement, ""); - updatedFileContent = fileContent + updatedFileContent; + updatedFileContent = updatedFileContent.replace(importStatement, '') + updatedFileContent = fileContent + updatedFileContent } - variables.importedSrcFiles[path.basename(srcFiles[j])] = fileContent; - return cb(updatedFileContent); - }); + variables.importedSrcFiles[path.basename(srcFiles[j])] = fileContent + return cb(updatedFileContent) + }) } else { - updatedFileContent = updatedFileContent.replace(importStatement, ""); + updatedFileContent = updatedFileContent.replace(importStatement, '') //issue #2. if (updatedFileContent.indexOf(variables.importedSrcFiles[path.basename(dir + importObj.dependencyPath)] > -1) - && updatedFileContent.indexOf("import ") == -1) { - var fileContent = fs.readFileSync(srcFiles[j], "utf8"); - updatedFileContent = updatedFileContent.replace(variables.importedSrcFiles[path.basename(dir + importObj.dependencyPath)], ""); - updatedFileContent = fileContent + updatedFileContent; + && updatedFileContent.indexOf('import ') == -1) { + var fileContent = fs.readFileSync(srcFiles[j], 'utf8') + updatedFileContent = updatedFileContent.replace(variables.importedSrcFiles[path.basename(dir + importObj.dependencyPath)], '') + updatedFileContent = fileContent + updatedFileContent } - importIsReplacedBefore = true; - j++; + j++ byNameAndReplaceInner(importStatement, updatedFileContent, dir, filePath, srcFiles, j, cb, cbInner) } } else { - j++; + j++ byNameAndReplaceInner(importStatement, updatedFileContent, dir, filePath, srcFiles, j, cb, cbInner) } } @@ -90,4 +90,4 @@ function byNameAndReplaceInner(importStatement, updatedFileContent, dir, filePat module.exports = { byName: byName, byNameAndReplace: byNameAndReplace -}; \ No newline at end of file +} \ No newline at end of file diff --git a/helpers/logger.js b/helpers/logger.js new file mode 100644 index 0000000..83beb5f --- /dev/null +++ b/helpers/logger.js @@ -0,0 +1,4 @@ +var bunyan = require('bunyan') +var log = bunyan.createLogger({name: 'solidity-flattener'}) + +module.exports = log \ No newline at end of file diff --git a/helpers/remove-doubled-solidity-version.js b/helpers/remove-doubled-solidity-version.js index cda029d..5c785d0 100644 --- a/helpers/remove-doubled-solidity-version.js +++ b/helpers/remove-doubled-solidity-version.js @@ -1,22 +1,23 @@ -//const removeTabs = require("./remove-tabs.js"); +//const removeTabs = require("./remove-tabs"); function removeDoubledSolidityVersion(content) { - const subStr = "pragma solidity"; + const subStr = 'pragma solidity' //1st pragma solidity declaration - let firstIndex = content.indexOf(subStr); - let lastIndex = firstIndex + content.substr(firstIndex).indexOf(";") + 1; - let contentPart = content.substr(lastIndex); - let contentFiltered = contentPart; + let firstIndex = content.indexOf(subStr) + let lastIndex = firstIndex + content.substr(firstIndex).indexOf(';') + 1 + let contentPart = content.substr(lastIndex) + let contentFiltered = contentPart //remove other pragma solidity declarations - let regex = new RegExp(subStr,"gi"); + let regex = new RegExp(subStr,'gi') + let result while ( (result = regex.exec(contentPart)) ) { - let start = result.index; - let end = start + contentPart.substr(start).indexOf(";") + 1; - if (start != firstIndex) contentFiltered = contentFiltered.replace(contentPart.substring(start, end), ""); + let start = result.index + let end = start + contentPart.substr(start).indexOf(';') + 1 + if (start != firstIndex) contentFiltered = contentFiltered.replace(contentPart.substring(start, end), '') } - let finalContent = content.substr(0, lastIndex) + contentFiltered; + let finalContent = content.substr(0, lastIndex) + contentFiltered - return finalContent;//removeTabs(finalContent); //#10 + return finalContent//removeTabs(finalContent); //#10 } -module.exports = removeDoubledSolidityVersion; \ No newline at end of file +module.exports = removeDoubledSolidityVersion \ No newline at end of file diff --git a/helpers/remove-tabs.js b/helpers/remove-tabs.js index bd45a1d..ba4ca77 100644 --- a/helpers/remove-tabs.js +++ b/helpers/remove-tabs.js @@ -1,6 +1,6 @@ function removeTabs(content) { - content = content.replace(/[\r\n]+/g, '\n'); //removes tabs - return content; + content = content.replace(/[\r\n]+/g, '\n') //removes tabs + return content } -module.exports = removeTabs; \ No newline at end of file +module.exports = removeTabs \ No newline at end of file diff --git a/helpers/replace-all-imports-in-current-layer.js b/helpers/replace-all-imports-in-current-layer.js index 909f78b..1e538ad 100644 --- a/helpers/replace-all-imports-in-current-layer.js +++ b/helpers/replace-all-imports-in-current-layer.js @@ -1,88 +1,89 @@ -const fs = require('fs'); -const path = require("path"); -const variables = require("./variables.js"); -const findFile = require("./find-file.js"); -const replaceRelativeImportPaths = require("./replace-relative-import-paths.js"); -const updateImportObjectLocationInTarget = require("./update-import-object-location-in-target.js"); -const changeRelativePathToAbsolute = require("./change-relative-path-to-absolute.js"); -const findAllImportPaths = require("./find-all-import-paths.js"); +const fs = require('fs') +const path = require('path') +const variables = require('./variables') +const findFile = require('./find-file') +const replaceRelativeImportPaths = require('./replace-relative-import-paths') +const updateImportObjectLocationInTarget = require('./update-import-object-location-in-target') +const changeRelativePathToAbsolute = require('./change-relative-path-to-absolute') +const findAllImportPaths = require('./find-all-import-paths') +const log = require('./logger') function replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir, cb) { if (i < importObjs.length) { - var importObj = importObjs[i]; - importObj = updateImportObjectLocationInTarget(importObj, updatedFileContent); + var importObj = importObjs[i] + importObj = updateImportObjectLocationInTarget(importObj, updatedFileContent) //replace contracts aliases if (importObj.contractName) { - updatedFileContent = updatedFileContent.replace(importObj.alias + ".", importObj.contractName + "."); + updatedFileContent = updatedFileContent.replace(importObj.alias + '.', importObj.contractName + '.') } - let importStatement = updatedFileContent.substring(importObj.startIndex, importObj.endIndex); + let importStatement = updatedFileContent.substring(importObj.startIndex, importObj.endIndex) let fileExists let filePath - let isRelativePath = importObj.dependencyPath.indexOf(".") == 0 + let isRelativePath = importObj.dependencyPath.indexOf('.') == 0 if (isRelativePath) { filePath = dir + importObj.dependencyPath - fileExists = fs.existsSync(filePath, fs.F_OK); + fileExists = fs.existsSync(filePath, fs.F_OK) } else { filePath = importObj.dependencyPath - fileExists = fs.existsSync(filePath, fs.F_OK); + fileExists = fs.existsSync(filePath, fs.F_OK) } if (fileExists) { - console.log("###" + importObj.dependencyPath + " SOURCE FILE FOUND###"); - var importedFileContent = fs.readFileSync(filePath, "utf8"); + log.info('###' + importObj.dependencyPath + ' SOURCE FILE FOUND###') + var importedFileContent = fs.readFileSync(filePath, 'utf8') findAllImportPaths(dir, importedFileContent, function(_importObjs) { - importedFileContent = changeRelativePathToAbsolute(importedFileContent, filePath, _importObjs); - replaceRelativeImportPaths(importedFileContent, path.dirname(importObj.dependencyPath) + "/", function(importedFileContentUpdated) { + importedFileContent = changeRelativePathToAbsolute(importedFileContent, filePath, _importObjs) + replaceRelativeImportPaths(importedFileContent, path.dirname(importObj.dependencyPath) + '/', function(importedFileContentUpdated) { if (!variables.importedSrcFiles.hasOwnProperty(path.basename(filePath))) { - variables.importedSrcFiles[path.basename(filePath)] = importedFileContentUpdated; - if (importedFileContentUpdated.indexOf(" is ") > -1) { - updatedFileContent = updatedFileContent.replace(importStatement, importedFileContentUpdated); + variables.importedSrcFiles[path.basename(filePath)] = importedFileContentUpdated + if (importedFileContentUpdated.indexOf(' is ') > -1) { + updatedFileContent = updatedFileContent.replace(importStatement, importedFileContentUpdated) } else { - updatedFileContent = updatedFileContent.replace(importStatement, ""); - updatedFileContent = importedFileContentUpdated + updatedFileContent; + updatedFileContent = updatedFileContent.replace(importStatement, '') + updatedFileContent = importedFileContentUpdated + updatedFileContent } } else { - updatedFileContent = updatedFileContent.replace(importStatement, ""); + updatedFileContent = updatedFileContent.replace(importStatement, '') //issue #1. if (updatedFileContent.indexOf(variables.importedSrcFiles[path.basename(filePath)] > -1) - && updatedFileContent.indexOf("import ") == -1) { - updatedFileContent = updatedFileContent.replace(variables.importedSrcFiles[path.basename(filePath)], ""); - updatedFileContent = importedFileContentUpdated + updatedFileContent; + && updatedFileContent.indexOf('import ') == -1) { + updatedFileContent = updatedFileContent.replace(variables.importedSrcFiles[path.basename(filePath)], '') + updatedFileContent = importedFileContentUpdated + updatedFileContent } } - i++; - replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir, cb); - }); + i++ + replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir, cb) + }) }) } else { if (!variables.importedSrcFiles.hasOwnProperty(path.basename(filePath))) { - console.log("!!!" + importObj.dependencyPath + " SOURCE FILE NOT FOUND. TRY TO FIND IT RECURSIVELY!!!"); + log.info('!!!' + importObj.dependencyPath + ' SOURCE FILE NOT FOUND. TRY TO FIND IT RECURSIVELY!!!') - var directorySeperator; - if (process.platform === "win32") { - directorySeperator = "\\"; + var directorySeperator + if (process.platform === 'win32') { + directorySeperator = '\\' } else { - directorySeperator = "/"; + directorySeperator = '/' } findFile.byNameAndReplace(dir.substring(0, dir.lastIndexOf(directorySeperator)), importObj.dependencyPath, updatedFileContent, importStatement, function(_updatedFileContent) { - i++; - console.log("###" + importObj.dependencyPath + " SOURCE FILE FOUND###"); - replaceAllImportsInCurrentLayer(i, importObjs, _updatedFileContent, dir, cb); - }); + i++ + log.info('###' + importObj.dependencyPath + ' SOURCE FILE FOUND###') + replaceAllImportsInCurrentLayer(i, importObjs, _updatedFileContent, dir, cb) + }) } else { - updatedFileContent = updatedFileContent.replace(importStatement, ""); - i++; - replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir, cb); + updatedFileContent = updatedFileContent.replace(importStatement, '') + i++ + replaceAllImportsInCurrentLayer(i, importObjs, updatedFileContent, dir, cb) } } - } else cb(updatedFileContent); + } else cb(updatedFileContent) } -module.exports = replaceAllImportsInCurrentLayer; +module.exports = replaceAllImportsInCurrentLayer diff --git a/helpers/replace-all-imports-recursively.js b/helpers/replace-all-imports-recursively.js index 40fa1b5..d686617 100644 --- a/helpers/replace-all-imports-recursively.js +++ b/helpers/replace-all-imports-recursively.js @@ -1,16 +1,16 @@ -const findAllImportPaths = require("./find-all-import-paths.js"); -const replaceAllImportsInCurrentLayer = require("./replace-all-imports-in-current-layer"); +const findAllImportPaths = require('./find-all-import-paths') +const replaceAllImportsInCurrentLayer = require('./replace-all-imports-in-current-layer') function replaceAllImportsRecursively(fileContent, dir, cb) { - let updatedFileContent = fileContent; + let updatedFileContent = fileContent findAllImportPaths(dir, updatedFileContent, function(_importObjs) { - if (!_importObjs) return cb(updatedFileContent); - if (_importObjs.length == 0) return cb(updatedFileContent); + if (!_importObjs) return cb(updatedFileContent) + if (_importObjs.length == 0) return cb(updatedFileContent) replaceAllImportsInCurrentLayer(0, _importObjs, updatedFileContent, dir, function(_updatedFileContent) { - replaceAllImportsRecursively(_updatedFileContent, dir, cb); - }); - }); -}; + replaceAllImportsRecursively(_updatedFileContent, dir, cb) + }) + }) +} -module.exports = replaceAllImportsRecursively; \ No newline at end of file +module.exports = replaceAllImportsRecursively \ No newline at end of file diff --git a/helpers/replace-relative-import-paths.js b/helpers/replace-relative-import-paths.js index 4d63a11..9ce7267 100644 --- a/helpers/replace-relative-import-paths.js +++ b/helpers/replace-relative-import-paths.js @@ -1,33 +1,33 @@ -const updateImportObjectLocationInTarget = require("./update-import-object-location-in-target.js"); -const findAllImportPaths = require("./find-all-import-paths.js"); +const updateImportObjectLocationInTarget = require('./update-import-object-location-in-target') +const findAllImportPaths = require('./find-all-import-paths') function replaceRelativeImportPaths(fileContent, curDir, cb) { - let updatedFileContent = fileContent; + let updatedFileContent = fileContent findAllImportPaths(curDir, fileContent, function(importObjs) { - if (!importObjs) return cb(updatedFileContent); - if (importObjs.length == 0) return cb(updatedFileContent); + if (!importObjs) return cb(updatedFileContent) + if (importObjs.length == 0) return cb(updatedFileContent) for (let j = 0; j < importObjs.length; j++) { - let importObj = importObjs[j]; + let importObj = importObjs[j] - importObj = updateImportObjectLocationInTarget(importObj, updatedFileContent); - let importStatement = updatedFileContent.substring(importObj.startIndex, importObj.endIndex); + importObj = updateImportObjectLocationInTarget(importObj, updatedFileContent) + let importStatement = updatedFileContent.substring(importObj.startIndex, importObj.endIndex) - let newPath; - if (importObj.dependencyPath.indexOf("../") == 0) { - newPath = curDir + importObj.dependencyPath; + let newPath + if (importObj.dependencyPath.indexOf('../') == 0) { + newPath = curDir + importObj.dependencyPath } - else if (importObj.dependencyPath.indexOf("./") == 0) { - newPath = curDir + importObj.dependencyPath; + else if (importObj.dependencyPath.indexOf('./') == 0) { + newPath = curDir + importObj.dependencyPath } else { - newPath = importObj.dependencyPath; + newPath = importObj.dependencyPath } - let importStatementNew = importStatement.replace(importObj.dependencyPath, newPath); - updatedFileContent = updatedFileContent.replace(importStatement, importStatementNew); + let importStatementNew = importStatement.replace(importObj.dependencyPath, newPath) + updatedFileContent = updatedFileContent.replace(importStatement, importStatementNew) } - cb(updatedFileContent); - }); + cb(updatedFileContent) + }) } -module.exports = replaceRelativeImportPaths; \ No newline at end of file +module.exports = replaceRelativeImportPaths \ No newline at end of file diff --git a/helpers/update-import-object-location-in-target.js b/helpers/update-import-object-location-in-target.js index 23e3602..910e3fe 100644 --- a/helpers/update-import-object-location-in-target.js +++ b/helpers/update-import-object-location-in-target.js @@ -1,9 +1,9 @@ function updateImportObjectLocationInTarget(importObj, content) { - let startIndexNew = content.indexOf(importObj.fullImportStatement); - let endIndexNew = startIndexNew - importObj.startIndex + importObj.endIndex; - importObj.startIndex = startIndexNew; - importObj.endIndex = endIndexNew; - return importObj; + let startIndexNew = content.indexOf(importObj.fullImportStatement) + let endIndexNew = startIndexNew - importObj.startIndex + importObj.endIndex + importObj.startIndex = startIndexNew + importObj.endIndex = endIndexNew + return importObj } -module.exports = updateImportObjectLocationInTarget; \ No newline at end of file +module.exports = updateImportObjectLocationInTarget \ No newline at end of file diff --git a/helpers/variables.js b/helpers/variables.js index 8f12ab6..8b2b59b 100644 --- a/helpers/variables.js +++ b/helpers/variables.js @@ -1,24 +1,24 @@ -const path = require("path"); -const fs = require('fs'); +const path = require('path') +const fs = require('fs') -const configPath = "./config.json"; -let configExists = fs.existsSync(configPath, fs.F_OK); -let config; -if (configExists) config = JSON.parse(fs.readFileSync(configPath, "utf8")); +const configPath = './config.json' +let configExists = fs.existsSync(configPath, fs.F_OK) +let config +if (configExists) config = JSON.parse(fs.readFileSync(configPath, 'utf8')) //Input solidity file path -let args = process.argv.slice(2); -let inputFilePath = args.length > 0?args[0]:config?config.inputFilePath:""; +let args = process.argv.slice(2) +let inputFilePath = args.length > 0?args[0]:config?config.inputFilePath:'' //Input solidity file dir name -let inputFileDir = path.dirname(inputFilePath); +let inputFileDir = path.dirname(inputFilePath) //Input parent dir -let parentDir = inputFileDir; +let parentDir = inputFileDir //Output directory to store flat combined solidity file -let outDir = args.length > 1?args[1]:config?config.outputDir:"./out"; -let flatContractPrefix = args.length > 2?args[2]:path.basename(inputFilePath, ".sol"); +let outDir = args.length > 1?args[1]:config?config.outputDir:'./out' +let flatContractPrefix = args.length > 2?args[2]:path.basename(inputFilePath, '.sol') -let allSrcFiles = []; -let importedSrcFiles = {}; +let allSrcFiles = [] +let importedSrcFiles = {} module.exports = { @@ -28,6 +28,6 @@ module.exports = { parentDir: parentDir, outDir: outDir, allSrcFiles: allSrcFiles, - importedSrcFiles: importedSrcFiles, - flatContractPrefix: flatContractPrefix + importedSrcFiles: importedSrcFiles, + flatContractPrefix: flatContractPrefix } \ No newline at end of file diff --git a/index.js b/index.js index 94e3216..059c679 100755 --- a/index.js +++ b/index.js @@ -1,32 +1,32 @@ #! /usr/bin/env node -const fs = require('fs'); -const glob = require("glob"); -const pathLib = require("path"); -const variables = require("./helpers/variables.js"); -const removeDoubledSolidityVersion = require("./helpers/remove-doubled-solidity-version.js"); -const replaceAllImportsRecursively = require("./helpers/replace-all-imports-recursively.js"); +const fs = require('fs') +const glob = require('glob') +const variables = require('./helpers/variables') +const log = require('./helpers/logger') +const removeDoubledSolidityVersion = require('./helpers/remove-doubled-solidity-version') +const replaceAllImportsRecursively = require('./helpers/replace-all-imports-recursively') -fs.readFile(variables.inputFilePath, "utf8", readInputFileCallBack); +fs.readFile(variables.inputFilePath, 'utf8', readInputFileCallBack) function readInputFileCallBack(err, inputFileContent) { - if (err) return console.log(err.message); + if (err) return log.error(err.message) - generateFlatFile(variables.parentDir + "/", variables.parentDir + "/**/*.sol", inputFileContent); + generateFlatFile(variables.parentDir + '/', variables.parentDir + '/**/*.sol', inputFileContent) } function generateFlatFile(dir, path, inputFileContent) { glob(path, function(err, srcFiles) { - variables.allSrcFiles = srcFiles; - if (err) return console.log(err.message); - getAllSolFilesCallBack(inputFileContent, dir, path, srcFiles); - }); + variables.allSrcFiles = srcFiles + if (err) return log.error(err.message) + getAllSolFilesCallBack(inputFileContent, dir) + }) } -function getAllSolFilesCallBack(inputFileContent, dir, path, srcFiles) { +function getAllSolFilesCallBack(inputFileContent, dir) { replaceAllImportsRecursively(inputFileContent, dir, function(outputFileContent) { - outputFileContent = removeDoubledSolidityVersion(outputFileContent); - if (!fs.existsSync(variables.outDir)) fs.mkdirSync(variables.outDir); - fs.writeFileSync(variables.outDir + "/" + variables.flatContractPrefix + "_flat.sol", outputFileContent); - console.log("Success! Flat file is generated to " + variables.outDir + " directory"); - }); + outputFileContent = removeDoubledSolidityVersion(outputFileContent) + if (!fs.existsSync(variables.outDir)) fs.mkdirSync(variables.outDir) + fs.writeFileSync(variables.outDir + '/' + variables.flatContractPrefix + '_flat.sol', outputFileContent) + log.info('Success! Flat file is generated to ' + variables.outDir + ' directory') + }) } diff --git a/package-lock.json b/package-lock.json index 054c2a2..62f0389 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,110 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0.tgz", + "integrity": "sha512-OfC2uemaknXr87bdLUkWog7nYuliM9Ij5HUcajsVcMCpQrcLmtxRbVFTIqmcSkSeYRBFBRxs2FiUqFJDLdiebA==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.0.0.tgz", + "integrity": "sha512-UFMC4ZeFC48Tpvj7C8UgLvtkaUuovQX+5xNWrsIoMG8o2z+XFKjKaN9iVmS84dPwVN00W4wPmqvYoZF3EGAsfw==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, + "acorn": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.2.tgz", + "integrity": "sha512-cJrKCNcr2kv8dlDnbw+JPUGjHZzo4myaxOLmpOX8a+rgX94YeTcTMv/LFJUSByRpc+i4GgVnnhLxvMu/2Y+rqw==", + "dev": true + }, + "acorn-jsx": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-4.1.1.tgz", + "integrity": "sha512-JY+iV6r+cO21KtntVvFkD+iqjtdpRUpGqKWgfkCdZq1R+kbreEl8EcdcJR4SmiIgsIQT33s6QzheQ9a275Q8xw==", + "dev": true, + "requires": { + "acorn": "^5.0.3" + } + }, + "ajv": { + "version": "6.5.3", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.3.tgz", + "integrity": "sha512-LqZ9wY+fx3UMiiPd741yB2pj3hhil+hQc8taf4o2QGRFpWgZ2V5C8HA165DY9sS3fJwsk7uT7ZlFEyC3Ig3lLg==", + "dev": true, + "requires": { + "fast-deep-equal": "^2.0.1", + "fast-json-stable-stringify": "^2.0.0", + "json-schema-traverse": "^0.4.1", + "uri-js": "^4.2.2" + } + }, + "ajv-keywords": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", + "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "dev": true + }, + "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.0" + } + }, + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } + }, + "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.1" + } + }, + "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 + }, "balanced-match": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", @@ -14,21 +118,245 @@ "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "requires": { - "balanced-match": "1.0.0", + "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, + "bunyan": { + "version": "1.8.12", + "resolved": "https://registry.npmjs.org/bunyan/-/bunyan-1.8.12.tgz", + "integrity": "sha1-8VDw9nSKvdcq6uhPBEA74u8RN5c=", + "requires": { + "dtrace-provider": "~0.8", + "moment": "^2.10.6", + "mv": "~2", + "safe-json-stringify": "~1" + } + }, + "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 + }, + "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.3.0" + } + }, + "chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "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": "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" + } + }, + "cli-width": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", + "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", + "dev": true + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "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 + }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=" }, + "cross-spawn": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", + "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", + "dev": true, + "requires": { + "nice-try": "^1.0.4", + "path-key": "^2.0.1", + "semver": "^5.5.0", + "shebang-command": "^1.2.0", + "which": "^1.2.9" + } + }, + "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" + } + }, "decomment": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/decomment/-/decomment-0.9.1.tgz", "integrity": "sha512-9vwabbCoArDvgbZnFqWcGPVvSIIvWTNu1yaAc3Tg3q5pOzORo6nANO3TPwBuiKwN7stMDZJgNnR6USU3H6EQrQ==", "requires": { - "esprima": "4.0.0" + "esprima": "~4.0.0" + } + }, + "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.0", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0", + "rimraf": "^2.2.8" + } + }, + "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" + } + }, + "dtrace-provider": { + "version": "0.8.7", + "resolved": "https://registry.npmjs.org/dtrace-provider/-/dtrace-provider-0.8.7.tgz", + "integrity": "sha1-3JObTT4GIM/gwc2APQ0tftBP/QQ=", + "optional": true, + "requires": { + "nan": "^2.10.0" + } + }, + "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=", + "dev": true + }, + "eslint": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.5.0.tgz", + "integrity": "sha512-m+az4vYehIJgl1Z0gb25KnFXeqQRdNreYsei1jdvkd9bB+UNQD3fsuiC2AWSQ56P+/t++kFSINZXFbfai+krOw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "doctrine": "^2.1.0", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^4.0.0", + "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.7.0", + "ignore": "^4.0.6", + "imurmurhash": "^0.1.4", + "inquirer": "^6.1.0", + "is-resolvable": "^1.1.0", + "js-yaml": "^3.12.0", + "json-stable-stringify-without-jsonify": "^1.0.1", + "levn": "^0.3.0", + "lodash": "^4.17.5", + "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": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.5.1", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^4.0.3", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "eslint-utils": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-1.3.1.tgz", + "integrity": "sha512-Z7YjnIldX+2XMcjr7ZkgEsOj/bREONV60qYeB/bjMAqqqZ4zxKyWX+BOUkdmRmA9riiIPVvo5x86m5elviOk0Q==", + "dev": true + }, + "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": "4.0.0", + "resolved": "https://registry.npmjs.org/espree/-/espree-4.0.0.tgz", + "integrity": "sha512-kapdTCt1bjmspxStVKX6huolXVV5ZfyZguY1lcfhVVZstce3bqxH9mcLzNn3/mlgW6wQ732+0fuG9v7h0ZQoKg==", + "dev": true, + "requires": { + "acorn": "^5.6.0", + "acorn-jsx": "^4.1.1" } }, "esprima": { @@ -36,31 +364,180 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" }, + "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.0.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.1.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", + "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", + "dev": true + }, + "external-editor": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", + "dev": true, + "requires": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + } + }, + "fast-deep-equal": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", + "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", + "dev": true + }, + "fast-json-stable-stringify": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", + "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", + "dev": true + }, + "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": "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" + } + }, + "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.2.1", + "object-assign": "^4.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.1", + "del": "^2.0.2", + "graceful-fs": "^4.1.2", + "write": "^0.2.1" + } + }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, + "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 + }, "glob": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", "integrity": "sha512-MJTUg1kjuLeQCJ+ccE4Vpa6kKVXkPYJ2mOCQyUuKLcLQsdrMCpBPUi8qVE6+YuaJkozeA9NusTAw3hLr8Xe5EQ==", "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.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" } }, + "globals": { + "version": "11.7.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.7.0.tgz", + "integrity": "sha512-K8BNSPySfeShBQXsahYB/AbbWruVOTyVpgoIDnl8odPpeSfP2J5QO2oLFFdl2j7GfDCtZj2bMKar2T49itTPCg==", + "dev": true + }, + "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.1", + "arrify": "^1.0.0", + "glob": "^7.0.3", + "object-assign": "^4.0.1", + "pify": "^2.0.0", + "pinkie-promise": "^2.0.0" + } + }, + "graceful-fs": { + "version": "4.1.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", + "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "dev": true + }, + "iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "requires": { + "safer-buffer": ">= 2.1.2 < 3" + } + }, + "ignore": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-4.0.6.tgz", + "integrity": "sha512-cyFDKrqc/YdcWFniJhzI42+AzS+gNwmUzOSFcRCQYwySuBBBy/KjuxWLZ/FHEH6Moq1NizMOBWyTcv8O4OZIMg==", + "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", "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "requires": { - "once": "1.4.0", - "wrappy": "1.0.2" + "once": "^1.3.0", + "wrappy": "1" } }, "inherits": { @@ -68,29 +545,273 @@ "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, + "inquirer": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^3.0.0", + "figures": "^2.0.0", + "lodash": "^4.17.10", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^6.1.0", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "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 + }, + "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.0" + } + }, + "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.1" + } + }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", + "dev": true + }, + "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 + }, + "isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "dev": true + }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, + "js-yaml": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", + "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "esprima": "^4.0.0" + } + }, + "json-schema-traverse": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true + }, + "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 + }, + "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" + } + }, + "lodash": { + "version": "4.17.10", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", + "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==", + "dev": true + }, + "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", "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", "requires": { - "brace-expansion": "1.1.8" + "brace-expansion": "^1.1.7" } }, + "minimist": { + "version": "0.0.8", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" + }, + "mkdirp": { + "version": "0.5.1", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", + "requires": { + "minimist": "0.0.8" + } + }, + "moment": { + "version": "2.22.2", + "resolved": "https://registry.npmjs.org/moment/-/moment-2.22.2.tgz", + "integrity": "sha1-PCV/mDn8DpP/UxSWMiOeuQeD/2Y=", + "optional": true + }, + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", + "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 + }, + "mv": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/mv/-/mv-2.1.1.tgz", + "integrity": "sha1-rmzg1vbV4KT32JN5jQPB6pVZtqI=", + "optional": true, + "requires": { + "mkdirp": "~0.5.1", + "ncp": "~2.0.0", + "rimraf": "~2.4.0" + }, + "dependencies": { + "glob": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz", + "integrity": "sha1-DwiGD2oVUSey+t1PnOJLGqtuTSI=", + "optional": true, + "requires": { + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "2 || 3", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "rimraf": { + "version": "2.4.5", + "resolved": "http://registry.npmjs.org/rimraf/-/rimraf-2.4.5.tgz", + "integrity": "sha1-7nEM5dk6j9uFb7Xqj/Di11k0sto=", + "optional": true, + "requires": { + "glob": "^6.0.1" + } + } + } + }, + "nan": { + "version": "2.11.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.11.0.tgz", + "integrity": "sha512-F4miItu2rGnV2ySkXOQoA8FKz/SR2Q2sWP0sbTxNxz/tuokeC8WxOhPMcwi0qIyGtVn/rrSeLbvVkznqCdwYnw==", + "optional": true + }, + "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 + }, + "ncp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ncp/-/ncp-2.0.0.tgz", + "integrity": "sha1-GVoh1sRuNh0vsSgbo4uR6d9727M=", + "optional": true + }, + "nice-try": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.5.tgz", + "integrity": "sha512-1nh45deeb5olNY7eX82BkPO7SSxR5SSYJiPTrTdFUVYwAl8CKMA5N9PjTYkHiRjisVcxcQ1HXdLhx2qxxJzLNQ==", + "dev": true + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "requires": { - "wrappy": "1.0.2" + "wrappy": "1" } }, + "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.0.0" + } + }, + "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.4", + "levn": "~0.3.0", + "prelude-ls": "~1.1.2", + "type-check": "~0.3.2", + "wordwrap": "~1.0.0" + } + }, + "os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true + }, "path": { "version": "0.12.7", "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", "integrity": "sha1-1NwqUGxM4hl+tIHr/NWzbAFAsQ8=", "requires": { - "process": "0.11.10", - "util": "0.10.3" + "process": "^0.11.1", + "util": "^0.10.3" } }, "path-is-absolute": { @@ -98,11 +819,274 @@ "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-key": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", + "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", + "dev": true + }, + "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", + "integrity": "sha1-clVrgM+g1IqXToDnckjoDtT3+HA=", + "dev": true + }, + "pinkie-promise": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pinkie-promise/-/pinkie-promise-2.0.1.tgz", + "integrity": "sha1-ITXW36ejWMBprJsXh3YogihFD/o=", + "dev": true, + "requires": { + "pinkie": "^2.0.0" + } + }, + "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 + }, "process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=" }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=", + "dev": true + }, + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", + "dev": true + }, + "regexpp": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.0.tgz", + "integrity": "sha512-g2FAVtR8Uh8GO1Nv5wpxW7VFVwHcCEr4wyA8/MHiRkO8uHoR5ntAA8Uq3P1vvMTX/BeQiRVSpDGLd+Wn5HNOTA==", + "dev": true + }, + "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.0" + } + }, + "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": "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.0", + "signal-exit": "^3.0.2" + } + }, + "rimraf": { + "version": "2.6.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", + "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", + "dev": true, + "requires": { + "glob": "^7.0.5" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "dev": true, + "requires": { + "is-promise": "^2.1.0" + } + }, + "rxjs": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.1.tgz", + "integrity": "sha512-hRVfb1Mcf8rLXq1AZEjYpzBnQbO7Duveu1APXkWRTvqzhmkoQ40Pl2F9Btacx+gJCOqsMiugCGG4I2HPQgJRtA==", + "dev": true, + "requires": { + "tslib": "^1.9.0" + } + }, + "safe-json-stringify": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/safe-json-stringify/-/safe-json-stringify-1.2.0.tgz", + "integrity": "sha512-gH8eh2nZudPQO6TytOvbxnuhYBOvDBBLW52tz5q6X58lJcd/tkmqFR+5Z9adS8aJtURSXWThWy/xJtJwixErvg==", + "optional": true + }, + "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.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.1.tgz", + "integrity": "sha512-PqpAxfrEhlSUWge8dwIp4tZnQ25DIOthpiaHNIthsjEFQD6EvqUKUDM7L8O2rShkFccYo1VjJR0coWfNkCubRw==", + "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 + }, + "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" + } + }, + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "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" + } + }, + "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": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + }, + "table": { + "version": "4.0.3", + "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", + "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "dev": true, + "requires": { + "ajv": "^6.0.1", + "ajv-keywords": "^3.0.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", + "slice-ansi": "1.0.0", + "string-width": "^2.1.1" + } + }, + "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", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "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" + } + }, + "tslib": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.3.tgz", + "integrity": "sha512-4krF8scpejhaOgqzBEcGM7yDIEfi0/8+8zDRZhNZZ2kjmHJ4hv3zCbQWxoJGz1iw5U0Jl0nma13xzHXcncMavQ==", + "dev": 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" + } + }, + "uri-js": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", + "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", + "dev": true, + "requires": { + "punycode": "^2.1.0" + } + }, "util": { "version": "0.10.3", "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", @@ -118,10 +1102,34 @@ } } }, + "which": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", + "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", + "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" + } } } } diff --git a/package.json b/package.json index 69d4c0e..8078b2a 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "version": "2.0.0", "description": "Combine solidity files to one flat file", "scripts": { - "start": "node index.js" + "start": "node index.js", + "lint": "./node_modules/.bin/eslint ." }, "bin": { "poa-solidity-flattener": "index.js" @@ -17,6 +18,7 @@ "license": "MIT", "homepage": "https://poa.network/", "dependencies": { + "bunyan": "^1.8.12", "decomment": "^0.9.1", "glob": "^7.1.2", "path": "^0.12.7" @@ -28,5 +30,7 @@ "url": "/issues" }, "main": "index.js", - "devDependencies": {} + "devDependencies": { + "eslint": "^5.5.0" + } }