purs
Spawn a new process using PureScript CLI
const readFile = promises;const purs = ; async { await purs; await ; //=> '// Generated by purs ...'};
Installation
npm install purs
Since this package contains purescript
npm package in its dependency list and uses it when spawning a new process, there is no need to install PureScript separately.
API
const purs = ;
purs.help([options]), purs.version([options])
options: Object
(execa
options)
Return: Promise<string>
Spawn a new purs --help
or purs --version
process and return a Promise
of the command stdout as a string.
async { await purs; //=> 'Usage: purs.bin COMMAND\n The PureScript compiler ...'};
purs.bundle([args][, options]), purs.compile([args][, options]), purs.docs([args][, options]), purs.hierarchy([args][, options]), purs.ide([args][, options]), purs.publish([args][, options])
args: Array<string>
(additional command-line arguments)
options: Object
(execa
options)
Return: ChildProcess
with additional execa
-specific enhancement
Spawn a new process with a purs
subcommand corresponding to the method name and return a execa
return value:
a
child_process
instance, which is enhanced to also be aPromise
for a resultObject
withstdout
andstderr
properties.
async { const result = await purs; /*=> { stdout: '', stderr: '', code: 0, failed: false, killed: false, signal: null, cmd: '/Users/example/node_modules/purescript/purs.bin bundle index.js --output app.js', timedOut: false } */};
License
ISC License © 2018 Shinnosuke Watanabe