Package Exports
- install-purescript
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (install-purescript) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
install-purescript
Install PureScript to a given directory
const {readdirSync} = require('fs');
const {execFile} = require('child_process');
const downloadOrBuildPurescript = require('install-purescript');
downloadOrBuildPurescript('./dest', {version: '0.11.5'}).subscribe({
start() {
console.log('Installing PureScript...');
},
complete() {
execFile('./dest/purs', ['--version'], (err, stdout) => {
stdout.toString(); //=> '0.11.5\n'
console.log('PureScript has been successfully installed.');
});
}
});
Installation
npm install install-purescript
API
const installPurescript = require('install-purescript');
installPurescript(dir [, options])
path: String
(directory path)
options: Object
Return: Observable
()
head ────────────×─┬─ check-stack ─────×─┐
│ │ │ │
○ │ ○ │
│ │ │ │
download-binary ─×─┤ download-source ─×─┤
│ │ │ │
○ │ ○ │
│ │ │ │
check-binary ────×─┘ setup ───────────×─┤
│ │ │
│ ○ │
│ │ │
│ build ───────────×─│
│ │ │
○ ○ │
│ │ │
╔════════════╗ ╔═════════════╗ ╔════════╗
║ Downloaded ║ ║ Built ║ ║ Failed ║
║ a prebuilt ║ ║ a binary ║ ╚════════╝
║ binary ║ ║ from source ║
╚════════════╝ ╚═════════════╝
Similar to Node.js built-in fs.readdir
, but different in the following points:
- Returns a
Promise
- Doesn't support
encoding
option - The result is sorted based on
String#localeCompare()
Options
locale
property will be passed to the second argument of String#localeCompare()
, and the rest will be used in the third argument.
readdirSorted('/path/to/dir').then(paths => {
paths; /* => ['10', '2', 'ä', 'z'] */
});
readdirSorted('/path/to/dir', {
locale: 'sv',
numeric: true
}).then(paths => {
paths; /* => ['2', '10', 'z', 'ä'] */
});
License
Copyright (c) 2017 Shinnosuke Watanabe
Licensed under the MIT License.