Merge branch 'main' into add-tests
This commit is contained in:
commit
975751de50
1 changed files with 41 additions and 1 deletions
40
README.md
40
README.md
|
@ -14,6 +14,8 @@ $ cabal new-install sjw
|
|||
|
||||
## Using it
|
||||
|
||||
### Invocation
|
||||
|
||||
SJW is a sort of compiler that expects the path to a source directory as argument and will output (on `stdout` or at the path given with the usual `-o` option) a script containing all the code required by the `Main` module.
|
||||
|
||||
The `demo/` directory is a simple example of this mechanism (I even committed the output `main.js` by accident but it's actually useful because you can try and generate it locally and check that you get exactly the same result). Run the following from this directory (if you're not used to haskell projects handled with cabal, make sure you have `~/.cabal/bin` in your `$PATH` variable) :
|
||||
|
@ -23,3 +25,41 @@ $ sjw demo/src -o demo/main.js
|
|||
```
|
||||
|
||||
Ask `sjw --help` to read more about available options or to print the version of SJW you're using.
|
||||
|
||||
### Everyday usage
|
||||
|
||||
SJW is simple enough that you don't need special commands to list, install or uninstall packages. All those vital needs are achieved by the usual commands your shell provides : `ls`, `cp` or `rm`.
|
||||
|
||||
The default location for the package store is a directory called `.sjw` located directly in your home (as set in your variable `$HOME` or, if unset, the home directory for your user as recorded by the system). This can be overriden by setting the variable `$SJW_PACKAGE_DB` in your environment (for instance by defining it in your shell's profile).
|
||||
|
||||
A package is «installed» by creating a directory there.
|
||||
|
||||
```
|
||||
$ cp -R myPackage/src ~/.sjw/myPackage
|
||||
```
|
||||
|
||||
The module tree starts directly under this directory. So, if `myPackage` exposes three modules `Huey`, `Dewey` and `Louie` :
|
||||
|
||||
```
|
||||
$ ls myPackage/src
|
||||
Huey.js Dewey.js Louie.js
|
||||
```
|
||||
|
||||
Then, after the previous `cp` command, you can use in your code
|
||||
|
||||
```
|
||||
import Huey;
|
||||
import Dewey;
|
||||
import Louie;
|
||||
```
|
||||
|
||||
and compile it with `sjw -I myPackage`. That's it. So, of course you can list all installed packages with :
|
||||
|
||||
```
|
||||
$ ls ~/.sjw
|
||||
```
|
||||
And remove any package with :
|
||||
|
||||
```
|
||||
$ rm -r ~/.sjw/myPackage
|
||||
```
|
||||
|
|
Loading…
Reference in a new issue