-
Notifications
You must be signed in to change notification settings - Fork 494
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
chore: make contract artifacts usable in node #1632
chore: make contract artifacts usable in node #1632
Conversation
|
||
let ${contractName}JSONConfig = ${JSON.stringify(contractJSON)}; | ||
let ${contractName} = new EmbarkJS.Blockchain.Contract(${contractName}JSONConfig); | ||
export default ${contractName}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is where problems might arise. export
doesn't exist in Node. I forgot to mention it to you because I hadn't notice because the problem the user was having was with the import.
When trying to do the node embarkjs, it's the export that gave me the most problems, because you can't put export in an if
... Maybe you can find a solution, but maybe we'll need to transpile those too 😞
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, does module.exports
not work on the browser?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last I tried, it didn't. Maybe it was something I was doing wrong.
a0a3554
to
ccb8fb0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good (haven't tested, but I assume it works)
ccb8fb0
to
1f336f2
Compare
DeepCode analyzed this pull request. Click to see more details. |
1f336f2
to
a3ee37a
Compare
DeepCode analyzed this pull request. Click to see more details. |
25918e8
to
5618c49
Compare
DeepCode analyzed this pull request. Click to see more details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!
Would just be better to use constants
packages/embark-whisper/src/index.js
Outdated
@@ -24,6 +24,7 @@ class Whisper { | |||
this.embark = embark; | |||
this.web3Ready = false; | |||
this.webSocketsChannels = {}; | |||
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/modules should be put in a constant and used everywhere from the symlink generation to the uses in modules
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); | |
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir, "modules"); |
Also should make use of the path-joining that dappPath()
does because doing + "/"
is problematic on Windows.
@@ -23,6 +23,7 @@ class IPFS { | |||
this.addedToConsole = false; | |||
this.storageProcessesLauncher = null; | |||
this.usingRunningNode = false; | |||
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -23,6 +23,7 @@ class Swarm { | |||
this.addedToConsole = false; | |||
this.storageProcessesLauncher = null; | |||
this.usingRunningNode = false; | |||
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
5618c49
to
52ea0aa
Compare
packages/embark-whisper/src/index.js
Outdated
@@ -24,6 +24,7 @@ class Whisper { | |||
this.embark = embark; | |||
this.web3Ready = false; | |||
this.webSocketsChannels = {}; | |||
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir + "/modules"); | |
this.modulesPath = dappPath(embark.config.embarkConfig.generationDir, "modules"); |
Also should make use of the path-joining that dappPath()
does because doing + "/"
is problematic on Windows.
52ea0aa
to
cc493f1
Compare
cc493f1
to
0827ad4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🙌
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't merge yet: tests are consistently not passing on Windows, probably some path-related thing. I'm investigating currently and will commit on this branch when I've fixed it.
55260a5
to
d855fa1
Compare
What was needed for this to work on Windows: Because we're using the path-strings in the context of code generation, the |
The reason that's needed is that otherwise symlink creation for The problem isn't noticed after the first run of Unfortunately, it's not just Rather than make those adjustments now, I'm leaving this PR marked as changes requested, and I think we should discuss if the fix above is the way to go or if there's a better way. |
d855fa1
to
3a19f10
Compare
These are all the places the workaround mentioned in my previous comment have been introduced: Tests are passing, and I successfully test-drove each of the commands that had the change introduced. |
DeepCode encountered a problem when analyzing this pull request. If you want to retry, create a comment: "Retry Deepcode". |
Retry Deepcode |
DeepCode analyzed this pull request. Click to see more details. |
This will work 100% of the time, all the time.
Co-Authored with @michaelsbradleyjr