0.3.0 • Published 6 years ago

purs v0.3.0

Weekly downloads
6
License
ISC
Repository
github
Last release
6 years ago

purs

npm version Build Status Coverage Status

Spawn a new process using PureScript CLI

const {readFile} = require('purs').promises;
const purs = require('purs');

(async () => {
  await purs.compile(['source.purs', '--output', 'out']);
  await readFile('out/Main/index.js', 'utf8'); //=> '// Generated by purs ...'
})();

Installation

Use npm.

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 = require('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.help(); //=> 'Usage: purs.bin COMMAND\n  The PureScript compiler ...'
})();

purs.bundle(args), purs.compile(args), purs.docs(args), purs.hierarchy(args), purs.ide(args), purs.publish(args)

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 a Promise for a result Object with stdout and stderr properties.

(async () => {
  const result = await purs.bundle(['index.js', '--output', 'app.js']);
  /*=> {
    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

0.3.0

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.9

6 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago

0.0.0

7 years ago