Skip to content

Commit 819e552

Browse files
committed
docs: add build and publish guides
1 parent 739407c commit 819e552

File tree

2 files changed

+44
-9
lines changed

2 files changed

+44
-9
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,37 @@ set "NODEPLOTLIB_PORT=4201" && npx nx run dev-server:serve
4646
$env:NODEPLOTLIB_PORT = "4201" ; npx nx run dev-server:serve
4747
```
4848

49+
## Build for production
50+
51+
To build for production three steps are necessary. Build the web app, build
52+
the library, and finally copy the web app files to the libraries dist folder.
53+
All steps are bundled in the following script:
54+
55+
```
56+
npm run build:prod
57+
```
58+
59+
All dist files are located in **/dist/libs/nodeplotlib**
60+
61+
## Release Guide
62+
63+
This is a note for maintainers only. There are several steps to follow before you
64+
can publish the new version to npm.
65+
66+
1. Bump the version number using semver. Use "rc" for release candidates as the _preid_, e.g.
67+
`1.0.0-rc1`. Updat the version number in the root [package.json](./package.json)
68+
and in the libs [package.json](./libs/nodeplotlib/package.json).
69+
2. If everything is committed and in place on "master" for non-release candidates,
70+
or on "release/..." for release candidates. Create a tag with that version number,
71+
e.g. `v1.0.0-rc1` or `v1.0.1`, and push it to the repository.
72+
3. Run `npm run build:prod`
73+
4. Navigate to **/dist/libs/nodeplotlib**
74+
5. Run `npm pack`
75+
6. Make sure to be logged in to npmjs. Then run
76+
- `npm publish {{filename}}.tgz` or
77+
- `npm publish {{filename}}.tgz --tag test` for release candidates.
78+
7. Create a release on Github for non-release cadidate versions.
79+
4980
## Behind the scenes
5081

5182
The lib launches a webserver and opens new tabs for every plot located at

libs/nodeplotlib/README.md

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@ Use with TypeScript/JavaScript:
2727
```typescript
2828
import { plot, Plot } from 'nodeplotlib';
2929

30-
const data: Plot[] = [{
30+
const data: Plot[] = [
31+
{
3132
x: [1, 3, 4, 5],
3233
y: [3, 12, 1, 4],
3334
type: 'scatter',
34-
}];
35+
},
36+
];
3537

3638
plot(data);
3739
```
@@ -55,13 +57,15 @@ const stream$: Observable<Plot[]> = interval(100).pipe(
5557
);
5658

5759
function createSinusPlotFromNumber(num: number): Plot[] {
58-
const data: Plot[] = [{
59-
x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
60-
y: Array(10)
61-
.fill(0)
62-
.map((_, i) => Math.sin(num + i)),
63-
type: 'scatter',
64-
}];
60+
const data: Plot[] = [
61+
{
62+
x: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
63+
y: Array(10)
64+
.fill(0)
65+
.map((_, i) => Math.sin(num + i)),
66+
type: 'scatter',
67+
},
68+
];
6569
return data;
6670
}
6771
```

0 commit comments

Comments
 (0)