Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Add ignoreFilePatters option
Browse files Browse the repository at this point in the history
  • Loading branch information
mydea committed Aug 24, 2023
1 parent c4b0bd9 commit a6801ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ You can run `npx @sentry/migr8 --help` to get a list of available options.

- `--filePatterns`: Glob pattern(s) which files should be transformed. Defaults to
`**/*.{js,jsx,ts,tsx,mjs,cjs,mts,.vue,.svele}`
- `--ignoreFilePatterns`: Glob pattern(s) which files should be ignored. This overwrites files matched by
`--filePatterns`.
- `--debug`: Enable verbose logging
- `--sdk`: We try to detect the used Sentry SDK package, e.g. `@sentry/browser`. You can overwrite this and provide the
SDK package you're using.
Expand Down
7 changes: 7 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ async function _run() {
type: 'string',
array: true,
})
.option('ignoreFilePatterns', {
alias: 'if',
describe: 'Glob pattern which files should be ignored',
default: [],
type: 'string',
array: true,
})
.option('debug', {
default: false,
describe: 'Enable verbose logging',
Expand Down
4 changes: 3 additions & 1 deletion src/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,10 @@ ${options.filePatterns.join('\n')}
(You can change this by specifying the --filePatterns option)`);

const cwd = options.cwd ?? process.cwd();
const ignore =
options.ignoreFilePatterns && options.ignoreFilePatterns.length > 0 ? options.ignoreFilePatterns : undefined;

const files = (await globby(options.filePatterns, { cwd, gitignore: true })).map(relativePath =>
const files = (await globby(options.filePatterns, { cwd, gitignore: true, ignore })).map(relativePath =>
path.resolve(relativePath)
);

Expand Down
1 change: 1 addition & 0 deletions src/types/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export interface RunOptions {
filePatterns: string[];
ignoreFilePatterns: string[];
debug?: boolean;
skipGitChecks?: boolean;
dry?: boolean;
Expand Down

0 comments on commit a6801ac

Please sign in to comment.