-
Notifications
You must be signed in to change notification settings - Fork 5
Add Windows support #2
Comments
We can probably use this package: https://github.com/charlesguse/run-script-os |
I've dived a little deeper in this issue: adrianmcli/truffle-next#21 |
What about actually writing the contracts json (SimpleStorage.json) files into a directory within the react app ?
found it here: It looks like as if you need to keep (a copy of) Migrations.json in build/contracts, otherwise you will get an an error like
But as Migrations.sol / Migrations.json normally never change, this is just a one time action during project setup and thus should not be too much of an issue. Above change works with all other code unchanged or think about a better place for the json files and change the reference in Web3Container.js as well. |
@SvenMeyer Thanks for the suggestion, it's certainly a more elegant workaround. But I'm hesitant to use it because it changes the default behaviour of Truffle's barebones project (i.e. the traditional I've also considered another solution, which is to eject the React app and remove the restriction from requiring the JSON files outside of I really think there is no good solution right now, we'll have to see what else we can figure out from this going forward. What do you think about being able to pass an array into the Truffle options so that it could write the artifacts to multiple folders? |
|
@SvenMeyer Yeah I think it's a great idea to output the build artifacts to a user-specified folder. But I want to maintain the structure of a typical truffle project. Having the ability to output build artifacts to multiple paths is also beneficial because there are sometimes multiple frontends/dapps that share the same contracts. I'm actually a member of the Truffle team myself, and I talked to one of the people on our team today. As for the symlink, I think this works for windows:
In my PR for the new Truffle React box, I've used it with
Of course, you need to install |
@SvenMeyer Just some follow up comments:
We're working on a new approach to migrations, so the issues with
Yeah I agree, but it's the best option we have right now unless we use
The reason why Create-React-App disallows importing from out of Since we're just importing a JSON file, it shouldn't be a big deal. But ejecting a CRA project means you get a huge mess of files and folders that will confuse beginners and I am very much against that. The only option here is to use the CRA script to bootstrap a custom project where the plugin is not configured. But that means maintaining our own CRA custom project and I don't want to do that either. I hope that gives you some more context, but that is the reason why I am more in favour of a seamless NPM script rather than requiring the user to move things around. |
thanks for the extensive follow-up and explanation. As you are a truffle team member, I am sure (hope) you will come up with a nice solution, but meanwhile the symlink is ok, especially with the script and explanation provided (is it on the truffle and github page already?) |
I'm still waiting for a teammate to test it on Windows. But this is on my list of things to do for this week. |
Unfortunately I don't have a Windows machine, but in order for Windows support to work, we need to make sure that the symlink is created automatically when unboxing happens. Currently, that is done by running an NPM script
npm run link-contracts
, but since this usesln -s
, it only works on Linux and Mac.We basically need a "
cross-env
" way of doing this.The text was updated successfully, but these errors were encountered: