Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
build-purescript
Advanced tools
Readme
A Node.js module to build a PureScript binary from source
const {execFile} = require('child_process');
const buildPurescript = require('build-purescript');
buildPurescript().subscribe({
complete() {
console.log('Build completed.');
execFile('./purs', ['--help'], (err, stdout) => {
stdout.toString(); //=> 'Usage: purs COMMAND\n The PureScript compiler and tools ...'
});
}
});
Make sure stack
command is installed in your $PATH
, then install build-purescript
via npm CLI.
npm install build-purescript
const buildPurescript = require('build-purescript');
options: Object
Return: Observable
(Kevin Smith's implementation)
When the Observable
is subscribed, it starts to download PureScript source from the GitHub repository, build it and put a built binary onto the current working directory, successively sending event objects to its Observer
.
Each event object has id
property with one of these values:
download
Sent to the Observer
while downloading and extracting the PureScript source archive to the default temporary directory of the current OS.
entry
and response
properties are derived from dl-tar
.
{
id: 'download',
entry: <ReadEntry>,
response: {
bytes: <number>,
headers: <Object>,
url: <string>
}
}
download:complete
Sent to the Observer
when the PureScript source is completely downloaded.
{
id: 'download:complete'
}
setup
Sent to the Observer
while running stack setup
command.
command
property is the command currently running, and output
property is each line of stderr.
{
id: 'setup',
command 'stack setup ...',
output: <string>
}
setup:complete
Sent to the Observer
when stack setup
command exits with code 0
.
{
id: 'setup:complete'
}
build
Sent to the Observer
while running stack install
command.
command
property is the command currently running, and output
property is each line of stderr.
{
id: 'build',
command 'stack install ...',
output: <string>
}
build:complete
Sent to the Observer
when stack install
command exits with code 0
.
{
id: 'build:complete'
}
(async () => {
await downloadPurescript().filter(({id}) => id.endsWith(':complete')).forEach(({id}) => {
console.log(`✓ ${id.replace(':complete', '')}`);
});
console.log('\nCompleted.');
})();
✓ download
✓ setup
✓ build
Completed.
Each error passed to the Observer
have id
property that indicates which step the error occurred at.
// When your machine have no network connection
buildPureScript().subscribe({
error(err) {
err.message; //=> 'getaddrinfo ENOTFOUND github.com github.com:443'
err.id; //=> 'download'
}
});
// When the `stack` command is not installed
buildPureScript().subscribe({
error(err) {
err.message; //=> '`stack` command is not found in your PATH ...'
err.id; //=> 'setup'
}
});
Options are directly passed to the underlying donwload-purescript-source
and spawn-stack
. Also you can use the following:
Type: Array<string>
Additional command-line arguments passed to stack setup
and stack install
. Note:
--local-bin-path
is automatically set to the first argument of buildPurescript
.--fast
and --pedantic
, won't be passed to stack setup
.ISC License © 2017 - 2019 Shinnosuke Watanabe
FAQs
Build a PureScript binary from source
The npm package build-purescript receives a total of 46 weekly downloads. As such, build-purescript popularity was classified as not popular.
We found that build-purescript demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.