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

Adding support for PureScript 0.9.1 and newer #61

Merged
merged 3 commits into from
Jun 6, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.psci
npm-debug.log
index.js
node_modules/
bower_components/
build/
output/
29 changes: 8 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ Invokes the `psc` command. The following options are supported.

Files to compile. Glob syntax is supported.

###### `ffi` (String or String Array)

Files for code that is included with a `foreign import` in the PureScript source. Glob syntax is supported.

###### `noTco` (Boolean)

Toggles `--no-tco` that disables tail-call optimizations.
Expand Down Expand Up @@ -76,9 +72,13 @@ Sets `--output=<string>` the specifies the output directory, `output` by default

Toggles `--no-prefix` that does not include the comment header.

###### `requirePath` (String)
###### `sourceMaps` (Boolean)

Toggles `--source-maps` that generates source maps.

Sets `--require-path=<string>` that specifies the path prefix to use for `require()` calls in the generated JavaScript.
###### `jsonErrors` (Boolean)

Toggles `--json-errors` that prints errors to stderr as JSON.

### `purescript.pscBundle(options)`

Expand All @@ -104,10 +104,6 @@ Toggles `--main` or sets `--main=<string>` that generates code to run the `main`

Sets `--namespace=<string>` that specifies the namespace that PureScript modules will be exported to when running in the browser.

###### `requirePath` (String)

Sets `--require-path=<string>` that specifies the path prefix to use for `require()` calls in the generated JavaScript. This should be set to match any value used in the `psc` task.

### `purescript.pscDocs(options)`

Invokes the `psc-docs` command. The following options are supported.
Expand Down Expand Up @@ -136,10 +132,6 @@ Generates a `.psci` file.

Files added to the `.psci` file with the `:m` command. Glob syntax is supported.

###### `ffi` (String or String Array)

Files added to the `.psci` file with the `:f` command. Glob syntax is supported.

## Full example

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.
Expand All @@ -154,13 +146,8 @@ var sources = [
"bower_components/purescript-*/src/**/*.purs",
];

var foreigns = [
"src/**/*.js",
"bower_components/purescript-*/src/**/*.js"
];

gulp.task("make", function () {
return purescript.psc({ src: sources, ffi: foreigns });
return purescript.psc({ src: sources });
});

