Skip to content

Commit 8d54e02

Browse files
committed
Update dependencies for 0.3.4
1 parent 560a3f1 commit 8d54e02

File tree

3 files changed

+26
-4
lines changed

3 files changed

+26
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#### 0.3.4
2+
3+
- Update dependencies
4+
15
#### 0.3.3
26

37
- Add plugin stub to runtime (#73) @joepavitt

index.js

+21-2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
'use strict';
1717

1818
const path = require("path");
19+
const process = require("process")
1920
const sinon = require("sinon");
2021
const should = require('should');
2122
const fs = require('fs');
@@ -25,17 +26,35 @@ var bodyParser = require("body-parser");
2526
const express = require("express");
2627
const http = require('http');
2728
const stoppable = require('stoppable');
28-
const readPkgUp = require('read-pkg-up');
2929
const semver = require('semver');
3030
const EventEmitter = require('events').EventEmitter;
3131

3232
const PROXY_METHODS = ['log', 'status', 'warn', 'error', 'debug', 'trace', 'send'];
3333

34+
35+
// Find the nearest package.json
36+
function findPackageJson(dir) {
37+
dir = path.resolve(dir || process.cwd())
38+
const { root } = path.parse(dir)
39+
if (dir === root) {
40+
return null
41+
}
42+
const packagePath = path.join(dir, 'package.json')
43+
if (fs.existsSync(packagePath)) {
44+
return {
45+
path: packagePath,
46+
packageJson: JSON.parse(fs.readFileSync(packagePath, 'utf-8'))
47+
}
48+
} else {
49+
return findPackageJson(path.resolve(path.join(dir, '..')))
50+
}
51+
}
52+
3453
/**
3554
* Finds the NR runtime path by inspecting environment
3655
*/
3756
function findRuntimePath() {
38-
const upPkg = readPkgUp.sync();
57+
const upPkg = findPackageJson()
3958
// case 1: we're in NR itself
4059
if (upPkg.packageJson.name === 'node-red') {
4160
if (checkSemver(upPkg.packageJson.version,"<0.20.0")) {

package.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@
1414
},
1515
"dependencies": {
1616
"body-parser": "^1.20.2",
17-
"express": "^4.18.2",
18-
"read-pkg-up": "^7.0.1",
17+
"express": "^4.19.2",
1918
"semver": "^7.5.4",
2019
"should": "^13.2.3",
2120
"should-sinon": "^0.0.6",

0 commit comments

Comments
 (0)