Skip to content

Commit

Permalink
CLI version flag (#1894)
Browse files Browse the repository at this point in the history
* add cli version flag

* Create funny-bugs-camp.md

---------

Co-authored-by: Brooke Scarlett Yalof <[email protected]>
  • Loading branch information
TheSonOfThomp and bruugey authored Aug 4, 2023
1 parent 1629efe commit 6a1495f
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/funny-bugs-camp.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-tools/cli': patch
---

Adds CLI version flag
3 changes: 2 additions & 1 deletion tools/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@lg-tools/test": "0.2.1",
"@lg-tools/update": "0.1.1",
"@lg-tools/validate": "0.1.1",
"commander": "^11.0.0"
"commander": "^11.0.0",
"read-pkg-up": "7.0.1"
}
}
4 changes: 4 additions & 0 deletions tools/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,13 @@ import { test } from '@lg-tools/test';
import { update } from '@lg-tools/update';
import { validate } from '@lg-tools/validate';
import { Command } from 'commander';
import { sync as readPackageUpSync } from 'read-pkg-up';

const pkg = readPackageUpSync({ cwd: __dirname })?.packageJson;

const cli = new Command('lg');
cli
.version(pkg?.version ?? '0.0.0')
.description('Command line tools for the LeafyGreen UI library by MongoDB')
.enablePositionalOptions(true);

Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13865,7 +13865,7 @@ react@^17.0.2:
loose-envify "^1.1.0"
object-assign "^4.1.1"

read-pkg-up@^7.0.1:
read-pkg-up@7.0.1, read-pkg-up@^7.0.1:
version "7.0.1"
resolved "https://registry.yarnpkg.com/read-pkg-up/-/read-pkg-up-7.0.1.tgz#f3a6135758459733ae2b95638056e1854e7ef507"
integrity sha512-zK0TB7Xd6JpCLmlLmufqykGE+/TlOePD6qKClNW7hHDKFh/J7/7gCWGR7joEQEW1bKq3a3yUZSObOoWLFQ4ohg==
Expand Down

0 comments on commit 6a1495f

Please sign in to comment.