Skip to content

Commit 56c56dc

Browse files
committed
chore: add webpack copy plugin
1 parent 2cfd4cb commit 56c56dc

10 files changed

+157
-21
lines changed

NOTES.md

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@ These are notes for the stream implementation of Nodeplotlib.
2828
- Is the `stack` function really needed? Stack served the purpose that only one window opens which
2929
could display several plots.
3030

31+
## The clear function
32+
33+
- The `clear` function is also probably not needed. Just close all windows and it should close the
34+
subscriptions to the plots and streams.
35+
3136
## Backlog
3237

3338
- The user can remove plots from the frontend. If that happened it submits a message to the

angular.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,10 @@
138138
"main": "apps/nodeplotlib/src/main.ts",
139139
"tsConfig": "apps/nodeplotlib/tsconfig.app.json",
140140
"assets": [
141-
"apps/nodeplotlib/src/assets",
142141
"apps/nodeplotlib/src/package.json"
143-
]
142+
],
143+
"externalDendencies": "none",
144+
"webpackConfig": "apps/nodeplotlib/webpack.config.js"
144145
},
145146
"configurations": {
146147
"production": {

apps/nodeplotlib/src/main.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// This file should be generated automatically by the webpack compiler.
2+
import { PlotData, Layout as PlotlyLayout } from 'plotly.js';
3+
import { Observable } from 'rxjs';
4+
5+
export type Plot = Partial<PlotData>;
6+
export type Layout = Partial<PlotlyLayout>;
7+
export function plot(plot: Plot[] | Observable<Plot[]>, layout?: Layout): void

apps/nodeplotlib/src/package.json

+13-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,17 @@
22
"name": "npl",
33
"version": "0.8.0-rc0",
44
"license": "MIT",
5-
"main": "main.js"
5+
"main": "main.js",
6+
"types": "main.d.ts",
7+
"files": [
8+
"main.js",
9+
"main.d.ts",
10+
"web/**"
11+
],
12+
"dependencies": {
13+
"@types/plotly.js": "^1.54.17"
14+
},
15+
"peerDependencies": {
16+
"rxjs": "^6.5.3"
17+
}
618
}

apps/nodeplotlib/webpack.config.js

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const CopyPlugin = require("copy-webpack-plugin");
2+
3+
module.exports = (x) => ({
4+
...x,
5+
plugins: [
6+
...x.plugins,
7+
new CopyPlugin({
8+
patterns: [
9+
{ from: "dist/apps/web", to: "web" },
10+
{ from: "apps/nodeplotlib/src/main.d.ts", to: "" },
11+
{ from: "LICENSE", to: "" },
12+
],
13+
}),
14+
],
15+
});

nx.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@
3737
"tags": ["type:util", "scope:shared"]
3838
},
3939
"nodeplotlib": {
40-
"tags": []
40+
"tags": [],
41+
"implicitDependencies": ["web"]
4142
},
4243
"web": {
4344
"tags": []

package-lock.json

+94-17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"@types/request": "^2.48.7",
7070
"@typescript-eslint/eslint-plugin": "~4.28.3",
7171
"@typescript-eslint/parser": "~4.28.3",
72+
"copy-webpack-plugin": "^6.3.2",
7273
"cypress": "^8.3.0",
7374
"eslint": "7.22.0",
7475
"eslint-config-prettier": "8.1.0",

tools/demo/README.md

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Demo plots
2+
3+
These plots are meant to run with the compiled version of nodeplotlib. You can run them
4+
with the following commands:
5+
6+
7+
```
8+
node ./tools/demo/scatter.js
9+
node ./tools/demo/candlestick.js
10+
npx ts-node ./tools/demo/scatter.ts
11+
```
12+
13+
For further demos you can have a look at the **dev-server** app. In the */data* folder
14+
you'll find demos for several plot types.

tools/demo/scatter.ts

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { plot } from '../../dist/apps/nodeplotlib';
2+
3+
plot([{ x: [0, 1], y: [1, 1], type: 'scatter' }]);

0 commit comments

Comments
 (0)