README.md 2.44 KB
Newer Older
Mathias Chouet's avatar
Mathias Chouet committed
1
# JaLHyd - Javascript Library For Hydraulics
2

Mathias Chouet's avatar
Mathias Chouet committed
3
See also [developers documentation](https://gitlab.irstea.fr/cassiopee/jalhyd/blob/master/DEVELOPERS.md)
4

Mathias Chouet's avatar
Mathias Chouet committed
5
## Build and release
6

Mathias Chouet's avatar
Mathias Chouet committed
7
### Requirements
8

Mathias Chouet's avatar
Mathias Chouet committed
9
 * nodejs
10

Mathias Chouet's avatar
Mathias Chouet committed
11
### Install dependencies
12

Mathias Chouet's avatar
Mathias Chouet committed
13 14 15
```sh
npm install
```
16

Mathias Chouet's avatar
Mathias Chouet committed
17
### Run unit tests using Jasmine
18

Mathias Chouet's avatar
Mathias Chouet committed
19
Debugging might not be possible because of circular dependencies generated by typescript compiler
20

Mathias Chouet's avatar
Mathias Chouet committed
21 22 23
```sh
npm run jasmine
```
24

Mathias Chouet's avatar
Mathias Chouet committed
25 26
### Compile (es2015 modules)
This is the preferred way of compiling, notably for usage in Web apps (ngHyd)
Mathias Chouet's avatar
Mathias Chouet committed
27 28 29
```sh
npm run build
```
Grand Francois's avatar
Grand Francois committed
30

Mathias Chouet's avatar
Mathias Chouet committed
31 32 33 34 35
### Compile for Node.js (commonjs modules)
Use this if you want to write a CLI application in JS or TS, that will be executed by Node.js (see examples in `/boilerplate`)
```sh
npm run build-node
```
Grand Francois's avatar
Grand Francois committed
36

Mathias Chouet's avatar
Mathias Chouet committed
37
### Generate release package (es2015 modules)
Grand Francois's avatar
Grand Francois committed
38

Mathias Chouet's avatar
Mathias Chouet committed
39 40 41
```sh
npm run package
```
42

Mathias Chouet's avatar
Mathias Chouet committed
43 44 45 46 47
### Generate release package for Node.js (commonjs modules)

```sh
npm run package-node
```
48

Mathias Chouet's avatar
Mathias Chouet committed
49
### Flag suspicious language usage
50

Mathias Chouet's avatar
Mathias Chouet committed
51 52 53
```sh
npm run lint
```
Mathias Chouet's avatar
Mathias Chouet committed
54

Mathias Chouet's avatar
Mathias Chouet committed
55
### Generate typedoc
Mathias Chouet's avatar
Mathias Chouet committed
56

Mathias Chouet's avatar
Mathias Chouet committed
57 58 59
```sh
npm run doc
```
Mathias Chouet's avatar
Mathias Chouet committed
60

Mathias Chouet's avatar
Mathias Chouet committed
61 62

### Generate UML diagram
63 64 65

The tsviz package can be used for drawing class diagram of the current code.

Mathias Chouet's avatar
Mathias Chouet committed
66 67 68 69
To install tsviz:
```sh
npm install -g tsviz
```
70 71 72 73

There's currently a bug on debian like distribution due to a wrong declaration of graphviz path in the code: https://github.com/joaompneves/tsviz/issues/5
To work around, you can create a link to the good path: `sudo ln -s /usr/bin/dot /usr/local/bin/dot` 

Mathias Chouet's avatar
Mathias Chouet committed
74 75 76 77
To draw the diagram:
```sh
npm run viz
```
78 79 80 81 82

## Release policy

Use [semantic versioning](https://semver.org/).

Mathias Chouet's avatar
Mathias Chouet committed
83 84
**When releasing a Cassiopee (NgHyd) version along with a JaLHyd version, it's discouraged to execute release steps manually, see "Release Policy / Release Script" in [NgHyd's README.md](https://gitlab.irstea.fr/cassiopee/nghyd/blob/master/README.md)**

85
Before releasing a new stable version, one should complete the following files
Mathias Chouet's avatar
Mathias Chouet committed
86
 - `CHANGELOG.md`
Mathias Chouet's avatar
Mathias Chouet committed
87
 - `package.json` (update "version", or use `npm version`)
88 89 90 91 92

Every stable version should be tagged with both
 - a tag stating compatibility with NgHyd, of the form `nghyd_X.Y.Z`
 - the `stable` tag

Mathias Chouet's avatar
Mathias Chouet committed
93
The `stable` tag should be set **after** the NgHyd compatibility tag, so that `git describe` returns `stable` (latest tag). There should be **at least 1s** between the two tag commands, so that date sorting is not confused.
94 95

Here are the steps to follow for an example **4.5.0** version
Mathias Chouet's avatar
Mathias Chouet committed
96
```sh
Mathias Chouet's avatar
Mathias Chouet committed
97 98 99
npm version 4.5.0
# commit changes

Mathias Chouet's avatar
Mathias Chouet committed
100
git tag -fa nghyd_4.5.0
Mathias Chouet's avatar
Mathias Chouet committed
101
sleep 1
Mathias Chouet's avatar
Mathias Chouet committed
102 103 104
git tag -fa stable
git push --tags --force
```