@Benjmhart that’s a good point about Halogen and hot reloading. Thanks for the link! I’ve also added pscid to the list of tooling, because I’d forgotten about it – I find the compile / error loop to be quite fast in VSCode and Vim with the IDE server, but I’m not waiting on Parcel or Webpack.
@cprussin That’s good to learn about. I wasn’t aware you could do this with Yarn, and it’s one more reason to move away from npm / npx. I’ve updated the post to include this information.
At this point you can easily get away with managing a PureScript project with only Yarn installed and then using it to install the compiler, Spago, and Parcel. That’s a reasonably lean set of tools. I have a soft spot for managing everything with Nix, but I don’t think that’s a reasonable suggestion as the default for most people.
On the one hand I think it makes sense to add a file to the documentation repository for web-specific tooling which recommends Yarn + Spago + Parcel, but on the other, this stuff is largely a matter of opinion, is project-specific, and changes fast. That makes me ambivalent about any official endorsements.
On one hand, I like how unopinionated PS is, but on the other I don’t I think a lot of people don’t know how to get started, and yarn + spago + parcel is a great way to get going. Having this list here is great, but I use PS every day and I barely ever visit this forum. I’d imagine new users are similar.
I put together a minimal repo for anyone wanting a quick start with the tooling recommended in the thread. I left zephyr out, as I can’t find any docs on using it with spago. I also left out npx and psvm.
I’ve found this guide to be the most helpful. Should the above two references be updated to follow this workflow?
I’m attempting to update the first guide, and want to clarify what prereqs are needed to launch the repl.
Edit: Found yarn spago repl, so disregard the rest of this message.
Should purescript still be installed with npm or yarn globally, or should I find a way to temporarily add the project’s specific version (located in node_modules/purescript/purs.bin) to $PATH?
Here’s a log of what happens when attempting to launch the repl if purescript is only installed via yarn as described in the first post:
> purs repl
Command 'purs' not found
> node_modules/purescript/purs.bin --version
0.13.3
> node_modules/purescript/purs.bin repl
purs repl: No input files; try running `pulp psci` instead.
For help getting started, visit https://github.com/purescript/documentation/blob/master/guides/PSCi.md
Usage: For basic information, try the `--help' option.
> pulp psci
Command 'pulp' not found
Yea, looks like the yarn ... commands are what you’re looking for if you want to run locally-installed tooling in your project. As far as updating the getting started guides, I opened an issue about adding this guide, but it hasn’t seen much progress yet.
Ultimately I think of this as my recommendation, but not necessarily something that would work as an official ‘PureScript’ stance. Still, I think it deserves a place somewhere in the official docs.
Unfortunately, I’m struggling to get spago bundle-app working (see default.nix):
purs bundle: No input files.
[error] Bundle failed.
Please let me know if you have suggestions!
Edit: that error was due to missing \ on line 28. Now I get a new error:
Couldn't find a CommonJS module for the specified main module: Example.Main
[error] Bundle failed.
I think this is because there is no Example in dist, but if I try to call spago without --no-install --no-build, it fails due to no internet connectivity in sandbox.
I agree that more opinionation would really improve the new user experience.
There’s currently no clear pathway to getting a web app running from the purescript.org landing page, even for users who read through both the quick start guide and the documentation page.
Something like create-react-app would be great. For now, it could just be a template clone command.
This would favor a particular toolchain and framework, but I don’t think that’s worse than the existing alternative of no direction. The unfairness could be partially remedied with a link to a “more frameworks” page.
Having official templates would also help focus everyone’s maintenance efforts and be a consistent springboard for tutorials.
For example, it would be nice if we could arrive at best practices from each of these 7 reasonable Halogen templates and track one of them under the purescript-contrib org.
@milesfrain great points!
I opened this issue in Spago to track the addition of the --template flag as you mentioned in your post. I’ve been holding off on tracking this because I was not sure if it was a widespread need (vs just my feeling), but it looks like it would improve UX so I’d be happy to see this happening
Since this thread is about opinionated recommendations, which editor / IDE would you recommend for PureScript development?
I’m a long time Sublime Text user, but I have found the ST plugin quite lacking. There is no auto-import, the import auto-complete is close to useless, the error reporting hover window comes out once every full moon and sometimes it gets stuck completely and I have to pkill -f purs.ide.server. I might as well keep it only for the syntax highlighting and just use some other aiding tool, such as the aforementioned pscid.
I’m conversant with Python, so I might pick up the ST plugin in the future and work on it, but for now I’m still learning PureScript, so I’d like to at least know what the state of the art is.
As of 2020, which IDE has the best integration, meaning the best auto-complete, auto-import, error reporting, type information, pop-up documentation, jump to definition, and such features?