Skip to content

Commit

Permalink
fix: remove colons from depNameSanitized (#33672)
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins authored Jan 17, 2025
1 parent 6964458 commit 3e74602
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/workers/repository/updates/flatten.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import is from '@sindresorhus/is';
import type { RenovateConfig } from '../../../../test/util';
import { getConfig } from '../../../config/defaults';
import { flattenUpdates } from './flatten';
import { flattenUpdates, sanitizeDepName } from './flatten';

jest.mock('../../../util/git/semantic');

Expand All @@ -14,6 +14,14 @@ beforeEach(() => {
});

describe('workers/repository/updates/flatten', () => {
describe('sanitizeDepName()', () => {
it('sanitizes urls', () => {
expect(sanitizeDepName('https://some.host.name/a/path/to.git')).toBe(
'https-some.host.name-a-path-to.git',
);
});
});

describe('flattenUpdates()', () => {
it('flattens', async () => {
// TODO #22198
Expand Down
3 changes: 2 additions & 1 deletion lib/workers/repository/updates/flatten.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ import { generateBranchName } from './branch-name';
const upper = (str: string): string =>
str.charAt(0).toUpperCase() + str.substring(1);

function sanitizeDepName(depName: string): string {
export function sanitizeDepName(depName: string): string {
return depName
.replace('@types/', '')
.replace('@', '')
.replace(regEx(/\//g), '-')
.replace(regEx(/\s+/g), '-')
.replace(regEx(/:/g), '-')
.replace(regEx(/-+/), '-')
.toLowerCase();
}
Expand Down

0 comments on commit 3e74602

Please sign in to comment.