diff --git a/helpers/variables.js b/helpers/variables.js index b207f6a..8f12ab6 100644 --- a/helpers/variables.js +++ b/helpers/variables.js @@ -15,6 +15,7 @@ let inputFileDir = path.dirname(inputFilePath); 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 allSrcFiles = []; let importedSrcFiles = {}; @@ -27,5 +28,6 @@ module.exports = { parentDir: parentDir, outDir: outDir, allSrcFiles: allSrcFiles, - importedSrcFiles: importedSrcFiles + importedSrcFiles: importedSrcFiles, + flatContractPrefix: flatContractPrefix } \ No newline at end of file diff --git a/index.js b/index.js index 42a2403..669c072 100644 --- a/index.js +++ b/index.js @@ -27,7 +27,7 @@ function getAllSolFilesCallBack(inputFileContent, dir, path, srcFiles) { replaceAllImportsRecursively(intermediateFileContent, dir, function(outputFileContent) { outputFileContent = removeDoubledSolidityVersion(outputFileContent); if (!fs.existsSync(variables.outDir)) fs.mkdirSync(variables.outDir); - fs.writeFileSync(variables.outDir + "/" + pathLib.basename(variables.inputFilePath, ".sol") + "_flat.sol", outputFileContent); + fs.writeFileSync(variables.outDir + "/" + variables.flatContractPrefix + "_flat.sol", outputFileContent); console.log("Success! Flat file is generated to " + variables.outDir + " directory"); }); });