gulp.task("bundle", ["make"], function () {
Expand All @@ -178,7 +165,7 @@ gulp.task("docs", function () {
});

gulp.task("dotpsci", function () {
return purescript.psci({ src: sources, ffi: foreigns })
return purescript.psci({ src: sources })
.pipe(gulp.dest("."));
});

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "gulp-purescript",
"private": true,
"devDependencies": {
"purescript-aff": "~0.13.0",
"purescript-foreign": "~0.7.0"
"dependencies": {
"purescript-aff": "~0.17.0",
"purescript-foreign": "~1.0.0"
}
}
2 changes: 1 addition & 1 deletion entry.js → index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

var gulpPurescript = require('GulpPurescript.Plugin');
var gulpPurescript = require('./output/GulpPurescript.Plugin');

function psc(options) {
return gulpPurescript.psc(options)();
Expand Down
44 changes: 18 additions & 26 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,34 @@
"node": ">=0.10.0"
},
"files": [
"index.js"
"LICENSE",
"index.js",
"output"
],
"scripts": {
"test:run": "node test.js | tap-spec",
"test": "npm run-script build && npm run-script test:run",
"build": "npm run-script build:compile && npm run-script build:docs && npm run-script build:package",
"build:compile": "./node_modules/.bin/pulp build -o build",
"build:docs": "./node_modules/.bin/pulp docs",
"build:package": "./node_modules/.bin/webpack --progress --colors --profile --bail",
"build:json": "./node_modules/.bin/webpack --progress --colors --profile --bail --json > index.json",
"prepublish": "npm run-script build"
"psc": "psc 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
"test": "npm run psc && (node test/test.js | tap-spec)",
"prepublish": "rm -r output && npm run psc"
},
"keywords": [
"gulpplugin",
"purescript"
],
"dependencies": {
"async": "^1.3.0",
"camelcase": "^1.1.0",
"cross-spawn": "^0.4.0",
"glob": "^5.0.5",
"gulp-util": "^3.0.4",
"async": "^2.0.0-rc.5",
"camelcase": "^3.0.0",
"cross-spawn": "^4.0.0",
"glob": "^7.0.3",
"gulp-util": "^3.0.7",
"logalot": "^2.1.0",
"resolve-bin": "^0.3.0",
"which": "^1.0.9"
"resolve-bin": "^0.4.0",
"which": "^1.2.9"
},
"devDependencies": {
"del": "^1.1.1",
"gulp": "^3.8.11",
"gulp-plumber": "^1.0.0",
"json-loader": "^0.5.1",
"pulp": "^4.3.0",
"run-sequence": "^1.0.2",
"tap-spec": "^2.2.2",
"tape": "^3.5.0",
"through2": "^0.6.3",
"webpack": "^1.8.9"
"gulp": "^3.9.1",
"purescript": "^0.9.1-rc.1",
"tap-spec": "^4.1.1",
"tape": "^4.5.1",
"through2": "^2.0.1"
}
}
2 changes: 0 additions & 2 deletions src/GulpPurescript/Buffer.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.Buffer

function mkBufferFromString(str) {
return new Buffer(str);
}
Expand Down
2 changes: 1 addition & 1 deletion src/GulpPurescript/Buffer.purs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module GulpPurescript.Buffer
( Buffer()
( Buffer
, mkBufferFromString
) where

Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/ChildProcess.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.ChildProcess

var child_process = require('cross-spawn');

function spawnFn(command, args, errback, callback) {
Expand Down
10 changes: 5 additions & 5 deletions src/GulpPurescript/ChildProcess.purs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
module GulpPurescript.ChildProcess
( ChildProcess()
( ChildProcess
, spawn
) where

import Prelude

import Control.Monad.Aff (Aff(), makeAff)
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (Error())
import Control.Monad.Aff (Aff, makeAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception (Error)

import Data.Function
import Data.Function.Uncurried (Fn4, runFn4)

foreign import data ChildProcess :: !

Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/Glob.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.Glob

var glob = require('glob');

var async = require('async');
Expand Down
12 changes: 6 additions & 6 deletions src/GulpPurescript/Glob.purs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
module GulpPurescript.Glob
( Glob()
( Glob
, glob
, globAll
) where

import Prelude
import Prelude (Unit, ($))

import Control.Monad.Aff (Aff(), makeAff)
import Control.Monad.Eff (Eff())
import Control.Monad.Eff.Exception (Error())
import Control.Monad.Aff (Aff, makeAff)
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception (Error)

import Data.Function
import Data.Function.Uncurried (Fn3, runFn3)

foreign import data Glob :: !

Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/GulpUtil.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.GulpUtil

var gutil = require('gulp-util');

function mkPluginErrorFn(name, message) {
Expand Down
8 changes: 4 additions & 4 deletions src/GulpPurescript/GulpUtil.purs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
module GulpPurescript.GulpUtil
( File()
( File
, mkPluginError
, mkFile
) where

import Control.Monad.Eff.Exception (Error())
import Control.Monad.Eff.Exception (Error)

import Data.Function
import Data.Function.Uncurried (Fn2, runFn2)

import GulpPurescript.Buffer (Buffer())
import GulpPurescript.Buffer (Buffer)

data File

Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/Logalot.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.Logalot

var logalot = require('logalot');

function info(message) {
Expand Down
6 changes: 3 additions & 3 deletions src/GulpPurescript/Logalot.purs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
module GulpPurescript.Logalot
( Logalot()
( Logalot
, info
) where

import Prelude
import Prelude (Unit)

import Control.Monad.Eff (Eff())
import Control.Monad.Eff (Eff)

foreign import data Logalot :: !

Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/OS.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.OS

var os = require('os');

function platformFn() {
Expand Down
14 changes: 8 additions & 6 deletions src/GulpPurescript/OS.purs
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
module GulpPurescript.OS
( OS()
( OS
, Platform(..)
, platform
) where

import Prelude
import Prelude (class Show, (<$>), (<>), const)

import Control.Monad.Eff (Eff())
import Control.Monad.Eff (Eff)
import Control.Monad.Eff.Exception.Unsafe (unsafeThrow)

import Data.Either (either)
import Data.Foreign (Foreign())
import Data.Foreign.Class (IsForeign, read)
import Data.Foreign (Foreign)
import Data.Foreign.Class (class IsForeign, read)
import Data.Maybe (Maybe(..))

foreign import data OS :: !
Expand All @@ -27,7 +28,8 @@ instance isForeignPlatform :: IsForeign Platform where
read a = (\a -> case a of
"darwin" -> Darwin
"linux" -> Linux
"win32" -> Win32) <$> read a
"win32" -> Win32
_ -> unsafeThrow ("Unhandled platform: " <> a)) <$> read a

platform :: forall eff. Eff (os :: OS | eff) (Maybe Platform)
platform = either (const Nothing) Just <$> read <$> platformFn
Expand Down
2 changes: 0 additions & 2 deletions src/GulpPurescript/Options.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use strict';

// module GulpPurescript.Options

var glob = require('glob');

var camelcase = require('camelcase');
Expand Down
Loading