diff --git a/package-lock.json b/package-lock.json index c3e15e1..b91aa1d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "rman", - "version": "0.37.2", + "version": "0.37.3", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "rman", - "version": "0.37.2", + "version": "0.37.3", "license": "MIT", "dependencies": { "@netlify/parse-npm-script": "^0.1.2", diff --git a/package.json b/package.json index 99ac20b..d4fc0e7 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "rman", "description": "Repository manager", - "version": "0.37.2", + "version": "0.37.3", "author": "Panates", "license": "MIT", "dependencies": { diff --git a/src/cli.ts b/src/cli.ts index ce583c8..c0e6d1c 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,6 +1,6 @@ import colors from 'ansi-colors'; import { getDirname } from 'cross-dirname'; -import fs from 'fs/promises'; +import fs from 'fs'; import logger from 'npmlog'; import path from 'path'; import yargs from 'yargs'; @@ -18,8 +18,11 @@ import { Repository } from './core/repository.js'; export async function runCli(options?: { argv?: string[]; cwd?: string }) { try { - const s = path.resolve(getDirname(), '../package.json'); - const pkgJson = JSON.parse(await fs.readFile(s, 'utf-8')); + let s = path.resolve(getDirname(), './package.json'); + if (!fs.existsSync(s)) { + s = path.resolve(getDirname(), '../package.json'); + } + const pkgJson = JSON.parse(fs.readFileSync(s, 'utf-8')); const repository = Repository.create(options?.cwd); const _argv = options?.argv || process.argv.slice(2);