Skip to content

Commit 3d0ea5b

Browse files
[DOCS][OV JS] Update JS API readme (#23138)
### Details: - Actualize JS API readme file for npm - Fix link to node directory - Fix .npmignore to do not include extra files into npm package --------- Co-authored-by: Sebastian Golebiewski <sebastianx.golebiewski@intel.com>
1 parent 8b79292 commit 3d0ea5b

File tree

10 files changed

+146
-68
lines changed

10 files changed

+146
-68
lines changed

samples/js/node/README.md

+16-10
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
# OpenVINO™ JavaScript API examples of usage
1+
# OpenVINO™ Node.js Bindings Examples of Usage
22

3-
## Installation of openvino-node package
4-
From *openvino/src/bindings/js/node* run `npm i` to download OpenVINO™ runtime, install requirements, build bindings and compile TypeScript code to JavaScript
3+
## Install
54

6-
On the *.nix systems run `source openvino/src/bindings/js/node/scripts/setupvars.sh` to add path to OpenVINO™ runtime libraries in `LD_LIBRARY_PATH` variable
5+
To run samples, install dependencies first. In current directory run:
6+
```bash
7+
npm install
8+
```
79

810
Note: Perform these steps also before running notebooks.
911

1012
## Samples
13+
1114
- hello_classification
1215
- hello_reshape_ssd
1316
- classification_sample_async
@@ -17,10 +20,13 @@ Note: Perform these steps also before running notebooks.
1720
Use [Node.js Notebooks (REPL)](https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook)
1821
VSCode extension to run these notebook samples
1922

20-
Make sure that `LD_LIBRARY_PATH` variable contains path to OpenVINO runtime folder
21-
2223
- ./notebooks
23-
- 001-hello-world.nnb
24-
- 003-hello-segmentation.nnb
25-
- 004-hello-detection.nnb
26-
- 213-question-answering.nnb
24+
- 001-hello-world.nnb
25+
- 003-hello-segmentation.nnb
26+
- 004-hello-detection.nnb
27+
- 213-question-answering.nnb
28+
29+
## See Also
30+
31+
* [OpenVINO™ JavaScript API Developer Documentation](../../../src/bindings/js/docs/README.md#openvino-node-package-developer-documentation)
32+
* [OpenVINO™ README](../../../README.md)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Image Classification Async NodeJS Sample
1+
# Image Classification Async Node.js Sample
22

33
Models with only 1 input and output are supported.
44

55
Run:
6-
`node classification_sample_async.js -m *path_to_model_file* -i *path_to_img1* -i *path_to_img2* -d AUTO`
6+
```bash
7+
node classification_sample_async.js -m *path_to_model_file* -i *path_to_img1* -i *path_to_img2* -d AUTO
8+
```
79

8-
Other details see in /samples/python/classification_sample_async/README.md
10+
Other details see in [../../../python/classification_sample_async/README.md](../../../python/classification_sample_async/README.md)
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
# Hello Classification NodeJS Sample
1+
# Hello Classification Node.js Sample
22

33
Models with only 1 input and output are supported.
44

55
Run:
6-
`node hello_classification.js *path_to_model_file* *path_to_img* AUTO`
6+
```bash
7+
node hello_classification.js *path_to_model_file* *path_to_img* AUTO
8+
```
79

8-
Other details see in /samples/python/hello_classification/README.md
10+
Other details see in [../../../python/hello_classification/README.md](../../../python/hello_classification/README.md)

samples/js/node/hello_reshape_ssd/README.md

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
# Hello Reshape SSD NodeJS Sample
1+
# Hello Reshape SSD Node.js Sample
22

33
Models with only 1 input and output are supported.
44

55
Run:
6-
`node hello_reshape_ssd.js *path_to_model_file* *path_to_img* AUTO`
6+
```bash
7+
node hello_reshape_ssd.js *path_to_model_file* *path_to_img* AUTO
8+
```
9+
10+
Other details see in [../../../python/hello_reshape_ssd/README.md](../../../python/hello_reshape_ssd/README.md)
711

8-
Other details see in /samples/python/hello_reshape_ssd/README.md

src/bindings/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ OpenVINO provides bindings for several languages:
55
* [c](./c)
66
* [python](./python)
77
* [javascript](./js)
8-
* [nodejs](./js/nodejs)
8+
* [node.js](./js/node)
99

1010
## See also
1111
* [OpenVINO™ README](../../README.md)

src/bindings/js/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# OpenVINO™ JavaScript API
22

3-
- `./node` - openvino-node NPM package with Node.js bindings
3+
- [./node](./node) - **openvino-node** npm package with OpenVINO Node.js bindings

src/bindings/js/docs/README.md

+81-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,83 @@
1-
# Javascript bindings
1+
# OpenVINO™ JavaScript Bindings
2+
3+
## Folders
24

35
- `./docs` - documentation
4-
- `./node` - openvino-node NPM package with Node.js bindings
6+
- `./node` - openvino-node npm package
7+
8+
## openvino-node Package Developer Documentation
9+
10+
### Components
11+
12+
- [include](../node/include/) - header files for current API.
13+
- [lib](../node/lib/) - TypeScript sources for current API.
14+
- [src](../node/src/) - C++ sources for current API.
15+
- [tests](../node/tests/) - tests directory for current API.
16+
17+
### Build
18+
19+
- Make sure that all submodules are updated:
20+
```bash
21+
git submodule update --init --recursive
22+
```
23+
- Create the *build* directory:
24+
```bash
25+
mkdir build && cd build
26+
```
27+
- Configure building of the binaries:
28+
```bash
29+
cmake \
30+
-DCMAKE_BUILD_TYPE=Release \
31+
-DENABLE_FASTER_BUILD=ON \
32+
-DCPACK_GENERATOR=NPM \
33+
-DENABLE_SYSTEM_TBB=OFF -UTBB* \
34+
-DENABLE_TESTS=OFF \
35+
-DENABLE_SAMPLES=OFF \
36+
-DENABLE_WHEEL=OFF \
37+
-DENABLE_PYTHON=OFF \
38+
-DENABLE_INTEL_GPU=OFF \
39+
-DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin \
40+
..
41+
```
42+
- Build the bindings:
43+
```bash
44+
cmake --build . --config Release --verbose -j4
45+
```
46+
- Install binaries for the *openvino-node* package:
47+
```bash
48+
cmake --install .
49+
```
50+
- Navigate to the *npm* package folder:
51+
```bash
52+
cd ../src/bindings/js/node
53+
```
54+
- Now, you can install dependencies packages and transpile ts to js code:
55+
```bash
56+
npm install
57+
```
58+
- Run tests to make sure that **openvino-node** has been built successfully:
59+
```bash
60+
npm run test
61+
```
62+
63+
## Usage
64+
65+
- Add the **openvino-node** package to your project by specifying it in **package.json**:
66+
```json
67+
"openvino-node": "file:*path-to-current-directory*"
68+
```
69+
- Make sure to require it:
70+
```js
71+
const { addon: ov } = require('openvino-node');
72+
```
73+
74+
## Samples
75+
76+
[OpenVINO™ Node.js Bindings Examples of Usage](../../../../samples/js/node/README.md)
77+
78+
## See Also
79+
80+
* [OpenVINO™ README](../../../../README.md)
81+
* [OpenVINO™ Core Components](../../../README.md)
82+
* [OpenVINO™ JavaScript API](../README.md)
83+
* [OpenVINO™ Node.js Bindings](../node/README.md)

src/bindings/js/node/.npmignore

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ include
33
lib
44
src
55
tests
6+
thirdparty
67

78
.eslintrc.js
89
CMakeLists.txt

src/bindings/js/node/README.md

+28-43
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,35 @@
1-
# OpenVINO Node.js API
2-
3-
## Components
4-
5-
- [include](./include/) - header files for current API.
6-
- [lib](./lib/) - TypeScript sources for current API.
7-
- [src](./src/) - C++ sources for current API.
8-
- [tests](./tests/) - tests directory for current API.
9-
10-
## Build
11-
12-
- Make sure that all submodules are updated `git submodule update --init --recursive`
13-
- Create build dir `mkdir build && cd build`
14-
- Configure binaries building:
15-
```bash
16-
cmake \
17-
-DCMAKE_BUILD_TYPE=Release \
18-
-DENABLE_FASTER_BUILD=ON \
19-
-DCPACK_GENERATOR=NPM \
20-
-DENABLE_SYSTEM_TBB=OFF -UTBB* \
21-
-DENABLE_TESTS=OFF \
22-
-DENABLE_SAMPLES=OFF \
23-
-DENABLE_WHEEL=OFF \
24-
-DENABLE_PYTHON=OFF \
25-
-DENABLE_INTEL_GPU=OFF \
26-
-DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin \
27-
..
28-
```
29-
- Build bindings:
30-
`cmake --build . --config Release --verbose -j4`
31-
- Install binaries for openvino-node package:
32-
`cmake --install .`
33-
- Go to npm package folder `cd ../src/bindings/js/node`
34-
- Now you can install dependencies packages and transpile ts to js code. Run `npm install`
35-
- Run tests `npm run test` to make sure that **openvino-node** built successfully
1+
# OpenVINO™ Node.js Bindings
2+
3+
Use OpenVINO JavaScript API for your Node.js application.
364

375
## Usage
386

39-
- Add `openvino-node` package in your project, specify in **package.json**: `"openvino-node": "file:*path-to-current-directory*"`
40-
- Require by: `const ov = require('openvino-node');`
7+
Install the **openvino-node** package:
8+
```bash
9+
npm install openvino-node
10+
```
11+
12+
Use the **openvino-node** package:
13+
```js
14+
const { addon: ov } = require('openvino-node');
15+
```
16+
17+
## Build From Sources
18+
19+
For more details, refer to the [OpenVINO™ JavaScript API Developer Documentation](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/docs/README.md#openvino-node-package-developer-documentation)
20+
21+
## Documentation & Samples
22+
23+
- [OpenVINO™ Node.js API](https://docs.openvino.ai/2024/api/nodejs_api/nodejs_api.html)
24+
- [OpenVINO™ Node.js Bindings Examples of Usage](https://github.com/openvinotoolkit/openvino/blob/master/samples/js/node/README.md)
4125

42-
## Samples
26+
## See Also
4327

44-
[Samples & notebooks of OpenVINO Node.js API](../../../../samples/js/node/README.md)
28+
* [OpenVINO™ README](https://github.com/openvinotoolkit/openvino/blob/master/README.md)
29+
* [OpenVINO™ Core Components](https://github.com/openvinotoolkit/openvino/blob/master/src/README.md)
30+
* [OpenVINO™ Python API](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/README.md)
31+
* [OpenVINO™ Other Bindings](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/README.md)
4532

46-
## See also
33+
[License](https://github.com/openvinotoolkit/openvino/blob/master/LICENSE)
4734

48-
* [OpenVINO™ README](../../../../README.md)
49-
* [OpenVINO™ Core Components](../../../README.md)
50-
* [OpenVINO™ JavaScript API](../README.md)
35+
Copyright © 2018-2024 Intel Corporation

src/bindings/js/node/package-lock.json

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

0 commit comments

Comments
 (0)