Skip to content

Commit

Permalink
[OV JS] Make download binaries script universal (#27465)
Browse files Browse the repository at this point in the history
### Details:
 - Implement **BinaryManager** class that configurable and universal
 - Extract helpers logic into utils
 - Make `download-binaries` script short and readable

### Tickets:
 - 156951

---------

Co-authored-by: Alicja Miloszewska <alicja.miloszewska@intel.com>
  • Loading branch information
vishniakov-nikolai and almilosz authored Nov 12, 2024
1 parent dbc14b2 commit c6cc97c
Show file tree
Hide file tree
Showing 6 changed files with 314 additions and 305 deletions.
4 changes: 2 additions & 2 deletions src/bindings/js/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "2024.4.0",
"description": "OpenVINO™ utils for using from Node.js environment",
"repository": {
"url": "https://github.com/openvinotoolkit/openvino.git",
"url": "git+https://github.com/openvinotoolkit/openvino.git",
"type": "git"
},
"license": "Apache-2.0",
Expand All @@ -23,7 +23,7 @@
"test:e2e": "mocha ./tests/e2e/electron-app.test.js",
"tsc": "tsc",
"postinstall": "npm run install_runtime",
"download_runtime": "node ./scripts/download_runtime.js",
"download_runtime": "node ./scripts/download-runtime.js",
"install_runtime": "npm run download_runtime -- --ignore-if-exists"
},
"devDependencies": {
Expand Down
24 changes: 24 additions & 0 deletions src/bindings/js/node/scripts/download-runtime.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
const { join } = require('node:path');

const BinaryManager = require('./lib/binary-manager');
const packageJson = require('../package.json');

if (require.main === module) main();

async function main() {
if (!BinaryManager.isCompatible()) process.exit(1);

const force = process.argv.includes('-f') || process.argv.includes('--force');
const ignoreIfExists = process.argv.includes('-i')
|| process.argv.includes('--ignore-if-exists');

const { env } = process;
const proxy = env.http_proxy || env.HTTP_PROXY || env.npm_config_proxy;

await BinaryManager.prepareBinary(
join(__dirname, '..'),
packageJson.version,
packageJson.binary,
{ force, ignoreIfExists, proxy },
);
}
302 changes: 0 additions & 302 deletions src/bindings/js/node/scripts/download_runtime.js

This file was deleted.

Loading

0 comments on commit c6cc97c

Please sign in to comment.