Skip to content

Commit aec359c

Browse files
committed
feat: added package json cwd option to cli usage
1 parent 9183f81 commit aec359c

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

scripts/pkg-usage.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#!/usr/bin/env node
22

33
// const { getPackagesUsages } = require('pkg-usage');
4-
const { Command } = require('commander');
54
const { getPackagesUsages } = require('../dist/src');
5+
const { Command } = require('commander');
66

77
const program = new Command();
88

@@ -20,10 +20,15 @@ program
2020
'-f, --file-globs <value>',
2121
'Files to analyze based on file globs ex: -f "**/*.(ts|tsx)" or --file-globs="**/*.(js|jsx)"'
2222
)
23-
.action(({ packages, fileGlobs }) => {
23+
.option(
24+
'-cwd, --package-json-CWD <value>',
25+
'Directory to start from ex: -cwd "/path/to/start/from"'
26+
)
27+
.action(({ packages, fileGlobs, packageJsonCWD }) => {
2428
const usages = getPackagesUsages({
2529
packages,
2630
fileGlobs,
31+
packageJsonCWD,
2732
});
2833

2934
console.log(JSON.stringify(usages, undefined, 2));

0 commit comments

Comments
 (0)