Package Exports
- download-purescript-source
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 (download-purescript-source) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
download-purescript-source
A Node.js module to download PureScript source from GitHub
const {readdir} = require('fs').promises;
const downloadPurescript = require('download-purescript-source');
downloadPurescript('./dest/').subscribe({
async complete() {
await readdir('./dest/'); /*=> [
'LICENSE',
'Makefile',
'Setup.hs',
'app',
'bundle',
'core-tests',
'license-generator',
'package.yaml',
'src',
'stack.yaml',
'tests'
] */
}
});
Installation
npm install download-purescript-source
API
const downloadPurescriptSource = require('download-purescript-source');
downloadPurescriptSource(dir [, options])
dir: string
(a directory path where the PureScript source will be downloaded)
options: Object
Return: Observable
(Kevin Smith's implementation)
When the Observable
is subscribed, it starts to download a tar.gz
archive from the PureScript GitHub repository, extract it and successively send dl-tar's progress
objects to its Observer
.
downloadPurescriptSource('my/dir')
.filter(({entry}) => entry.remain === 0)
.forEach(({entry}) => console.log(`✓ ${entry.header.path.replace(/^[^/]*\//, '')}`))
.then(() => console.log('\nCompleted.'));
✓ LICENSE
✓ Makefile
✓ Setup.hs
✓ app/
✓ app/Command/
✓ app/Command/Bundle.hs
✓ app/Command/Compile.hs
✓ app/Command/Docs.hs
✓ app/Command/Docs/
✓ app/Command/Docs/Html.hs
︙
✓ tests/support/pscide/src/RebuildSpecWithDeps.purs
✓ tests/support/pscide/src/RebuildSpecWithForeign.js
✓ tests/support/pscide/src/RebuildSpecWithForeign.purs
✓ tests/support/pscide/src/RebuildSpecWithHiddenIdent.purs
✓ tests/support/pscide/src/RebuildSpecWithMissingForeign.fail
✓ tests/support/setup-win.cmd
Completed.
Options
You can pass options to Request and node-tar's Unpack
constructor. Note that:
strip
option defaults to1
and can't be changed. That means the top level directory is always stripped off.- By default it won't download any
*{md,yml}
files, some specific files and directories that are unnecessary for building the binary. Pass() => true
to thefilter
option if you want to download all files included in the archive. onentry
option is not supported.
Additionally, you can use the following:
revision
Type: string
Default: v0.12.5
Specify the commit hash, tag or branch name you want to download.
License
ISC License © 2017 - 2019 Shinnosuke Watanabe