Commit e1491127 authored by James Laver's avatar James Laver

Update development docs

parent 5f4866b5
...@@ -14,15 +14,14 @@ granted access to a [backend](https://gitlab.iscpif.fr/gargantext/haskell-gargan ...@@ -14,15 +14,14 @@ granted access to a [backend](https://gitlab.iscpif.fr/gargantext/haskell-gargan
This software is free software, developed by the CNRS Complex Systems This software is free software, developed by the CNRS Complex Systems
Institute of Paris Île-de-France (ISC-PIF) and its partners. Institute of Paris Île-de-France (ISC-PIF) and its partners.
## Development ## Dependencies
### System Dependencies The build requires the following system dependencies preinstalled:
* NodeJS (11+) * NodeJS (11+)
* Yarn (Recent) * Yarn (Recent)
* A webserver (anything that can serve a static directory will do)
#### NodeJS Installation ### NodeJS
On debian testing, debian unstable or ubuntu: On debian testing, debian unstable or ubuntu:
...@@ -37,32 +36,28 @@ curl -sL https://deb.nodesource.com/setup_11.x | sudo bash - ...@@ -37,32 +36,28 @@ curl -sL https://deb.nodesource.com/setup_11.x | sudo bash -
sudo apt update && sudo apt install nodejs sudo apt update && sudo apt install nodejs
``` ```
(For Ubuntu) <!-- TODO: wtf is all this sudo? -->
```shell <!-- To upgrade to latest version (and not current stable) version, you can -->
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - <!-- use the `n` module from npm to upgrade node: -->
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt update && sudo apt install yarn
```
To upgrade to latest version (and not current stable) version, you can use
(Use n module from npm in order to upgrade node)
```shell <!-- ```shell -->
sudo npm cache clean -f <!-- sudo npm cache clean -f -->
sudo npm install -g n <!-- sudo npm install -g n -->
sudo n stable <!-- sudo n stable -->
sudo n latest <!-- sudo n latest -->
``` <!-- ``` -->
On Mac OS X with homebrew:
### OSX
```shell ```shell
brew install node brew install node
``` ```
#### Yarn installation For other platforms, please refer to [the nodejs website](https://nodejs.org/en/download/).
### Yarn (javascript package manager)
On ubuntu: On debian or ubuntu:
```shell ```shell
curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
...@@ -70,113 +65,77 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source ...@@ -70,113 +65,77 @@ echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/source
sudo apt update && sudo apt install yarn sudo apt update && sudo apt install yarn
``` ```
On Mac OS (with Homebrew): On Mac OS X with homebrew:
```shell ```shell
brew install yarn brew install yarn
``` ```
#### Webservers For other platforms, please refer to [the yarn website](https://www.yarnpkg.com/).
Some options:
* The `python3` builtin webserver ## Development
* Caddy
### Purescript and Javascript dependencies
Once you have node and yarn installed, you may install deps with: Once you have node and yarn installed, you may install deps with:
```shell ```shell
yarn install && yarn add psc-package && yarn install-ps && yarn build yarn install -D && yarn install-ps
```
You need to copy index.html:
```shell
cp src/index.html dist/
``` ```
(Be careful, to update or upgrade your install, maybe you need to remove You will likely want to check your work in a browser. We provide a
old files in node_modules). local development webserver that serves on port 5000 for this purpose:
### Development
You can compile the purescript code with:
```shell ```shell
yarn compile yarn server
``` ```
Or run a repl: To generate a new browser bundle to test:
```shell ```shell
yarn repl yarn build
```
```shell
yarn install && yarn ps-deps
``` ```
### Running a dev server If you are rapidly iterating and just want to type check your code:
```shell ```shell
yarn dev yarn compile
```
This will launch a hot-reloading development server with
webpack-dev-server. Visit [localhost:9000](http://localhost:9000/) to
see the result when the output shows a line like this:
```
ℹ 「wdm」: Compiled successfully.
``` ```
#### Purescript IDE integration You may access a purescript repl if you want to explore:
A `purs ide` connection will be available on port 9002 while the
development server is running.
A guide to getting set up with the IDE integration is beyond the scope
of this document.
#### Source maps
Currently broken. Someone please fix them.
### Getting a purescript repl
```shell ```shell
yarn repl yarn repl
``` ```
### Compiling styles If you need to reinstall dependencies such as after a git pull or branch switch:
We use the `sass` compiler for some of the style files. To convert them to CSS do:
```shell ```shell
yarn sass yarn install -D && yarn install-ps # both javascript and purescript
``` ```
### Building for production If something goes wrong building after a deps update, you may clean
build artifacts and try again:
```shell ```shell
yarn build yarn clean-js # clean javascript, very useful
yarn clean-ps # clean purescript, should never be required, possible purescript bug
yarn clean # clean both purescript and javascript
``` ```
It is *not* necessary to `yarn compile` before running `yarn build`. If you edit the SASS, you'll need to rebuild the CSS:
You can then serve the `dist` directory with your favourite webserver. ```shell
yarn sass
Examples: ```
* `python3 -m http.server --directory dist` (requires Python 3.7+) <!-- A `purs ide` connection will be available on port 9002 while the -->
<!-- development server is running. -->
<!-- To get a live-reloading development server --> A guide to getting set up with the IDE integration is coming soon, I hope.
of this document.
<!-- ```shell --> ### Note to contributors
<!-- yarn live -->
<!-- ``` -->
Note that a production build takes a little while. Please follow CONTRIBUTING.md
### How do I? ### How do I?
...@@ -194,12 +153,6 @@ endConfig' v = { front : frontRelative ...@@ -194,12 +153,6 @@ endConfig' v = { front : frontRelative
, back : backDemo v } , back : backDemo v }
``` ```
## Note to the contributors
Please follow CONTRIBUTING.md
### How do I?
#### Add a javascript dependency? #### Add a javascript dependency?
Add it to `package.json`, under `dependencies` if it is needed at Add it to `package.json`, under `dependencies` if it is needed at
...@@ -288,10 +241,9 @@ bigram/2-gram ...@@ -288,10 +241,9 @@ bigram/2-gram
: A two-word n-gram, e.g. `coffee cup` : A two-word n-gram, e.g. `coffee cup`
trigram/3-gram trigram/3-gram
: A three-word n-gram, e.g. `coffee cup holder` : A three-word n-gram, e.g. `coffee cup holder`
<!-- skip-grams are not yet supported --> skip-gram
<!-- skip-gram --> : An n-gram where the words are not all adjacent. Not yet supported.
<!-- : An n-gram where the words are not all adjacent --> k-skip-n-gram
<!-- k-skip-n-gram --> : An n-gram where the words are at most distance k from each other.
<!-- : An n-gram where the words are at most distance k from each other -->
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"clean-js": "rm -Rf node_modules", "clean-js": "rm -Rf node_modules",
"clean-ps": "rm -Rf output", "clean-ps": "rm -Rf output",
"test": "pulp test", "test": "pulp test",
"start": "serve dist" "server": "serve dist"
}, },
"dependencies": { "dependencies": {
"create-react-class": "^15.6.3", "create-react-class": "^15.6.3",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment