Skip to content

Commit 5da39de

Browse files
fix: reading local package json
1 parent 9b925c7 commit 5da39de

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

src/command.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
import { Command, Option } from 'commander';
22
import fs from 'node:fs';
33
import chalk from 'chalk';
4-
import readPackageJson from './helpers/read-package-json.js';
54

6-
const packageJson = readPackageJson('./package.json');
5+
/**
6+
* Parse package meta
7+
*/
8+
const pkg = JSON.parse(
9+
fs.readFileSync(new URL('../package.json', import.meta.url), 'utf8'),
10+
);
711
const program = new Command();
812

913
program
10-
.name(packageJson.name)
11-
.description(packageJson.description)
12-
.version(packageJson.version)
14+
.name(pkg.name)
15+
.description(pkg.description)
16+
.version(pkg.version)
1317
.addOption(new Option('--only [microservices]', 'apply commands only for provided microservices, e.g. "users authentication authorization"').env('ONLY'))
1418
.option('--ms-folder [folder]', 'microservices folder', 'microservices')
1519
.option('--env-path [env-path]', 'microservices environment path', '.env')

src/helpers/read-package-json.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)