Skip to content

Commit 136aaf6

Browse files
minor refactor
1 parent ce9f267 commit 136aaf6

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-5
lines changed

src/core/dependency-checker.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import chalk from 'chalk';
22

33
import { PatchPulseConfig, shouldSkipPackage } from '../services/config';
44
import { getLatestVersion } from '../services/npm';
5-
import { type DependencyInfo } from '../types';
5+
import { UpdateType, type DependencyInfo } from '../types';
66
import { ProgressSpinner } from '../ui/progress';
77
import { getUpdateType } from '../utils/getUpdateType';
88
import { isVersionOutdated } from '../utils/isVersionOutdated';
@@ -36,7 +36,7 @@ export async function checkDependencyVersions(
3636

3737
let latestVersion: string | undefined;
3838
let isOutdated = false;
39-
let updateType: 'patch' | 'minor' | 'major' | undefined;
39+
let updateType: UpdateType | undefined;
4040

4141
if (!isSkipped) {
4242
latestVersion = await getLatestVersion(packageName);

src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun';
22

3+
export type UpdateType = 'patch' | 'minor' | 'major';
4+
35
export interface PackageJson {
46
dependencies?: Record<string, string>;
57
devDependencies?: Record<string, string>;
@@ -13,7 +15,7 @@ export interface DependencyInfo {
1315
currentVersion: string;
1416
latestVersion?: string;
1517
isOutdated: boolean;
16-
updateType?: 'patch' | 'minor' | 'major';
18+
updateType?: UpdateType;
1719
isSkipped?: boolean;
1820
category?: string;
1921
}
@@ -26,7 +28,7 @@ export interface UpdateableDependency {
2628
packageName: string;
2729
currentVersion: string;
2830
latestVersion: string;
29-
updateType: 'patch' | 'minor' | 'major';
31+
updateType: UpdateType;
3032
category: string;
3133
}
3234

src/utils/getUpdateType.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import chalk from 'chalk';
2+
import { UpdateType } from '../types';
23
import { parseVersion } from './parseVersion';
34

45
interface GetUpdateTypeArgs {
@@ -19,7 +20,7 @@ interface GetUpdateTypeArgs {
1920
export function getUpdateType({
2021
current,
2122
latest,
22-
}: GetUpdateTypeArgs): 'patch' | 'minor' | 'major' {
23+
}: GetUpdateTypeArgs): UpdateType {
2324
try {
2425
const currentVersion = parseVersion(current);
2526
const latestVersion = parseVersion(latest);

0 commit comments

Comments
 (0)