git.iko.soy/rowtype-yoga/purescm
on bytevector help sign in
Update package.json and README (#159)

* Add config so that we can publish the npm package * Update README * Fix build script

commit3ab384d5f8b688c4ca9da63941405fae1797f179 authorAntti Holvikari <antti@anttih.com> dateSun 24 Sep 2023, 09:12 (3 years ago) parentfb2ffca
3 files changed+42−9
README.md+21−5 package-lock.json+12 package.json+9−4
README.md+21−5
@@ -1,17 +1,33 @@
1−# purs-backend-chez
1+# purescm - Chez Scheme backend for PureScript
2+
3+## Installation
4+
5+```
6+npm i --global purescm@next
7+```
28
39## Usage
410
5−To compile PureScript corefn files to scheme:
11+The best way to use `purescm` is to use the [spago](https://github.com/purescript/spago) integration for alternative PureScript backends. In `spago.yaml` use the `backend` config like so:
12+
13+```
14+workspace:
15+ backend:
16+ cmd: purescm
17+ args:
18+ - "build"
19+```
20+
21+Then to compile your `purescm` project you can run:
622
723```
8−purs-backend-chez build
24+spago build
925```
1026
1127This will produce output under `output/`. You can then further precompile the scheme files to a single Chez program:
1228
1329```
14−purs-backend-chez bundle-app --main Main
30+purescm bundle-app --main Main
1531```
1632
1733which generates a single file `output/main`. To run the compiled program:
@@ -52,4 +68,4 @@ Copyright 1984-2022 Cisco Systems, Inc.
5268To run snapshots, run `npm run test`.
5369To overwrite old snapshots with the latest output, run `npm run test -- -a "--accept"`.
5470To add a new snapshot, create a file called `Snapshot.X.purs` where `X` indicates what is being tested.
55−If a snapshot needs a dependency, install it by running `spago -x test-snapshots/spago.dhall install <packages...>`. The snapshots have their own `spago.dhall` file so as not to pollute the `purs-backend-chez` binary with unneeded dependencies.
71+If a snapshot needs a dependency, install it by running `spago -x test-snapshots/spago.dhall install <packages...>`. The snapshots have their own `spago.dhall` file so as not to pollute the `purescm` binary with unneeded dependencies.
package-lock.jsonnew file+12
@@ -0,0 +1,12 @@
1+{
2+ "name": "purescm",
3+ "lockfileVersion": 3,
4+ "requires": true,
5+ "packages": {
6+ "": {
7+ "bin": {
8+ "purs-backend-chez": "index.js"
9+ }
10+ }
11+ }
12+}
package.json+9−4
@@ -1,12 +1,17 @@
11{
2− "private": true,
2+ "name": "purescm",
3+ "version": "1.0.0",
34 "main": "index.js",
45 "type": "module",
6+ "files": [
7+ "vendor/**/*.sls",
8+ "bundle/index.js"
9+ ],
510 "bin": {
6− "purs-backend-chez": "./index.js"
11+ "purescm": "./index.js"
712 },
813 "scripts": {
9− "test": "spago -x test.dhall test",
10− "build": "spago build --purs-args '-g corefn,js' && purs-backend-es bundle-module -m Main --int-tags --platform=node --minify --to=./bundle/index.js"
14+ "test": "spago test",
15+ "build": "spago build && purs-backend-es bundle-module -m Main --int-tags --platform=node --minify --to=./bundle/index.js"
1116 }
1217}