Skip to content

Commit

Permalink
refactor: use better regex for tag matching
Browse files Browse the repository at this point in the history
  • Loading branch information
rainerhahnekamp committed Oct 5, 2024
1 parent e1024a7 commit 447b823
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/lib/modules/internal/flatten-tagging.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { TagConfig } from '../../config/tag-config';
import { PLACE_HOLDER_REGEX } from "../../tags/calc-tags-for-module";

export function flattenTagging(tagging: TagConfig, prefix = ''): string[] {
let flattened: string[] = [];
for (const [rawPath, value] of Object.entries(tagging)) {
const path = rawPath.replace(/<[^>]+>/g, '*');
const path = rawPath.replace(PLACE_HOLDER_REGEX, '*');
const fullPath = prefix ? `${prefix}/${path}` : path;
if (
typeof value === 'string' ||
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/lib/tags/calc-tags-for-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
TagWithoutValueError,
} from '../error/user-error';

const PLACE_HOLDER_REGEX = /<[a-zA-Z-_]+>/g;
export const PLACE_HOLDER_REGEX = /<[a-zA-Z-_]+>/g;

export const calcTagsForModule = (
moduleDir: FsPath,
Expand Down

0 comments on commit 447b823

Please sign in to comment.