Install PureScript to a given directory
cconst execFile = ;const installPurescript = ;;
npm install install-purescript
const installPurescript = ;
installPurescript(dir [, options])
Observable is subscribed,
- it searches the standard cache directory for an already cached PureScript binary, and restores the cache if available
- if a cached binary is not available, it downloads a prebuilt 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
- Cache the downloaded or built binary to the standard cache directory
Every event object has
id property with one of these values:
| search-cache -- x -+- head ------------ x -+- check-stack ----- x -+ | | | | | | o | o | o | | | | | | | restore-cache - x -+ download-binary - x -+ download-source - x -+ | | | | | | o | o | o | | | | | | | check-binary -- x -+ check-binary ---- x -+ setup ----------- x -+ | | | | o | o | | | | | | | build ----------- x -+ | | | | | o o | | | | | ******************* ***************** ***************** ^^^^^^^ Restored a Downloaded a Built a binary Error binary from cache prebuilt binary from the source ^^^^^^^ ******************* ***************** ***************** | | write-cache write-cache
Fires when it checks if a
tgz archive of the required PureScript binary exists in the cache directory.
id: 'search-cache'path: <string> // path to the .tgz filefound: <boolean> // whether a cache is found or notwarning: <string | null>
If the cache directory has too many contents,
warning property will become a message to recommend removing unused caches to free disk usage:
The cache directory ~/.cache/purescript has 6 contents, most of whom would be currently unused: * v0.11.1-darwin-x64.tgz * v0.11.2-darwin-x64.tgz * v0.11.3-darwin-x64.tgz * v0.11.4-darwin-x64.tgz ... and 2 more You can free disk usage by deleting obsolete caches or simply removing the cache directory itself.
Fires many times while extracting the a binary from the cached
header properties are derived from tar-to-file's progress object.
id: 'restore-cache'bytes: <number>header: <Object>
Fires when it fails to restore the binary from cache.
id: 'restore-cache:fail'error: <Error>
Fires when the cached binary is successfully restored.
Fires when it starts to verify the cached or downloaded binary works correctly, by running
Fires when the cached or downloaded binary doesn't work correctly.
id: 'check-binary:fail'error: <Error>
Fires when it verifies the cached or downloaded binary works correctly.
Fires many times while archiving a downloaded or built binary as a cache.
header properties are derived from file-to-tar's progress object.
id: 'write-cache'bytes: <number>header: <Object>
Fires when it fails to create the cache.
id: 'write-cache:fail'error: <Error>
Fires when the cache is successfully created.
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;
Unlike the current draft spec of
zen-observable allows an
Observable to send value to the
complete fallback and this library follows its behavior.
path property is a path of the installed binary.
cachePath property is a path of the created cache archive, or
null when no cache is created.
Options are directly passed to
Additionally, you can use the following:
A path of the directory which caches are restored from and written to. By default,
If this option is
false, install-purescript doesn't restore a cache whether or not it exists, and doesn't write a cache after installation.
Force reinstalling a binary even if an appropriate cache already exists. When
cacheDir option is
false, this option cannot be enabled.
- install-purescript-cli — CLI for this module
- download-or-build-purescript — Almost the same as this module, but has no cache feature
ISC License © 2017 - 2018 Shinnosuke Watanabe