@needle-tools/engine
Version:
Needle Engine is a web-based runtime for 3D apps. It runs on your machine for development with great integrations into editors like Unity or Blender - and can be deployed onto any device! It is flexible, extensible and networking and XR are built-in
21 lines (20 loc) • 843 B
JavaScript
import { existsSync, readFileSync } from "fs";
/** @returns {string|null} */
export function tryGetNeedleEngineVersion() {
const needleEnginePackageJsonPath = process.cwd() + "/node_modules/@needle-tools/engine/package.json";
if (existsSync(needleEnginePackageJsonPath)) {
const json = JSON.parse(readFileSync(needleEnginePackageJsonPath));
const version = json.version;
return version;
}
// check if we're in the needle engine package directory (for a release)
const packageJsonPath = process.cwd() + "/package.json";
if (existsSync(packageJsonPath)) {
const json = JSON.parse(readFileSync(packageJsonPath));
if (json.name === "@needle-tools/engine") {
const version = json.version;
return version;
}
}
return null;
}