Skip to content
This repository was archived by the owner on Aug 22, 2023. It is now read-only.

Commit 080a8ad

Browse files
author
Lucas Shadler
committed
fix: correctly fetch package version
1 parent 44a9a7f commit 080a8ad

File tree

3 files changed

+39
-2
lines changed

3 files changed

+39
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"@oclif/parser": "^3.8.3",
1111
"@oclif/plugin-help": "^3",
1212
"debug": "^4.1.1",
13+
"pkg-dir": "^5.0.0",
1314
"semver": "^7.3.2"
1415
},
1516
"devDependencies": {

src/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as path from 'path'
22
import * as semver from 'semver'
3-
3+
import * as pkgDir from 'pkg-dir'
44
function checkCWD() {
55
try {
66
process.cwd()
@@ -11,7 +11,7 @@ function checkCWD() {
1111
}
1212
}
1313
function checkNodeVersion() {
14-
const root = path.join(__dirname, '..')
14+
const root = pkgDir.sync(__dirname) || '..'
1515
const pjson = require(path.join(root, 'package.json'))
1616
if (!semver.satisfies(process.versions.node, pjson.engines.node)) {
1717
process.stderr.write(`WARNING\nWARNING Node version must be ${pjson.engines.node} to use this CLI\nWARNING Current node version: ${process.versions.node}\nWARNING\n`)

yarn.lock

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1528,6 +1528,14 @@ find-up@^4.1.0:
15281528
locate-path "^5.0.0"
15291529
path-exists "^4.0.0"
15301530

1531+
find-up@^5.0.0:
1532+
version "5.0.0"
1533+
resolved "https://registry.yarnpkg.com/find-up/-/find-up-5.0.0.tgz#4c92819ecb7083561e4f4a240a86be5198f536fc"
1534+
integrity sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==
1535+
dependencies:
1536+
locate-path "^6.0.0"
1537+
path-exists "^4.0.0"
1538+
15311539
15321540
version "2.0.0"
15331541
resolved "https://registry.yarnpkg.com/findup-sync/-/findup-sync-2.0.0.tgz#9326b1488c22d1a6088650a86901b2d9a90a2cbc"
@@ -2349,6 +2357,13 @@ locate-path@^5.0.0:
23492357
dependencies:
23502358
p-locate "^4.1.0"
23512359

2360+
locate-path@^6.0.0:
2361+
version "6.0.0"
2362+
resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-6.0.0.tgz#55321eb309febbc59c4801d931a72452a681d286"
2363+
integrity sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==
2364+
dependencies:
2365+
p-locate "^5.0.0"
2366+
23522367
lodash._reinterpolate@^3.0.0:
23532368
version "3.0.0"
23542369
resolved "https://registry.yarnpkg.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz#0ccf2d89166af03b3663c796538b75ac6e114d9d"
@@ -2876,6 +2891,13 @@ p-limit@^2.2.0:
28762891
dependencies:
28772892
p-try "^2.0.0"
28782893

2894+
p-limit@^3.0.2:
2895+
version "3.0.2"
2896+
resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-3.0.2.tgz#1664e010af3cadc681baafd3e2a437be7b0fb5fe"
2897+
integrity sha512-iwqZSOoWIW+Ew4kAGUlN16J4M7OB3ysMLSZtnhmqx7njIHFPlxWBX8xo3lVTyFVq6mI/lL9qt2IsN1sHwaxJkg==
2898+
dependencies:
2899+
p-try "^2.0.0"
2900+
28792901
p-locate@^2.0.0:
28802902
version "2.0.0"
28812903
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-2.0.0.tgz#20a0103b222a70c8fd39cc2e580680f3dde5ec43"
@@ -2897,6 +2919,13 @@ p-locate@^4.1.0:
28972919
dependencies:
28982920
p-limit "^2.2.0"
28992921

2922+
p-locate@^5.0.0:
2923+
version "5.0.0"
2924+
resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-5.0.0.tgz#83c8315c6785005e3bd021839411c9e110e6d834"
2925+
integrity sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==
2926+
dependencies:
2927+
p-limit "^3.0.2"
2928+
29002929
p-try@^1.0.0:
29012930
version "1.0.0"
29022931
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
@@ -3064,6 +3093,13 @@ pinkie@^2.0.0:
30643093
resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870"
30653094
integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA=
30663095

3096+
pkg-dir@^5.0.0:
3097+
version "5.0.0"
3098+
resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-5.0.0.tgz#a02d6aebe6ba133a928f74aec20bafdfe6b8e760"
3099+
integrity sha512-NPE8TDbzl/3YQYY7CSS228s3g2ollTFnc+Qi3tqmqJp9Vg2ovUpixcJEo2HJScN2Ez+kEaal6y70c0ehqJBJeA==
3100+
dependencies:
3101+
find-up "^5.0.0"
3102+
30673103
posix-character-classes@^0.1.0:
30683104
version "0.1.1"
30693105
resolved "https://registry.yarnpkg.com/posix-character-classes/-/posix-character-classes-0.1.1.tgz#01eac0fe3b5af71a2a6c02feabb8c1fef7e00eab"

0 commit comments

Comments
 (0)