Skip to content

Commit fed7681

Browse files
authored
fix(cli): report package version from --version instead of hardcoded 1.0.0 (#320)
commander was wired to a literal '1.0.0' that predated the version scheme, so --version reported the wrong build. Read version from package.json via createRequire, matching the pattern in ec2-demo.mjs. Signed-off-by: Kyle Hounslow <kylhouns@amazon.com>
1 parent a380eb1 commit fed7681

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

aws/cli-installer/src/cli.mjs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import { Command } from 'commander';
2+
import { createRequire } from 'node:module';
23
import { DEFAULTS } from './config.mjs';
34

5+
const require = createRequire(import.meta.url);
6+
const { version: PKG_VERSION } = require('../package.json');
7+
48
/**
59
* Parse CLI arguments into a config object.
610
* Returns null when no flags were given (triggers interactive mode).
@@ -18,7 +22,7 @@ export function parseCli(argv) {
1822
'Create and manage your observability stack on AWS:\n' +
1923
'OpenSearch, Prometheus, IAM roles, and ingestion pipelines.'
2024
)
21-
.version('1.0.0');
25+
.version(PKG_VERSION);
2226

2327
// Mode
2428
program

0 commit comments

Comments
 (0)