Skip to content

Commit 4fc6f4e

Browse files
authored
update docs (#159)
1 parent 575ba86 commit 4fc6f4e

File tree

5 files changed

+73
-30
lines changed

5 files changed

+73
-30
lines changed

docs/faq.md

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,13 @@
11
# FAQ
22

3-
## Is there an easier way to manage my package sets than to edit packages.json?
3+
## Is there an easier way to manage my package sets than to edit packages.json? / How do I prepare a packages.json in some way other than editing JSON?
44

5-
Yes. For example, the [Spacchetti](https://github.com/justinwoo/spacchetti/) project uses Dhall to allow for easily maintaining a fork with separate type-checked sub-sets of packages and to allow for users to have local overrides of package sets.
5+
Yes. [purescript/package-sets](https://github.com/purescript/package-sets) itself uses Dhall to programmatically prepare the package set, which are then normalized into `packages.dhall` on release: <https://github.com/purescript/package-sets/releases>. You can import this file in your own Dhall files and add/override packages to customize your package set.
66

77
## How come I can't install (some package) from the package set?
88

99
You should make sure you're using the correct [package-set release](https://github.com/purescript/package-sets/releases) and have updated the value of "set" in your `psc-package.json` file. See [The `psc-package.json` format](https://github.com/purescript/psc-package#the-psc-packagejson-format) section for more details.
1010

11-
## Can I add a dependency which is not in the package set?
12-
13-
Not right now. We might add this feature in future, but for now, consider either:
14-
15-
- Adding your dependency to the package set if possible, or
16-
- Creating your own custom package set
17-
18-
There used to be a feature called "add-from-bower", which could modify a package set from [purescript/package-sets](https://github.com/purescript/package-sets/). This feature was removed as it proved to be very buggy and confusing for users, who thought that this feature would let them install arbitrary bower dependencies. See <https://github.com/purescript/psc-package/issues/121>.
19-
20-
## Why is Add-From-Bower gone?
21-
22-
The feature named "add-from-bower" never did what users expected it to do: to install packages to a project from Bower.
23-
24-
Instead, what this feature did was to add packages to a package set from [purescript/package-sets](https://github.com/purescript/package-sets/). However, due to the buggy nature of the feature, it was agreed that the feature should be removed and left up to other tools to handle. See <https://github.com/purescript/psc-package/issues/121>, where the top post describes how the [Spacchetti](https://github.com/spacchetti/spacchetti) package set adds Bower dependencies to the package set.
25-
26-
If you really would like to mix Psc-Package and Bower dependencies, you have two "real" options today. However, these will break if your packages are not all compatible, because this defeats the guarantees of having a package set.
27-
28-
1. Install the Bower dependencies anyway, and then only source the globs for individual dependencies, so you do not have conflicting definitions of other common modules. You can do this by supplying pass-through arguments: `psc-package build -- 'bower_componenents/purescript-my-lib/src/**/*.purs'`
29-
2. Use the "Bower style" installation of Psc-Package2Nix: <https://github.com/justinwoo/psc-package2nix/tree/master/test-bower-style>. This will require that you use a system that can use the [Nix](https://nixos.org/nix/) package manager. See the link for more details.
30-
3111
## Why are my changes not updated in my package set?
3212

3313
Package sets are cached based on a git reference (e.g. tag or branch)
@@ -42,4 +22,4 @@ $ psc-package install
4222

4323
## Can I use Psc-Package with Nix?
4424

45-
Yes, now there is a solution for using Psc-Package with Nix: <https://github.com/justinwoo/psc-package2nix>. Please file issues in that project if you run into any.
25+
Yes, please see the page about Nix here: <https://psc-package.readthedocs.io/en/latest/nix.html>.

docs/installation.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ env:
5050
- PATH=$HOME/purescript:$HOME/psc-package:$PATH
5151

5252
install:
53-
- TAG=v0.12.0
54-
- PSC_PACKAGE_TAG=v0.4.1
53+
- TAG=v0.13.6
54+
- PSC_PACKAGE_TAG=v0.6.0
5555
- wget -O $HOME/purescript.tar.gz https://github.com/purescript/purescript/releases/download/$TAG/linux64.tar.gz
5656
- tar -xvf $HOME/purescript.tar.gz -C $HOME/
5757
- chmod a+x $HOME/purescript

docs/intro.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,13 @@ A _package set_ is a mapping from package names to:
1010

1111
A package set repository contains a `packages.json` file which contains all mapping information. `psc-package` uses this information to decide which repos need to be cloned.
1212

13-
The default package set is [purescript/package-sets](https://github.com/purescript/package-sets), but it is possible to create custom package sets by forking an existing package set or creating a new one from scratch. One benefit of using the default package set is that it is verified by a continuous integration process.
13+
The default package set is [purescript/package-sets](https://github.com/purescript/package-sets), but it is possible to create custom package sets in many ways:
14+
15+
* by preparing a package set with Dhall using the packages.dhall from releases: <https://github.com/purescript/package-sets/releases>
16+
* forking `purescript/package-sets` to your own repository
17+
* creating a new one from scratch
18+
19+
. One benefit of using the default package set is that it is verified by a continuous integration process.
1420

1521
## The `psc-package.json` format
1622

@@ -19,7 +25,7 @@ Here is a simple project configuration:
1925
```json
2026
{
2127
"name": "my-project",
22-
"set": "psc-0.10.2",
28+
"set": "psc-0.13.6",
2329
"source": "https://github.com/purescript/package-sets.git",
2430
"depends": [
2531
"prelude"
@@ -30,6 +36,6 @@ Here is a simple project configuration:
3036
It defines:
3137

3238
- The project name
33-
- The package set to use to resolve dependencies (this corresponds to a branch or tag of the package set source repository)
34-
- The package set source repository Git URL (change this if you want to host your own package sets)
39+
- The package set to use to resolve dependencies. This corresponds to a branch or tag of the package set source repository if you use a Git URL as your source. Otherwise it serves as just an identifier.
40+
- The package set source, which is either a repository Git URL or a path to a package set `packages.json` file.
3541
- Any dependencies of the project, as a list of names of packages from the package set

docs/nix.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Usage with Nix
22

3-
## [justinwoo/psc-package2nix](https://github.com/justinwoo/psc-package2nix)
3+
## [justinwoo/psc-package2nix](https://github.com/justinwoo/psc-package2nix) (Older)
44

55
Justin Woo has made a psc-package2nix project for generating nix derivations from Psc-Package dependencies: <https://github.com/justinwoo/psc-package2nix>
6+
7+
## [justinwoo/soba](https://github.com/justinwoo/soba) (Newer)
8+
9+
Because of the relative rarity in using psc-package with Nix, there is not excessive documentation on how to use this tool. See mostly the `soba insdhall` and `soba nix` commands in this tool.

docs/usage.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,56 @@ The local package database can be queried using the following commands:
4040

4141
- `sources` - list source directories for active package versions. This can be useful when building a command for, say, running PSCi.
4242
- `dependencies` - list all transitive dependencies
43+
44+
## Local package sets
45+
46+
In `psc-package.json`, you can set `"source"` to be a path to a local file:
47+
48+
```json
49+
{
50+
"name": "name",
51+
"set": "local",
52+
"source": "packages.json",
53+
"depends": [
54+
"aff"
55+
]
56+
}
57+
```
58+
59+
From here, you can generate a local packages.json file in any way you please and use this package set directly. Consider if you use Dhall:
60+
61+
```dhall
62+
let upstream =
63+
https://github.com/purescript/package-sets/releases/download/psc-0.13.5-20200103/packages.dhall sha256:0a6051982fb4eedb72fbe5ca4282259719b7b9b525a4dda60367f98079132f30
64+
65+
in upstream
66+
{ calpis =
67+
{ dependencies = [ "prelude" ]
68+
, repo = "https://github.com/justinwoo/purescript-calpis.git"
69+
, version = "v0.1.0"
70+
}
71+
}
72+
```
73+
74+
This definition takes an existing release and adds the "calpis" package. Then we can generate a package set from this by running Dhall-JSON:
75+
76+
> dhall-to-json --file packages.dhall --output packages.json
77+
78+
Then we can install this package expected:
79+
80+
```bash
81+
$ psc-package install calpis
82+
Installing calpis
83+
psc-package.json file was updated
84+
85+
$ cat psc-package.json
86+
{
87+
"name": "name",
88+
"set": "local",
89+
"source": "packages.json",
90+
"depends": [
91+
"aff",
92+
"calpis"
93+
]
94+
}
95+
```

0 commit comments

Comments
 (0)