A build tool for PureScript.
$ npm install -g purescript pulpThe structure of a pulp project should look like this:
root
- bower.json
- src/
- test/
Put your .purs source files in the src directory, and any tests
you might have in the test directory.
Also, create a bower.json file (see
http://bower.io/#defining-a-package). pulp expects to find this
file in the root of your project. You can invoke pulp from a
subdirectory; if there is no bower.json to be found in the current
directory, pulp will look through parent directories until it finds
it.
pulp supports the following commands:
-
pulp initgenerates a project skeleton with abower.jsonfile and a simple example program. -
pulp depdoes dependency management through Bower; essentially, it just passes you on to a locally installed version ofbower. Thus,pulp dep install foo --saveis the equivalent ofbower install foo --saveexcept you don't need to install Bower globally. -
pulp buildinvokes the PureScript compiler. Currently, it just compiles all.pursfiles in yoursrcand dependencies into the target directory, which defaults tooutput. -
pulp testruns your test suite: it expects aTest.Mainpackage in thetestdirectory, containing amainfunction, which is required and run using Node. It's expected that failing tests will cause the program to terminate with an error.Test.QuickCheckworks well for this purpose. -
pulp runwill first runpulp build, then launch the compiled project code in a Node process. The entry point will be themainfunction in the module specified with the--mainoption, or, by default, the moduleMain. -
pulp browserifyalso runspulp build, then runs the project code through Browserify. The entry point is decided in the same way as withpulp run. You can specify an output file using--to; the default is to output the bundle to stdout, which is convenient for doing things likepulp browserify | uglifyjs -c.If you want to browserify your test suite, e.g. if you want to run tests in the browser, you can run
pulp browserify -I test --main Test.Main. -
pulp docsgenerates a project documentation file using PureScript'spsc-docscommand. -
pulp pscilaunches a PureScript REPL usingpsciwith the project's modules and dependencies installed. -
pulp serveruses Webpack to launch a web server on your project directory, with the compiled project mounted as/app.js. Simply add anindex.htmlfile and enjoy Webpack style automatic rebuilding.
You can launch any of the above commands with the --watch or -w
option, which will cause pulp to run indefinitely, watching your
src and test folders for changes, and re-running the command
whenever something changes.
Copyright 2014 Bodil Stokke
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
See the LICENSE file for further details.
