New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@bentley/imodeljs-native

Package Overview
Dependencies
Maintainers
4
Versions
612
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bentley/imodeljs-native - npm Package Compare versions

Comparing version

to
0.99.0

46

installNativePlatform.js
/*--------------------------------------------------------------------------------------+
| $Copyright: (c) 2018 Bentley Systems, Incorporated. All rights reserved. $
| $Copyright: (c) 2019 Bentley Systems, Incorporated. All rights reserved. $
+--------------------------------------------------------------------------------------*/

@@ -12,15 +12,15 @@ const exec = require("child_process").exec;

function copyFolderRecursiveSync(source, target) {
if (!fs.existsSync(target))
fs.mkdirSync(target);
if (!fs.existsSync(target))
fs.mkdirSync(target);
if (fs.lstatSync(source).isDirectory()) {
fs.readdirSync(source).forEach(function (file) {
const curSource = path.join(source, file);
if (fs.lstatSync(curSource).isDirectory()) {
copyFolderRecursiveSync(curSource, path.join(target, path.basename(curSource)));
} else {
fs.writeFileSync(path.join(target, file), fs.readFileSync(curSource));
}
});
}
if (fs.lstatSync(source).isDirectory()) {
fs.readdirSync(source).forEach(function (file) {
const curSource = path.join(source, file);
if (fs.lstatSync(curSource).isDirectory()) {
copyFolderRecursiveSync(curSource, path.join(target, path.basename(curSource)));
} else {
fs.writeFileSync(path.join(target, file), fs.readFileSync(curSource));
}
});
}
}

@@ -33,17 +33,17 @@

try { fs.mkdirSync(installDir); } catch (err) { }
fs.copyFileSync(path.join(__dirname, "package.json"), path.join(installDir, "package.json"));
fs.copyFileSync(path.join(__dirname, "package.json"), path.join(installDir, "package.json"));
// We will then copy the results of the install from the temp directory into sub-directories below this one.
function installNativePackage(package) {
const cmdLine = `npm install --no-save @bentley/${package}`;
console.log(cmdLine);
exec(cmdLine, { cwd: installDir }, (error, stdout, stderr) => {
if (error)
throw error;
console.log(stdout);
console.log(stderr);
copyFolderRecursiveSync(path.join(installDir, "node_modules", "@bentley"), __dirname);
});
const cmdLine = `npm install --no-save @bentley/${package}`;
console.log(cmdLine);
exec(cmdLine, { cwd: installDir }, (error, stdout, stderr) => {
if (error)
throw error;
console.log(stdout);
console.log(stderr);
copyFolderRecursiveSync(path.join(installDir, "node_modules", "@bentley"), __dirname);
});
}
installNativePackage(`${formatPackageName()}@${version}`);
/*--------------------------------------------------------------------------------------+
| $Copyright: (c) 2018 Bentley Systems, Incorporated. All rights reserved. $
| $Copyright: (c) 2019 Bentley Systems, Incorporated. All rights reserved. $
+--------------------------------------------------------------------------------------*/
const path = require('path');
exports.formatPackageName = function() { return `imodeljs-${process.platform}-${process.arch}`; }
exports.formatPackageName = function () { return `imodeljs-${process.platform}-${process.arch}`; }
// Load the right node addon for this platform (node|electron, OS, cpu)
// @param dir - optional directory from which addon should be loaded
exports.loadNativePlatform = function(dir) {
// We make sure we are running in a known platform.
if (typeof process === "undefined" || process.platform === undefined || process.arch === undefined || process.version === "")
// Load the right node addon for this platform (OS, cpu)
exports.loadNativePlatform = function () {
// We make sure we are running in a known platform.
if (typeof process === "undefined" || process.platform === undefined || process.arch === undefined)
throw new Error("Error - unknown process");
const packageName = exports.formatPackageName(); // this includes current platform and CPU
// Under windows, we need to find the correct version of Napi.dll, depending on whether we're running under
// Node or Electron. [N.B. The only difference is that Napi.dll forwards its exports to "Node.exe" if we're
// under Node, and "Node.dll" under Electron.] To do that we prepend the appropriate subdirectory to the PATH
// so the loader will find the correct one.
// Note: this is only necessary under Windows.
if (process.platform == "win32") {
const engine = (typeof process.versions.electron !== "undefined") ? "Electron" : "Node";
process.env.path = path.join(__dirname, packageName, engine) + ";" + process.env.path;
}
const addonDir = dir || path.join("@bentley", "imodeljs-native", packageName);
return require(path.join(addonDir, "imodeljs.node"));
const packageName = exports.formatPackageName(); // this includes current platform and CPU
const addonDir = path.join("@bentley", "imodeljs-native", packageName);
return require(path.join(addonDir, "imodeljs.node"));
}
{
"name": "@bentley/imodeljs-native",
"license": "SEE LICENSE IN LICENSE.md",
"version": "0.86.0",
"version": "0.99.0",
"keywords": [

@@ -6,0 +6,0 @@ "Bentley",