@zeroheight/adoption-cli 2.2.3 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Release notes
2
2
 
3
+ ## [2.3.0](https://www.npmjs.com/package/@zeroheight/adoption-cli/v/2.3.0) - 5th December 2024
4
+
5
+ - The `analyze` command now ignores `*.d.ts` files by default, alongside `*.test.*` and `*.spec.*` files.
6
+ - `analyze --ignore` now accepts a list of patterns to ignore using a comma seperated list e.g. `analyze --ignore "**/*.{test,spec}.*,**/*.d.ts"`
7
+
3
8
  ## [2.2.3](https://www.npmjs.com/package/@zeroheight/adoption-cli/v/2.2.3) - 28th November 2024
4
9
 
5
10
  - Update README to explain new CLI options
package/dist/cli.js CHANGED
@@ -13,7 +13,7 @@ const { output, cleanup } = render(React.createElement(HelpInfo, null));
13
13
  program
14
14
  .name("zh-adoption")
15
15
  .description("CLI for measuring design system usage usage in your products")
16
- .version("2.2.3")
16
+ .version("2.3.0")
17
17
  .addHelpText("before", output)
18
18
  .option("--log-file <path>", "Path to write logs to, if not provided logs only error logs will be written to stderr")
19
19
  .addOption(new Option("--log-level <level>", "The lowest level of logs to display")
@@ -23,7 +23,7 @@ export function analyzeCommand() {
23
23
  showGlobalOptions: true,
24
24
  })
25
25
  .addOption(new Option("-e, --extensions [ext]", "file extensions to include when searching for components").default("**/*.{js,jsx,ts,tsx}", "glob pattern to determine file extensions"))
26
- .addOption(new Option("-i, --ignore [ext]", "files to ignore when searching for components").default("**/*.{test,spec}.*", "glob pattern to determine ignored files"))
26
+ .addOption(new Option("-i, --ignore [ext]", "files to ignore when searching for components").default("**/*.{test,spec}.*,**/*.d.ts", "glob pattern to determine ignored files"))
27
27
  .addOption(new Option("-d, --dry-run", "don't push results to zeroheight").default(false))
28
28
  .addOption(new Option("-r, --repo-name <string>", "name of the repository"))
29
29
  .addOption(new Option("-in, --interactive [boolean]", "disable to skip input (useful when running in CI)")
@@ -15,7 +15,7 @@ export interface ComponentUsageRecord {
15
15
  * @param gitIgnore contents of .gitignore file
16
16
  * @returns list of file paths
17
17
  */
18
- export declare function findFiles(base: string, extensions: string, ignorePattern: string): Promise<string[]>;
18
+ export declare function findFiles(base: string, extensions: string, ignorePattern: string | boolean): Promise<string[]>;
19
19
  export declare function analyzeFiles(extensions: string, ignorePattern: string): Promise<{
20
20
  errorFile: string | null;
21
21
  usage: RawUsageMap;
@@ -16,6 +16,8 @@ import logger from "../common/logging.js";
16
16
  */
17
17
  export async function findFiles(base, extensions, ignorePattern) {
18
18
  const gitIgnore = await getGitIgnore(base);
19
+ // Split by comma if string exists otherwise it could be a boolean flag
20
+ const ignorePatternArray = typeof ignorePattern === "string" ? ignorePattern.split(",") : [];
19
21
  // typescript complains about the ignore() function having
20
22
  // no call signature. Could not find a way to fix this.
21
23
  // @ts-ignore
@@ -28,7 +30,11 @@ export async function findFiles(base, extensions, ignorePattern) {
28
30
  // add gitignore rules
29
31
  .add(gitIgnore);
30
32
  const matchingFiles = [];
31
- const g = new Glob(extensions, { cwd: base, ignore: ignorePattern, fs });
33
+ const g = new Glob(extensions, {
34
+ cwd: base,
35
+ ignore: ignorePatternArray,
36
+ fs,
37
+ });
32
38
  for await (const file of g) {
33
39
  const fullFilepath = path.join(base, file);
34
40
  const meta = await stat(fullFilepath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeroheight/adoption-cli",
3
- "version": "2.2.3",
3
+ "version": "2.3.0",
4
4
  "license": "ISC",
5
5
  "main": "dist/cli.js",
6
6
  "bin": {