This is a simple template to play with websockets, IPC (libipc) communications and Halogen. Nothing serious.
 
 
 
 
Go to file
Philippe Pittoli 796cd3ea55 Store the AuthenticationDaemonAdminInterface state, too. 2023-07-09 02:40:10 +02:00
.github/workflows Update CI and packages for PureScript 0.14 2021-03-09 12:08:57 -08:00
app Add bulma, remove 'npm serve' (let's go darhttpd!). 2023-06-08 16:31:51 +02:00
dev Update index.html 2022-10-31 12:17:09 -03:00
drop Add an example of Websockets with ArrayBuffer. 2023-05-20 13:50:11 +02:00
src Store the AuthenticationDaemonAdminInterface state, too. 2023-07-09 02:40:10 +02:00
test Update template for Halogen 5 and Spago (#23) 2020-05-10 10:32:46 -04:00
.gitignore Commit: ignore app/index.js 2023-06-08 21:51:58 +02:00
LICENSE
README.md Convert to Parcel (#26) 2020-06-29 18:32:28 -07:00
makefile Generate and serve documentation. 2023-07-08 15:52:08 +02:00
package.json NPM: bulma and esbuild. 2023-06-08 16:10:23 +02:00
packages.dhall Project now compiles. 2023-05-19 23:50:24 +02:00
spago.dhall Add a "." between the subdomain and domain names, only when needed. 2023-07-02 23:50:19 +02:00

README.md

Halogen Template

Quick Start

git clone https://github.com/purescript-halogen/purescript-halogen-template.git halogen-project
cd halogen-project
npm install
npm run build
npm run serve

Introduction

This is a template for starting a fresh project with the Halogen library for writing declarative, type-safe user interfaces.

You can learn more about Halogen with these resources:

You can chat with other Halogen users on the PureScript Discourse, or join the Functional Programming Slack (invite link) in the #purescript and #purescript-beginners channels.

If you notice any problems with the below setup instructions, or have suggestions on how to make the new-user experience any smoother, please create an issue or pull-request.

Compatible with PureScript compiler 13.x

Initial Setup

Prerequisites: This template assumes you already have Git and Node.js installed with npm somewhere on your path.

First, clone the repository and step into it:

git clone https://github.com/purescript-halogen/purescript-halogen-template.git halogen-project
cd halogen-project

Then, install the PureScript compiler, the Spago package manager and build tool, and the Parcel bundler. You may either install PureScript tooling globally, to reduce duplicated node_modules across projects, or locally, so that each project uses specific versions of the tools.

To install the toolchain globally:

npm install -g purescript spago parcel

To install the toolchain locally (reads devDependencies from package.json):

npm install

Building

You can now build the PureScript source code with:

# An alias for `spago build`
npm run build

Launching the App

You can launch your app in the browser with:

# An alias for `parcel dev/index.html --out-dir dev-dist --open`
npm run serve

Development Cycle

If you're using an editor that supports purs ide or are running pscid, you simply need to keep the previous npm run serve command running in a terminal. Any save to a file will trigger an incremental recompilation, rebundle, and web page refresh, so you can immediately see your changes.

If your workflow does not support automatic recompilation, then you will need to manually re-run npm run build. Even with automatic recompilation, a manual rebuild is occasionally required, such as when you add, remove, or modify module names, or notice any other unexpected behavior.

Production

When you are ready to create a minified bundle for deployment, run the following command:

npm run build-prod

Parcel output appears in the ./dist/ directory.

You can test the production output locally with a tool like http-server. It seems that parcel should also be able to accomplish this, but it unfortunately will only serve development builds locally.

npm install -g http-server
http-server dist -o

If everything looks good, you can then upload the contents of dist to your preferred static hosting service.