Skip to content

Commit

Permalink
refactor: remove PackageUpdateResult
Browse files Browse the repository at this point in the history
  • Loading branch information
rarkins committed Apr 13, 2020
1 parent 6446ea9 commit 2c8a63a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 16 deletions.
16 changes: 4 additions & 12 deletions lib/manager/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,6 @@ export interface PackageUpdateConfig {
supportPolicy?: string[];
}

export interface PackageUpdateResult {
newValue: string;
newMajor: number;
isRange: boolean;
sourceUrl: string;
}

export interface RangeConfig<T = Record<string, any>> extends ManagerData<T> {
composerJsonType?: 'composer-plugin' | 'library' | 'metapackage' | 'project';
currentValue?: string;
Expand Down Expand Up @@ -158,7 +151,8 @@ export interface LookupUpdate {
newVersion?: string;
semanticCommitType?: string;
toVersion?: string;
updateType: UpdateType;
updateType?: UpdateType;
sourceUrl?: string;
}

export interface PackageDependency<T = Record<string, any>> extends Package<T> {
Expand All @@ -178,7 +172,7 @@ export interface PackageDependency<T = Record<string, any>> extends Package<T> {
skipReason?: SkipReason;
sourceLine?: number;
toVersion?: string;
updates?: PackageUpdateResult[];
updates?: LookupUpdate[];
versionLine?: number;
autoReplaceData?: AutoReplaceData;
}
Expand Down Expand Up @@ -246,9 +240,7 @@ export interface ManagerApi {
config?: ExtractConfig
): Result<PackageFile | null>;

getPackageUpdates?(
config: PackageUpdateConfig
): Result<PackageUpdateResult[]>;
getPackageUpdates?(config: PackageUpdateConfig): Result<LookupUpdate[]>;

getRangeStrategy?(config: RangeConfig): RangeStrategy;

Expand Down
4 changes: 2 additions & 2 deletions lib/manager/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
PackageUpdateConfig,
RangeConfig,
Result,
PackageUpdateResult,
LookupUpdate,
} from './common';
import { RangeStrategy } from '../types';
import {
Expand Down Expand Up @@ -66,7 +66,7 @@ export function extractAllPackageFiles(
export function getPackageUpdates(
manager: string,
config: PackageUpdateConfig
): Result<PackageUpdateResult[]> | null {
): Result<LookupUpdate[]> | null {
if (!managers.has(manager)) {
return null;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/manager/travis/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { isEqual } from 'lodash';
import { logger } from '../../logger';
import { getPkgReleases } from '../../datasource';
import { isVersion, maxSatisfyingVersion } from '../../versioning/semver';
import { PackageUpdateConfig, PackageUpdateResult } from '../common';
import { PackageUpdateConfig, LookupUpdate } from '../common';
import * as datasourceGithubTags from '../../datasource/github-tags';
import { resolveFile } from '../../util';

Expand Down Expand Up @@ -86,7 +86,7 @@ async function checkPolicies(): Promise<void> {

export async function getPackageUpdates(
config: PackageUpdateConfig
): Promise<PackageUpdateResult[]> {
): Promise<LookupUpdate[]> {
logger.trace('travis.getPackageUpdates()');
const { supportPolicy } = config;
if (!(supportPolicy && supportPolicy.length)) {
Expand Down

0 comments on commit 2c8a63a

Please sign in to comment.