Socket
Socket
Sign inDemoInstall

truffle-flattener

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

truffle-flattener - npm Package Compare versions

Comparing version 1.5.0 to 1.6.0

.github/dependabot.yml

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);

4

package.json
{
"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);
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc