Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
npm run build
npm run test
npm run build:production
npm run bundle
npm run bundle:production

- name: Check SharedConfig.purs versions
run: |
Expand All @@ -81,7 +81,7 @@ jobs:
node updateSharedConfigVersions.mjs sharedConfig.out
diff src/Try/SharedConfig.purs sharedConfig.out || {
echo 'PureScript and/or package set versions in "client/src/Try/SharedConfig.purs"'
echo 'do not match the versions extracted from "stack.yaml" and "staging/packages.dhall".'
echo 'do not match the versions extracted from "stack.yaml" and "staging/spago.yaml".'
echo 'Please run "cd client && npm run updateConfigVersions". CI will fail until then.'
exit 1
}
Expand Down
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ New features:
Bugfixes:

Other improvements:
- Bump PureScript to `0.15.15` (#316 by @pete-murphy)
- Bump Spago to `1.0.4` (#316 by @pete-murphy)
- Update to latest package set (#316 by @pete-murphy)

## [v2023-12-22.1](https://github.com/purescript/trypurescript/releases/tag/v2023-12-22.1)

Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Most of these features can be controlled not only from the toolbar, but also usi

### Which Libraries Are Available?

Try PureScript aims to provide a complete, recent package set from <https://github.com/purescript/package-sets>. The available libraries are those listed in [`staging/spago.dhall`](./staging/spago.dhall), at the versions in the package set mentioned in [`staging/packages.dhall`](./staging/packages.dhall).
Try PureScript aims to provide a complete, recent package set from <https://github.com/purescript/registry/tree/main/package-sets>. The available libraries are those listed under `package.dependencies` in [`staging/spago.yaml`](./staging/spago.yaml), at the versions in the package set named by `workspace.packageSet.registry` in that same file.

## Development

Expand Down Expand Up @@ -109,13 +109,12 @@ npm run serve:(dev|production)

### 4. Choosing a Tag

The built-in examples for Try PureScript are loaded from this GitHub repository. To change the tag that the examples are loaded from, you'll need to touch three files:
The built-in examples for Try PureScript are loaded from this GitHub repository. To change the tag that the examples are loaded from, you'll need to touch two files:

* `client/config/dev/Try.Config.purs`
* `client/config/prod/Try.Config.purs`
* `client/src/Try/Config.js`
* `client/examples/Main.purs`, in the `fromExample` function.

If you are preparing a release or if you need to adjust examples in development, you should change the tag in these three places (and ensure you're using the same tag in each place!).
If you are preparing a release or if you need to adjust examples in development, you should change the tag in these two places (and ensure you're using the same tag in each place!).

## Server API

Expand Down
56 changes: 33 additions & 23 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,17 @@ Update the package set by doing the following. Each step is explained below:

```sh
pushd staging
spago upgrade-set
cat > spago.dhall << EOF
{ name = "try-purescript-server"
, dependencies = [] : List Text
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
}
cat > spago.yaml << EOF
package:
name: try-purescript-server
dependencies: []
workspace:
packageSet:
registry: 0.0.1
extraPackages: {}
EOF
spago ls packages | cut -f 1 -d ' ' | xargs spago install
spago upgrade
spago install $(spago ls packages --json --quiet | jq -r 'to_entries[] | select(.value.type == "registry") | .key')
popd
pushd client
npm run updateConfigVersions
Expand All @@ -47,27 +49,35 @@ popd

### Step-by-Step Explanation

1. Update the `upstream` package set in `staging/packages.dhall`:
1. Overwrite `staging/spago.yaml` with a placeholder config: an empty
`dependencies` list and any valid registry package set as a seed (the exact
version doesn't matter — the next step overwrites it). Starting from a clean
file ensures packages dropped from the new set don't linger.

```
$ pushd staging && spago upgrade-set && popd
```
2. Upgrade to the latest package set:

2. Set the `dependencies` key in the `spago.dhall` file to be an empty list. This will require a type annotation of `List Text`:

```dhall
{ name = "try-purescript-server"
, dependencies = [] : List Text
, packages = ./packages.dhall
, sources = [ "src/**/*.purs" ]
}
```console
$ spago upgrade
```

3. For `staging/spago.dhall`, install all packages in the package set by running this command:
This rewrites `workspace.packageSet.registry` to the newest available set,
replacing the seed version. Each set's JSON at
<https://github.com/purescript/registry/tree/main/package-sets> records the
`compiler` version it targets, which should line up with the `purescript`
version in `stack.yaml` — pin the set explicitly in step 1 instead if the
latest set targets a compiler you don't want.

3. Install every package in the new set so they're all available in the
playground. This overwrites the empty `dependencies` list in
`staging/spago.yaml`, then downloads, compiles, and locks them — so there's
no separate `spago fetch`/`spago build` needed:

```console
$ spago install $(spago ls packages --json --quiet | jq -r 'to_entries[] | select(.value.type == "registry") | .key')
```
$ spago ls packages | cut -f 1 -d ' ' | xargs spago install
```

If a package fails to compile, remove it from `package.dependencies` in
`staging/spago.yaml` and run `spago install` again.

4. Update the `client/src/Try/SharedConfig.purs` file by running this command in `client`:

Expand Down
15 changes: 0 additions & 15 deletions client/config/dev/Try.Config.purs

This file was deleted.

15 changes: 0 additions & 15 deletions client/config/prod/Try.Config.purs

This file was deleted.

19 changes: 10 additions & 9 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@
"private": true,
"scripts": {
"clean": "rimraf output",
"test": "spago test --path config/dev/Try.Config.purs",
"build": "spago build --path config/dev/Try.Config.purs",
"build:dev": "spago bundle-app --path config/dev/Try.Config.purs --to client.js",
"build:production": "spago bundle-app --path config/prod/Try.Config.purs --purs-args '--censor-lib --strict' --to client.js",
"bundle": "esbuild --outfile=public/js/index.js --bundle --minify --platform=browser --format=iife --tree-shaking=true client.js",
"test": "spago test",
"build": "spago build",
"build:dev": "spago bundle --outfile client.js --force",
"build:production": "spago bundle --outfile client.js --force --strict",
"bundle:dev": "esbuild --define:__DEVELOPMENT__=true --outfile=public/js/index.js --bundle --minify --platform=browser --format=iife --tree-shaking=true client.js",
"bundle:production": "esbuild --define:__DEVELOPMENT__=false --outfile=public/js/index.js --bundle --minify --platform=browser --format=iife --tree-shaking=true client.js",
"serve": "http-server public/ -o / --cors=\"Access-Control-Allow-Origin: *\" -c-1",
"serve:dev": "npm run build:dev && npm run bundle && npm run serve",
"serve:production": "npm run build:production && npm run bundle && npm run serve",
"serve:dev": "npm run build:dev && npm run bundle:dev && npm run serve",
"serve:production": "npm run build:production && npm run bundle:production && npm run serve",
"updateConfigVersions": "node updateSharedConfigVersions.mjs src/Try/SharedConfig.purs"
},
"devDependencies": {
"esbuild": "^0.14.43",
"http-server": "^14.1.0",
"purescript": "^0.15.2",
"purescript": "^0.15.16",
"purescript-psa": "^0.8.2",
"rimraf": "^2.5.4",
"spago": "^0.20.9"
"spago": "^1.0.4"
},
"dependencies": {
"ace-builds": "^1.5.0",
Expand Down
5 changes: 0 additions & 5 deletions client/packages.dhall

This file was deleted.

45 changes: 0 additions & 45 deletions client/spago.dhall

This file was deleted.

Loading