I’m starting to learn purescript. I’m already an experienced developer in other languages, but I hired a freelance developer to help me get started with a purescript project to save time.
He created a project that includes a bower.json with many packages and their versions specified (not using ^). It works okay.
To learn from his code, I used ‘pulp init’ to create a minimal project, and then I started adding things to it from his code one at a time. At some point it complained that modules were missing, such as purescript-nullable, so I installed those. But at that point, ‘pulp build’ was giving me errors like “Partial defined twice.” So there were some kinds of version incompatibilities. I tried to uninstall or change the version of some of these packages, but it just turned into a giant mess.
In the end I created an entirely new project with ‘pulp init’ and copied the bower.json provided by my freelancer into it.
My question is, why did I have problems so quickly, simply by using bower to install packages? And if I run into such problems in the future, is there a way to “back out” or “uninstall” packages to try other versions? (Note that they’ve usually installed many dependencies at that point.)
I am in a similar position (experienced developer, just starting learning PureScript) and I have tried to do all I could to stay away from regular JavaScript tooling options (just like Bower).
Fortunately, @justinw wrote a nice tool (psc-package) that can take care of mostly everything; you may need to understand package-sets, but it has been a refreshing experience from my point of view.
Let me know if you want some more details on how to start a project using psc-package, from a newby like me.
Okay, I might get to that point. I want to start by understanding bower better. If I get messages that look like version incompatibilities, I’d like to understand how the bower archives could get into that state (somehow wrong dependencies attached to packages?), how to debug it and fix it.
Probably the worst thing about bower is that it will assume that the dependencies you have installed in bower_components are desirable, even if your bower.json defines different versions, or if you specifically ask to install a different version with bower install package#version.
My general recommendations would be:
always install with bower --save, this will only modify the bower.json if the install succeeds
wipe out bower_component when trying to upgrade dependencies, or if you’re getting version conflicts that seem like they shouldn’t occur
It’s also worth keeping in mind that not everything has been updated for PureScript 0.12 yet, so the conflicts you’re seeing might well be real, if you’re installing libraries outside of the core set.