Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature: add support for ignoring filepaths via micromatch globs #28

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: JS - Unit Tests

on: push

jobs:

run-tests:
name: Unit Tests
runs-on: ubuntu-latest

steps:
- name: Check out Git repository
uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: 14

- name: Install dependencies with caching
uses: bahmutov/npm-install@v1

- name: Check types
run: |
yarn run typecheck
- name: Run unit tests
run: |
yarn run test
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
node_modules
node_modules
Empty file added .npmignore
Empty file.
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,33 @@ Default: diagram.svg

## `excluded_paths`

A list of paths to exclude from the diagram, separated by commas.
A list of paths to folders to exclude from the diagram, separated by commas.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this also worked for paths but only if they were immediate children of root_dir (this is why package.json worked, but src/package.json did not. Rather than explain this nuance, I think it'll be simpler to just only use this config for folders, and nudge people towards mostly using globs instead.


For example: dist,node_modules

Default: node_modules,bower_components,dist,out,build,eject,.next,.netlify,.yarn,.vscode,package-lock.json,yarn.lock

## `excluded_globs`

A semicolon-delimited array of file [globs](https://globster.xyz/) to exclude from the diagram, using [micromatch](https://github.com/micromatch/micromatch) syntax. Provided as an array.

For example:

```yaml
excluded_globs: 'frontend/*.spec.js;**/*.{png,jpg};**/!(*.module).ts'
# Guide:
# - 'frontend/*.spec.js' # exclude frontend tests
# - '**/*.{png,ico,md}' # all png, ico, md files in any directory
# - '**/!(*.module).ts' # all TS files except module files
```

## `root_path`

The directory (and its children) that you want to visualize in the diagram.
The directory (and its children) that you want to visualize in the diagram, relative to the repository root.

For example: `./src/`
For example: `src/`

Default: `./`
Default: `''` (current directory)

## `max_depth`

Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ inputs:
excluded_paths:
description: "A list of paths to exclude from the diagram, separated by commas. For example: dist,node_modules"
required: false
excluded_globs:
description: "A list of micromatch globs to exclude from the diagram, separated by semicolons. For example: **/*.png;docs/**/*.{png,ico}"
required: false
root_path:
description: "The directory (and its children) that you want to visualize in the diagram. Default: ./"
description: 'The directory (and its children) that you want to visualize in the diagram. Default: "" (repository root directory)'
required: false
max_depth:
description: "The maximum number of nested folders to show files within. Default: 9"
Expand Down
Loading