Skip to content
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

Closed
frangio opened this issue Nov 15, 2017 · 11 comments
Closed

Support configuration at truffle-config.js #5

frangio opened this issue Nov 15, 2017 · 11 comments

Comments

@frangio
Copy link
Contributor

frangio commented Nov 15, 2017

The configuration file for Truffle can be called truffle.js or truffle-config.js (briefly mentioned in the docs...).

truffle-flattener assumes it's at truffle.js:

https://github.com/alcuadrado/truffle-flattener/blob/c991806d7bb8109b689ed09dee216039d8be3505/index.js#L211

@frangio
Copy link
Contributor Author

frangio commented Nov 15, 2017

It may be possible to get the Truffle root from truffle-config (the package)...

@tomasienrbc
Copy link

@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?

@alcuadrado
Copy link
Member

It's only used to find the root of the project. As @frangio said, truffle-config can do this.

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.

@tomasienrbc
Copy link

@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!

@alcuadrado
Copy link
Member

Can you expand more on that idea? I'm not sure if I'm following you.

@tomasienrbc
Copy link

@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?

@cedricwalter
Copy link
Contributor

@alcuadrado I've added and test a PR to solve that issue: #10

@alcuadrado
Copy link
Member

@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?

@tomasienrbc
Copy link

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?

@cedricwalter
Copy link
Contributor

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

@alcuadrado
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants