Files
renovate/lib/modules/manager/swift/index.ts
Bartosz Dolewski 5cec680633 feat(swift): update Package.resolved when updating Package.swift (#41534)
* feat(swift): update Package.resolved when updating Package.swift

Add artifact support to the Swift Package Manager module so that
Package.resolved lockfiles are updated alongside Package.swift manifest
changes. Uses direct JSON modification (targeted regex replacement of
version and revision within each pin block) instead of requiring the
Swift toolchain, avoiding the need for a macOS runner or private repo
authentication.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix(swift): achieve 100% coverage for artifacts.ts

Add tests for missing datasource/packageName, missing pins array, and
getDigest exceptions. Mark three unreachable defensive guards with
istanbul ignore (valid JSON always has matching braces and identities).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* refactor(swift): address review feedback from viceice

- Inline test fixtures instead of using fixture files
- Remove unnecessary beforeEach/resetAllMocks
- Use PackageDependency and Upgrade types instead of inline type literals
- Add Zod schema for safe Package.resolved parsing
- Move PackageResolvedPin/PackageResolvedJson types to schema.ts
- Delete fixture files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 17:01:54 +00:00

26 lines
929 B
TypeScript

import type { Category } from '../../../constants/index.ts';
import { GitTagsDatasource } from '../../datasource/git-tags/index.ts';
import { GithubTagsDatasource } from '../../datasource/github-tags/index.ts';
import { GitlabTagsDatasource } from '../../datasource/gitlab-tags/index.ts';
import * as swiftVersioning from '../../versioning/swift/index.ts';
export { updateArtifacts } from './artifacts.ts';
export { extractPackageFile } from './extract.ts';
export { getRangeStrategy } from './range.ts';
export const displayName = 'Swift Package Manager';
export const url = 'https://www.swift.org/package-manager';
export const categories: Category[] = ['swift'];
export const defaultConfig = {
managerFilePatterns: ['/(^|/)Package\\.swift/'],
versioning: swiftVersioning.id,
pinDigests: false,
};
export const supportedDatasources = [
GitTagsDatasource.id,
GithubTagsDatasource.id,
GitlabTagsDatasource.id,
];