diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 3eafc6dc6b..08f14d3c00 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -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');