Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit fc001dd

Browse files
committed
Merge pull request #49 from purescript-contrib/full-example
Add an example of a full gulpfile
2 parents 6509bae + f691b75 commit fc001dd

File tree

1 file changed

+54
-2
lines changed

1 file changed

+54
-2
lines changed

README.md

Lines changed: 54 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ npm install gulp-purescript --save-dev
1414

1515
This plugin requires that the PureScript binaries first be installed. The binaries may be installed using the [purescript](https://www.npmjs.com/package/purescript) NPM package or as described on the PureScript [installation](https://github.com/purescript/purescript/wiki/Language-Guide:-Getting-Started#installation) section of the GitHub wiki.
1616

17-
## Example
17+
## Basic example
1818

1919
```js
2020
var gulp = require('gulp');
@@ -28,6 +28,8 @@ gulp.task('psc', function(){
2828
});
2929
```
3030

31+
There is also [a more complete example](#full-example) that makes use of all the provided tasks in a common setup.
32+
3133
## API
3234

3335
Refer to the PureScript [compiler usage](https://github.com/purescript/purescript/wiki/Language-Guide:-Getting-Started#compiler-usage) section of the Github wiki for additional details on the behaviour of each option below.
@@ -134,4 +136,54 @@ Files added to the `.psci` file with the `:f` command. Glob syntax is supported.
134136

135137
## Command line arguments
136138

137-
The `--verbose` argument will display the output during the `psc-make` command. For example `gulp --verbose`.
139+
The `--verbose` argument will display the output during the `psc` command. For example `gulp --verbose`.
140+
141+
## Full example
142+
143+
This example will make and bundle the code, run tests, and produce a `.psci` file and documentation for a project using the common `bower_components`/`src` file layout.
144+
145+
``` js
146+
var gulp = require("gulp");
147+
var purescript = require("gulp-purescript");
148+
var run = require("gulp-run");
149+
150+
var sources = [
151+
"src/**/*.purs",
152+
"bower_components/purescript-*/src/**/*.purs",
153+
];
154+
155+
var foreigns = [
156+
"src/**/*.js",
157+
"bower_components/purescript-*/src/**/*.js"
158+
];
159+
160+
gulp.task("make", function () {
161+
return purescript.psc({ src: sources, ffi: foreigns });
162+
});
163+
164+
gulp.task("bundle", ["make"], function () {
165+
return purescript.pscBundle({ src: "output/**/*.js", output: "dist/bundle.js" });
166+
});
167+
168+
gulp.task("docs", function () {
169+
return purescript.pscDocs({
170+
src: sources,
171+
docgen: {
172+
"Name.Of.Module1": "docs/Name/Of/Module1.md",
173+
"Name.Of.Module2": "docs/Name/Of/Module2.md"
174+
}
175+
});
176+
});
177+
178+
gulp.task("dotpsci", function () {
179+
return purescript.psci({ src: sources, ffi: foreigns })
180+
.pipe(gulp.dest("."));
181+
});
182+
183+
gulp.task("test", ["make"], function() {
184+
return purescript.pscBundle({ src: "output/**/*.js", main: "Test.Main" })
185+
.pipe(run("node"));
186+
});
187+
188+
gulp.task("default", ["bundle", "docs", "dotpsci", "test"]);
189+
```

0 commit comments

Comments
 (0)