-
Notifications
You must be signed in to change notification settings - Fork 491
Add a wrapper script to keep ./solcjs
working
#590
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
Conversation
We discussed this and I think this mostly a fault of the Solidity tests. Now if for some reason the file is not included in |
Yeah, it's not. And changing it to |
Clarification after some discussion: this is not a problem in solc-js, but rather that non-standard way Solidity tests use solc-js. Solidity tests do a clone, then |
The thing is, I'm not sure all users realize that we consider this usage non-standard. I certainly did not :) |
Well, you are not supposed to clone an npm package and use internals. You are supposed to install it as a dependency or globally. |
Adding a symlink does not hurt in any case. |
After #566 it will be more complicated. The symlink will need to point to |
I just checked and it does require |
The documentation could be updated if they are working with it locally to be something like:
...
...
|
But
We actually don't have any documentation on development usage. It all assumes you're dealing with a package installed via npm currently. Most projects have some info on building and running tests and I think we should have that too. That's a separate issue though. |
Makes sense, This could be a npm script or as well like npm start which will execute the typescript directly? |
If those can take parameters, accept standard input, itp. then I guess it would work. Still, the point of the PR is to keep it working the old way until a breaking version. |
a3ee0c8
to
f6d18e7
Compare
./solcjs
working./solcjs
working
I have now replaced the symlink with a small wrapper script that will run build if necessary and then execute |
@axic What do you think about the current version with a script rathter than a symlink. Do you have anything against merging it? We were just discussing backwards-compatibility on Gitter and both @ekpyron and @stephensli agree that it would be nice to have at least this bit just for people who simply do |
f6d18e7
to
83d4072
Compare
Updated the wrapper script to make it portable. Uses |
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.
Is there a way to make this not depend on the cwd?
This was raised here #599 about flattening the directory and build entirely, but generally building into a dist folder is preferred and easier to manage. |
Yeah. At least as long as you want it just in the simple case of running the script via |
I don't understand - is there an easy and portable way to at least solve it for some cases it can be invoked in? |
Yes, that's what I meant. For invocation via |
83d4072
to
5365680
Compare
Updated. Now it should be independent of where you call it from. |
solcjs
Outdated
|
||
script_dir="$(cd "$(dirname "$0")" && pwd)" | ||
|
||
[ -e "$script_dir/dist/solc.js" ] || npm run build |
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.
shouldn't this be
[ -e "$script_dir/dist/solc.js" ] || npm run build | |
[ -e "$script_dir/dist/solc.js" ] || (cd "$script_dir" && npm run build) |
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.
or maybe fail instead of building transparently?
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.
Ah, true. I only tested it quickly with --version
and missed that completely :) Fixed.
I think that building transparently is better because the whole point of this is to keep things backwards-compatible. If you can adjust your workflow to run npm build
, you can just as well switch to dist/solc.js
. I added a comment to make this clear.
…t in a breaking release
5365680
to
fa1bbab
Compare
script_dir="$(cd "$(dirname "$0")" && pwd)" | ||
cd "$script_dir" | ||
|
||
[ -e dist/solc.js ] || npm run build | ||
exec dist/solc.js "$@" < /dev/stdin |
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.
If you do it like that, the change will persist until after the script has run, which is also weird.
What about
script_dir="$(cd "$(dirname "$0")" && pwd)" | |
cd "$script_dir" | |
[ -e dist/solc.js ] || npm run build | |
exec dist/solc.js "$@" < /dev/stdin | |
script_dir="$(cd "$(dirname "$0")" && pwd)" | |
( | |
cd "$script_dir" | |
[ -e dist/solc.js ] || npm run build | |
exec dist/solc.js "$@" < /dev/stdin | |
) |
(not sure if we have to repeat the set
comamand)
Closing since I was busy with other tasks and we ended up releasing without it. I think that there's not much point adding it now. |
After #587 anything that relies on executing specifically
./solcjs
is broken. For example in the main repo external tests (e.g. the Colony test) are failing due to this.The right solution is to run
solcjs
vianpm exec
but I think this is might still break some workflows and we should wait with it until a breaking release. This is expecially because apparently the file innode_modules/.bin/
does not get created when you clone the repo and runnpm install
sonpm exec
is unusable in that scenario. I suspect the file innode_modules/.bin/
might only be created for packages installed as dependencies.