truffle-flattener
Advanced tools
Comparing version 1.5.0 to 1.6.0
12
index.js
@@ -14,3 +14,3 @@ #! /usr/bin/env node | ||
const IMPORT_SOLIDITY_REGEX = /^\s*import(\s+).*$/gm; | ||
const IMPORT_SOLIDITY_REGEX = /^\s*import(\s+)[\s\S]*?;\s*$/gm; | ||
@@ -104,3 +104,11 @@ function unique(array) { | ||
.concat(entryPoints) | ||
.map(f => fileNameToGlobalName(f, projectRoot)); | ||
.map(f => { | ||
// Remove the prefix node modules. | ||
const fileName = fileNameToGlobalName(f, projectRoot) | ||
if (fileName.substring(0, 14) == 'node_modules\\@') { | ||
return fileName.substring(13) | ||
} else { | ||
return fileName | ||
} | ||
}); | ||
@@ -107,0 +115,0 @@ const files = unique(withEntries); |
{ | ||
"name": "truffle-flattener", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"description": "Truffle Flattener concats solidity files developed under Truffle with all of their dependencies", | ||
@@ -24,3 +24,3 @@ "bin": { | ||
"@resolver-engine/imports-fs": "^0.2.2", | ||
"@solidity-parser/parser": "^0.8.0", | ||
"@solidity-parser/parser": "^0.14.1", | ||
"find-up": "^2.1.0", | ||
@@ -27,0 +27,0 @@ "mkdirp": "^1.0.4", |
@@ -16,14 +16,18 @@ # truffle-flattener | ||
# Installation | ||
# Hardhat support | ||
If you are using Hardhat, you don't need this project. Use `npx hardhat flatten` instead. | ||
## Installation | ||
`npm install truffle-flattener -g` | ||
# Usage | ||
## Usage | ||
Just intall it with npm in your truffle project and run | ||
Just install it with npm in your truffle project and run | ||
`truffle-flattener <solidity-files>`. | ||
# Limitations | ||
## Limitations | ||
Aliased imports (eg: `import {symbol1 as alias, symbol2} from "filename";`) are | ||
not supported by `truffle-flattener`. |
@@ -122,2 +122,18 @@ const assert = require("chai").assert; | ||
}); | ||
it("Should handle multiline imports", async function() { | ||
const content = await flatten([ | ||
"./contracts/whitespace/multiline-import.sol" | ||
]); | ||
const expected = | ||
"// File: contracts/whitespace/simple.sol\n" + | ||
"\n" + | ||
"// A simple contract\n" + | ||
"\n" + | ||
"// File: contracts/whitespace/multiline-import.sol\n" + | ||
"\n" + | ||
"// including others\n"; | ||
assert.equal(content, expected); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15201
15
332
33
+ Added@solidity-parser/parser@0.14.5(transitive)
+ Addedantlr4ts@0.5.0-dev(transitive)
+ Addedbuffer-from@1.1.2(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsource-map-support@0.5.21(transitive)
- Removed@solidity-parser/parser@0.8.2(transitive)