-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support configuration at truffle-config.js #5
Comments
It may be possible to get the Truffle root from |
@frangio not related to this bug but how is the config file used? What does truffle-flattener need from truffle.js at the moment? I've been thinking it would be cool to include sample code for how to add truffle-flattener to your project and add a command so it automatically flattens all your files at build time and adds them to a flattened folder, what do you think? |
It's only used to find the root of the project. As @frangio said, I've been working on this change, which is really simple. But the code got too messy, so I'll work on a refactor before implementing this. |
@alcuadrado thanks! Do you have anywhere I should look for how to implement truffle-flattener in my truffle build config or something similar? I think it's really important for all deploys to be done with flattened files for later verification so I want to automate that. If not I can probably figure it out, any starting point would be helpful though! |
Can you expand more on that idea? I'm not sure if I'm following you. |
@alcuadrado totally! So right now it works great to install truffle-flattener and then run terminal or command line commands to get an output of a flattened file. What should I do if I want to include truffle-flattener in my truffle package.json and run commands in truffle.js to force it to create a new, flattened file on each deploy. Have you done anything like that before, or do you just use it from the terminal and copy/paste the results to use them? |
@alcuadrado I've added and test a PR to solve that issue: #10 |
@tomasienrbc I still don't get your point. Truffle also flattens the source code. If you run this tool after deploying with truffle you should get the code needed to verify the contract. Doesn't it work for you? |
Actually you won't - the flattener adds extra spacing and comments. For whatever reason, comments and spacing impact the bytecode that is generated, so if there's any extra spacing in the flattener you can't verify the contract. That's why I want to set this up so that the actual deployed contract is the flattened one. I don't know enough about the solidity compiler to know why this is the case but it is. So I want to run this in my actual truffle deploy script, do you think that could be possible? |
Hallo This is something you should better ask in the trufflesuite project...maybe it is even.possible to build in the migrate/build either with a hook or a command switch |
I'm closing this issue as it has been fixed by @cedricwalter. Can we follow your issue on #12 @tomasienrbc ? Can you point me to an example please? |
The configuration file for Truffle can be called
truffle.js
ortruffle-config.js
(briefly mentioned in the docs...).truffle-flattener
assumes it's attruffle.js
:https://github.com/alcuadrado/truffle-flattener/blob/c991806d7bb8109b689ed09dee216039d8be3505/index.js#L211
The text was updated successfully, but these errors were encountered: