-
Notifications
You must be signed in to change notification settings - Fork 134
Feature: spago script #712
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
|
It's also worth noting that this PR doesn't make any attempt to do the following:
Those are all well worth doing in followup PRs, but we wanted to keep this small and get the feature in its smallest form implemented. |
f-f
left a comment
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.
@colinwahl @thomashoneyman thank you so much for doing this, looks great! There are some things to adjust and I left some comments, thank you for leaving some review pointers too
|
@colinwahl to answer your questions:
|
Co-authored-by: Fabrizio Ferrai <[email protected]>
|
I made some progress on this last night and updated some comments. I'll be back later today to continue working on it. |
…emory, for use by script and repl
… -d for dependencies for repl and script
… a spago project. Instead, create template file and create config in memory, which avoids writing unused files to the temp directory
|
@f-f I've run into a bit of an issue with implementing a test to check program output: It looks like the Do you think that is worth prioritizing now? I'm not sure how to get those logs to go somewhere else. |
|
@colinwahl these lines are outputted by the compiler, which uses 0.14 is about to come out, but I'd also be fine with a crappy workaround to make these tests pass as long as we have enough comments pointing out the hack to be removed as soon as we upgrade to the new release. Makes sense? |
Sounds good! My workaround for now is to not have a test that checks the actual output of a script, but instead one that checks a file created by a script matches what it should. I'll put a comment about wanting some additional tests once 0.14 is out. |
|
It looks like moving to using absolute paths via I'm not sure exactly why this is happening but it seems to be something to do with I'm going to keep investigating but I'm having a bit of trouble. @f-f @thomashoneyman If you've seen something like this before, any tips would be appreciated! |
|
@colinwahl in my experience trying to work with Windows absolute paths is always extremely fiddly. If that doesn't help, according to these docs together with these docs it looks like we might be able to use unix-like absolute paths with |
@f-f The unix-like absolute paths do work - I ended up replacing the backslashes (that were improperly escaped) with forward slashes and now things are working on windows. |
|
I've fix the tests, resolved review comments & finished my checklist - I think this is ready for a final review! |
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.
@colinwahl this is almost perfect now! Really great work! 👏 🎉
I left only small suggestions, so once we resolve these we can merge 🙂
thomashoneyman
left a comment
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.
Agree with @f-f's feedback, and I'm really excited this has come together. Great work, @colinwahl!
Co-authored-by: Fabrizio Ferrai <[email protected]>
Co-authored-by: Fabrizio Ferrai <[email protected]>
Co-authored-by: Fabrizio Ferrai <[email protected]>
Co-authored-by: Fabrizio Ferrai <[email protected]>
Co-authored-by: Fabrizio Ferrai <[email protected]>
|
Thanks @f-f for the feedback & tips, it's all ready now :D |
Description of the change
Fixes #683 by implementing a
scriptcommand, which can be used to run a standalone PureScript file.To see an example, you can run this command:
spago script -d node-fs ~/path/to/script.purson this file: https://gist.github.com/colinwahl/ea8f9cc1f13b0ac9e9ba80614d8aff24
to log to the console and write a text file.
This will install the
node-fsdependency (along with the defaultconsole,effect, andpsci-supportdependencies), compile the files, and run themainfunction within the provided file.It is similar to
spago repl, except that it executes the given script instead of opening a repl.Checklist:
READMEOpen Questions: