-
Notifications
You must be signed in to change notification settings - Fork 229
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
Allow running Dart scripts upon package installation #1904
Comments
Similar to what is mentioned in #39 (comment) |
@zoechi The community could put together something like Anyways, that's beyond the scope of this discussion 😄 |
I forked Pub and got this working in an I'm going to go ahead and send a PR, because I don't know how much time the maintainers will have to resolve individual issues in this repo. |
This would change the security model for pub significantly, and I am not convinced the potential value justifies the potential risk. |
I had an open PR for this, but closed it for this very reason. Going to close the issue, too. |
Somewhat related to the long-closed #1674, but I believe this is a better solution.
What if, upon running
pub get
, a package could execute one or more scripts written in Dart? This would be useful for doing things like building native extensions, or other configuration necessary for the execution of a given package.There could be a field called
after_install
with either a path to a single Dart script, or a list of paths. These paths would be resolved relative to the current working directory.Example
The
pub
tool could spin up a new isolate instead of a new VM.Nested usage (in dependencies)
pub
should also be able to runafter_install
scripts from packages that are dependencies. For example, if you depend onpackage:foo
that bundles atool/bar.dart
, you'll get the following:Caveats
package:foo
's scripts would run in~/.pub-cache/hosted/pub.dartlang.org/foo/x.y.z
.~/.pub-cache/after_install_cache.yaml
) present containing timestamps of when each script was run, so that the user would not be repeatedly nagged to run scripts from every package they depend on. This would be in the pub cache, so that even if you use the same package in multiple projects, you'd only have to run things like native extension builders once globally.Conclusion
Overall, I think that the ability to run a callback script can go a long way to improving the Dart ecosystem. Being able to build things like native extensions on-the-fly would be great for Dart IMO.
P.S. I'm wholly willing to send a PR, and would actually love to do so ASAP. Thanks in advance for consideration.
The text was updated successfully, but these errors were encountered: