cli: make package.json reading absolute

This commit is contained in:
Patrik Oldsberg
2020-04-01 11:21:01 +02:00
parent 111f163d41
commit d21d38e947
+4 -1
View File
@@ -17,6 +17,7 @@
import program from 'commander';
import chalk from 'chalk';
import fs from 'fs';
import { resolve as resolvePath } from 'path';
import createAppCommand from './commands/create-app/createApp';
import createPluginCommand from './commands/create-plugin/createPlugin';
import watch from './commands/watch-deps';
@@ -29,7 +30,9 @@ import pluginServe from './commands/plugin/serve';
import { exitWithError } from './helpers/errors';
const main = (argv: string[]) => {
const packageJson = JSON.parse(fs.readFileSync('package.json', 'utf-8'));
const packageJson = JSON.parse(
fs.readFileSync(resolvePath(__dirname, '../package.json'), 'utf-8'),
);
program.name('backstage-cli').version(packageJson.version ?? '0.0.0');