First try to download a prebuilt PureScript binary, then build from a source if the prebuilt one is unavailable
const readdir = promise;const execFile = ;const downloadOrBuildPurescript = ;;
npm install download-or-build-purescript
const downloadOrBuildPurescript = ;
Observable is subscribed,
- it downloads a prebuilt PureScript binary from the PureScript release page
- if a prebuilt binary is not available, it downloads the PureScript source code and builds a binary form it
- it puts the binary at the current working directory
Each event object has
id property with one of these values:
head ------------ x -+- check-stack ----- x -+ | | | | o | o | | | | | download-binary - x -+ download-source - x -+ | | | | o | o | | | | | check-binary ---- x -+ setup ----------- x -+ | | | | o | | | | | build ----------- x -+ | | | o o | | | | ***************** ***************** ^^^^^^^ Downloaded a Built a binary Error prebuilt binary from the source ^^^^^^^ ***************** *****************
Fires when it starts to check if a prebuilt binary is provided for the current platform.
Fires when it cannot start downloading the binary, for example no prebuilt ones are provided for the current platform.
id: 'head:fail'error: <Error>
Fires when it confirms that a prebuilt binary is provided for the current platform.
Fires many times while downloading and extracting the prebuilt binary.
id: 'download-binary'entry: <ReadEntry>response:bytes: <number>headers: <Object>url: <string>
Fires when it fails to download the binary somehow.
id: 'download-binary:fail'error: <Error>
Fires when the prebuilt binary is successfully downloaded.
Fires when it starts to verify the downloaded prebuilt binary works correctly, by running
Fires when the downloaded binary doesn't work correctly.
id: 'check-binary:fail'error: <Error>
Fires when it verifies the downloaded binary works correctly.
path property is the absolute path of the
stack command, and
version property is its version.
id: 'check-stack'path: <string>version: <string>
Fires after making sure the
stack command is installed in your
Fires many times while downloading and extracting the PureScript source code.
id: 'download-source'entry: <ReadEntry>response:bytes: <number>headers: <Object>url: <string>
Fires when the source code is successfully downloaded.
Every error passed to the
id property that indicates which step the error occurred at.
// When the `stack` command is not installed;// When your machine lose the internet connection while downloading the source;
filteroption is not supported.
revisionoption is not supported. Use
Additionally, you can use the following:
v => v
Receives the original binary name (
purs on POSIX,
purs.exe on Windows) and modifies the binary name to its return value.
const extname = ;;
ISC License © 2017 - 2019 Shinnosuke Watanabe