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

Commit dbb8ce7

Browse files
committed
Update task names to reflect purs commands
1 parent d461594 commit dbb8ce7

File tree

6 files changed

+80
-83
lines changed

6 files changed

+80
-83
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ var gulp = require('gulp');
2121

2222
var purescript = require('gulp-purescript');
2323

24-
gulp.task('psc', function(){
25-
return purescript.psc({
24+
gulp.task('make', function(){
25+
return purescript.compile({
2626
src: 'src/*.purs'
2727
});
2828
});
@@ -36,9 +36,9 @@ Refer to the PureScript [compiler usage](https://github.com/purescript/purescrip
3636

3737
Options can be passed to the Haskell runtime system for `purs` by passing a `--purs-rts-flags` argument to `gulp`. Any values that follow this flag will be passed through to the runtime. There is no need to include `+RTS`/`-RTS` options as these are inserted automatically. See [the GHC documentation](https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/runtime-control.html#rts-opts-cmdline) for information on the available RTS options.
3838

39-
### `purescript.psc(options)`
39+
### `purescript.compile(options)`
4040

41-
Invokes the `psc` command. The following options are supported.
41+
Invokes the `purs compile` command. The following options are supported.
4242

4343
###### `src` (String or String Array)
4444

@@ -72,13 +72,13 @@ Toggles `--no-prefix` that does not include the comment header.
7272

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

75-
### `purescript.pscBundle(options)`
75+
### `purescript.bundle(options)`
7676

77-
Invokes the `purs compile` command. The following options are supported.
77+
Invokes the `purs bundle` command. The following options are supported.
7878

7979
###### `src` (String or String Array)
8080

81-
The `psc`-produced JavaScript source files to bundle. Glob syntax is supported.
81+
The `purs compile`-produced JavaScript source files to bundle. Glob syntax is supported.
8282

8383
###### `output` (String)
8484

@@ -100,7 +100,7 @@ Sets `--namespace=<string>` that specifies the namespace that PureScript modules
100100

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

103-
### `purescript.pscDocs(options)`
103+
### `purescript.docs(options)`
104104

105105
Invokes the `purs docs` command. The following options are supported.
106106

@@ -143,15 +143,15 @@ var sources = [
143143
];
144144

145145
gulp.task("make", function () {
146-
return purescript.psc({ src: sources });
146+
return purescript.compile({ src: sources });
147147
});
148148

149149
gulp.task("bundle", ["make"], function () {
150-
return purescript.pscBundle({ src: "output/**/*.js", output: "dist/bundle.js" });
150+
return purescript.bundle({ src: "output/**/*.js", output: "dist/bundle.js" });
151151
});
152152

153153
gulp.task("docs", function () {
154-
return purescript.pscDocs({
154+
return purescript.docs({
155155
src: sources,
156156
docgen: {
157157
"Name.Of.Module1": "docs/Name/Of/Module1.md",
@@ -166,7 +166,7 @@ gulp.task("dotpsci", function () {
166166
});
167167

168168
gulp.task("test", ["make"], function() {
169-
return purescript.pscBundle({ src: "output/**/*.js", main: "Test.Main" })
169+
return purescript.bundle({ src: "output/**/*.js", main: "Test.Main" })
170170
.pipe(run("node"));
171171
});
172172

index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22

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

5-
function psc(options) {
6-
return gulpPurescript.psc(options)();
5+
function compile(options) {
6+
return gulpPurescript.compile(options)();
77
}
88

9-
function pscBundle(options) {
10-
return gulpPurescript.pscBundle(options)();
9+
function bundle(options) {
10+
return gulpPurescript.bundle(options)();
1111
}
1212

13-
function pscDocs(options) {
14-
return gulpPurescript.pscDocs(options)();
13+
function docs(options) {
14+
return gulpPurescript.docs(options)();
1515
}
1616

1717
function psci(options) {
1818
return gulpPurescript.psci(options)();
1919
}
2020

21-
module.exports.psc = psc;
21+
module.exports.compile = compile;
2222

23-
module.exports.pscBundle = pscBundle;
23+
module.exports.bundle = bundle;
2424

25-
module.exports.pscDocs = pscDocs;
25+
module.exports.docs = docs;
2626

2727
module.exports.psci = psci;

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
"output"
1818
],
1919
"scripts": {
20-
"psc": "purs compile 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
21-
"test": "npm run psc && (node test/test.js | tap-spec)",
22-
"prepublish": "rimraf output && npm run psc"
20+
"build": "purs compile 'src/**/*.purs' 'bower_components/purescript-*/src/**/*.purs'",
21+
"test": "npm run build && (node test/test.js | tap-spec)",
22+
"prepublish": "rimraf output && npm run build"
2323
},
2424
"keywords": [
2525
"gulpplugin",

src/GulpPurescript/Options.purs

Lines changed: 36 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
module GulpPurescript.Options
22
( Psci(..)
3-
, pscOptions
4-
, pscBundleOptions
5-
, pscDocsOptions
3+
, compileOptions
4+
, bundleOptions
5+
, docsOptions
66
, readPsci
77
) where
88

@@ -106,8 +106,8 @@ docgenOpt = "docgen"
106106
docgenKey :: String
107107
docgenKey = docgenOpt
108108

109-
newtype Psc
110-
= Psc { src :: Either String (Array String)
109+
newtype Compile
110+
= Compile { src :: Either String (Array String)
111111
, output :: Maybe String
112112
, verboseErrors :: Maybe Boolean
113113
, comments :: Maybe Boolean
@@ -117,17 +117,17 @@ newtype Psc
117117
, jsonErrors :: Maybe Boolean
118118
}
119119

120-
newtype PscBundle
121-
= PscBundle { src :: Either String (Array String)
120+
newtype Bundle
121+
= Bundle { src :: Either String (Array String)
122122
, output :: Maybe String
123123
, "module" :: Maybe (Either String (Array String))
124124
, main :: Maybe (Either Boolean String)
125125
, namespace :: Maybe String
126126
, sourceMaps :: Maybe Boolean
127127
}
128128

129-
newtype PscDocs
130-
= PscDocs { src :: Either String (Array String)
129+
newtype Docs
130+
= Docs { src :: Either String (Array String)
131131
, format :: Maybe Format
132132
, docgen :: Maybe Docgen
133133
}
@@ -141,8 +141,8 @@ newtype PathArray = PathArray (Array String)
141141

142142
data Format = Markdown | ETags | CTags
143143

144-
readPsc :: Foreign -> F Psc
145-
readPsc obj = do
144+
readCompile :: Foreign -> F Compile
145+
readCompile obj = do
146146
src <- readSources =<< readProp srcKey obj
147147
output <- readPropNU readString outputKey obj
148148
verboseErrors <- readPropNU readBoolean verboseErrorsKey obj
@@ -151,24 +151,24 @@ readPsc obj = do
151151
dumpCoreFn <- readPropNU readBoolean dumpCoreFnKey obj
152152
noPrefix <- readPropNU readBoolean noPrefixKey obj
153153
jsonErrors <- readPropNU readBoolean jsonErrorsKey obj
154-
pure $ Psc { src, output, verboseErrors, comments, sourceMaps, dumpCoreFn, noPrefix, jsonErrors }
154+
pure $ Compile { src, output, verboseErrors, comments, sourceMaps, dumpCoreFn, noPrefix, jsonErrors }
155155

156-
readPscBundle :: Foreign -> F PscBundle
157-
readPscBundle obj = do
156+
readBundle :: Foreign -> F Bundle
157+
readBundle obj = do
158158
src <- readSources =<< readProp srcKey obj
159159
output <- readPropNU readString outputKey obj
160160
mod <- readPropNU readSources moduleKey obj
161161
main <- readPropNU (readEither readBoolean readString) mainKey obj
162162
namespace <- readPropNU readString namespaceKey obj
163163
sourceMaps <- readPropNU readBoolean sourceMapsKey obj
164-
pure $ PscBundle { src, output, "module": mod, main, namespace, sourceMaps }
164+
pure $ Bundle { src, output, "module": mod, main, namespace, sourceMaps }
165165

166-
readPscDocs :: Foreign -> F PscDocs
167-
readPscDocs obj = do
166+
readDocs :: Foreign -> F Docs
167+
readDocs obj = do
168168
src <- readSources =<< readProp srcKey obj
169169
format <- readPropNU readFormat formatKey obj
170170
docgen <- readPropNU readDocgen docgenOpt obj
171-
pure $ PscDocs { src, format, docgen }
171+
pure $ Docs { src, format, docgen }
172172

173173
readPsci :: Foreign -> F Psci
174174
readPsci obj = Psci <$> { src: _ } <$> (readSources =<< readProp srcKey obj)
@@ -232,14 +232,14 @@ parseDocgen (Docgen obj) =
232232
modules <- keys obj'
233233
for modules \m -> (\f -> m <> ":" <> f) <$> (readString =<< readProp m obj')
234234

235-
pscOptions :: Foreign -> F (Array String)
236-
pscOptions opts = fold <$> parsed
235+
compileOptions :: Foreign -> F (Array String)
236+
compileOptions opts = fold <$> parsed
237237
where
238-
parsed :: F Psc
239-
parsed = readPsc opts
238+
parsed :: F Compile
239+
parsed = readCompile opts
240240

241-
fold :: Psc -> Array String
242-
fold (Psc a) = either pure id a.src <>
241+
fold :: Compile -> Array String
242+
fold (Compile a) = either pure id a.src <>
243243
opt outputOpt a.output <>
244244
opt verboseErrorsOpt a.verboseErrors <>
245245
opt commentsOpt a.comments <>
@@ -248,37 +248,34 @@ pscOptions opts = fold <$> parsed
248248
opt noPrefixOpt a.noPrefix <>
249249
opt jsonErrorsOpt a.jsonErrors
250250

251-
pscBundleOptions :: Foreign -> F (Array String)
252-
pscBundleOptions opts = fold <$> parsed
251+
bundleOptions :: Foreign -> F (Array String)
252+
bundleOptions opts = fold <$> parsed
253253
where
254-
parsed :: F PscBundle
255-
parsed = readPscBundle opts
254+
parsed :: F Bundle
255+
parsed = readBundle opts
256256

257-
fold :: PscBundle -> Array String
258-
fold (PscBundle a) = either pure id a.src <>
257+
fold :: Bundle -> Array String
258+
fold (Bundle a) = either pure id a.src <>
259259
opt outputOpt a.output <>
260260
opt moduleOpt a."module" <>
261261
opt mainOpt a.main <>
262262
opt namespaceOpt a.namespace <>
263263
opt sourceMapsOpt a.sourceMaps
264264

265-
pscDocsOptions :: Foreign -> F (Array String)
266-
pscDocsOptions opts = fold <$> parsed
265+
docsOptions :: Foreign -> F (Array String)
266+
docsOptions opts = fold <$> parsed
267267
where
268-
parsed :: F PscDocs
269-
parsed = readPscDocs opts
268+
parsed :: F Docs
269+
parsed = readDocs opts
270270

271-
fold :: PscDocs -> Array String
272-
fold (PscDocs a) = either pure id a.src <>
271+
fold :: Docs -> Array String
272+
fold (Docs a) = either pure id a.src <>
273273
opt formatOpt a.format <>
274274
opt docgenOpt a.docgen
275275

276276
readEither :: forall left right. (Foreign -> F left) -> (Foreign -> F right) -> Foreign -> F (Either left right)
277277
readEither readL readR a = (Left <$> readL a) <|> (Right <$> readR a)
278278

279-
readEitherNU :: forall left right. (Foreign -> F left) -> (Foreign -> F right) -> Foreign -> F (Maybe (Either left right))
280-
readEitherNU readL readR = traverse (readEither readL readR) <=< readNullOrUndefined
281-
282279
readPropNU :: forall a. (Foreign -> F a) -> String -> Foreign -> F (Maybe a)
283280
readPropNU f k = traverse f <=< readNullOrUndefined <=< readProp k
284281

src/GulpPurescript/Plugin.purs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ module GulpPurescript.Plugin
22
( Effects
33
, Errorback
44
, Callback
5-
, psc
6-
, pscBundle
7-
, pscDocs
5+
, compile
6+
, bundle
7+
, docs
88
, psci
99
) where
1010

@@ -31,7 +31,7 @@ import GulpPurescript.ChildProcess (ChildProcess, spawn)
3131
import GulpPurescript.Glob (Glob, globAll)
3232
import GulpPurescript.GulpUtil (File, mkFile, mkPluginError)
3333
import GulpPurescript.Logalot (Logalot, info)
34-
import GulpPurescript.Options (Psci(..), pscOptions, pscBundleOptions, pscDocsOptions, readPsci)
34+
import GulpPurescript.Options (Psci(..), compileOptions, bundleOptions, docsOptions, readPsci)
3535
import GulpPurescript.OS (OS, Platform(Win32), platform)
3636
import GulpPurescript.Path (relative)
3737
import GulpPurescript.ResolveBin (ResolveBin, resolveBin)
@@ -117,24 +117,24 @@ execute cmd args = do
117117
result <- spawn cmd' args'
118118
pure result
119119

120-
psc :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream Unit)
121-
psc opts = mkReadableStreamFromAff $ do
120+
compile :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream Unit)
121+
compile opts = mkReadableStreamFromAff $ do
122122
output <- handleRead
123123
(execute compileCommand <<< (_ <> rtsOpts))
124-
(pscOptions opts)
124+
(compileOptions opts)
125125
if null output
126126
then pure unit
127127
else liftEff $ info $ compileCommand <> "\n" <> output
128128

129-
pscBundle :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream File)
130-
pscBundle opts = mkReadableStreamFromAff (handleRead run (pscBundleOptions opts))
129+
bundle :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream File)
130+
bundle opts = mkReadableStreamFromAff (handleRead run (bundleOptions opts))
131131
where
132132
run :: Array String -> Aff (Effects eff) File
133133
run args = mkFile "." <$> mkBufferFromString
134134
<$> execute bundleCommand args
135135

136-
pscDocs :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream File)
137-
pscDocs opts = mkReadableStreamFromAff (handleRead run (pscDocsOptions opts))
136+
docs :: forall eff. Foreign -> Eff (Effects eff) (ReadableStream File)
137+
docs opts = mkReadableStreamFromAff (handleRead run (docsOptions opts))
138138
where
139139
run :: Array String -> Aff (Effects eff) File
140140
run args = mkFile "." <$> mkBufferFromString

0 commit comments

Comments
 (0)