Flat contract prefix definition from input
This commit is contained in:
parent
da9216d772
commit
2acae1c8bd
|
@ -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
|
||||
}
|
2
index.js
2
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");
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue