Skip to content

Commit

Permalink
fix: Filter out sub-directory paths (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
bryantbiggs authored Nov 13, 2022
1 parent 84ce386 commit 4e17e62
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/index.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/search.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import * as findInFiles from 'find-in-files';

const regExprRequiredVersion = /(?<=(required_version.=.)).*/;
const regExprFilename = /^(versions|providers).tf$/;
const regExprSubDirectory = /(wrappers|examples|modules)/;

export async function versionConstraintSearch(dir: string): Promise<string> {
const files = await findInFiles.find('required_versions*s*', dir, '.tf$');
const key = Object.keys(files).filter(word => !regExprFilename.test(word))[0];
const key = Object.keys(files).filter(word => !regExprSubDirectory.test(word))[0];
const line = files[key].line;

if (line) {
Expand Down

0 comments on commit 4e17e62

Please sign in to comment.