From 40d16cff06723566ef75ae1b1c07d2b820398243 Mon Sep 17 00:00:00 2001 From: Livio Date: Fri, 28 Jun 2019 13:39:00 +0200 Subject: [PATCH] fix(disk): Use types from check-disk-space package --- Gulpfile.js | 1 - lib/health-indicators/disk/disk.health.ts | 9 ++------- .../disk/diskusage-lib.provider.ts | 7 ------- package.json | 2 +- tsconfig.json | 1 - types/check-disk-space.d.ts | 19 ------------------- 6 files changed, 3 insertions(+), 36 deletions(-) delete mode 100644 types/check-disk-space.d.ts diff --git a/Gulpfile.js b/Gulpfile.js index 81a0e030c..30f6dac56 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -25,7 +25,6 @@ const terminus = ts.createProject(join(__dirname, 'tsconfig.json')); /** * UTIL */ - function getFolders(dir) { return fs .readdirSync(dir) diff --git a/lib/health-indicators/disk/disk.health.ts b/lib/health-indicators/disk/disk.health.ts index b6a7c90c0..e3e7a5775 100644 --- a/lib/health-indicators/disk/disk.health.ts +++ b/lib/health-indicators/disk/disk.health.ts @@ -1,6 +1,6 @@ import { Injectable, Inject } from '@nestjs/common'; import { isNil } from '@nestjs/common/utils/shared.utils'; -import * as checkdiskspace from 'check-disk-space'; +import * as checkDiskSpace from 'check-disk-space'; import { HealthIndicatorResult } from '../../interfaces'; import { HealthIndicator } from '../health-indicator'; @@ -12,12 +12,7 @@ import { DiskOptionsWithThresholdPercent, } from './disk-health-options.type'; -/** - * The type of the check-disk-space library - * - * @internal - */ -type CheckDiskSpace = typeof checkdiskspace; +type CheckDiskSpace = typeof checkDiskSpace; /** * The DiskHealthIndicator contains checks which are related diff --git a/lib/health-indicators/disk/diskusage-lib.provider.ts b/lib/health-indicators/disk/diskusage-lib.provider.ts index 8485d7954..6520547d5 100644 --- a/lib/health-indicators/disk/diskusage-lib.provider.ts +++ b/lib/health-indicators/disk/diskusage-lib.provider.ts @@ -1,14 +1,7 @@ import { CHECKDISKSPACE_LIB } from '../../terminus.constants'; -// FIXME: Add typings to check-disk-space import * as checkdiskspace from 'check-disk-space'; -/** - * The type of the check-disc-space library - * - * @internal - */ -export type CheckDiskSpace = typeof checkdiskspace; /** * Wrapper of the check-disk-space library. * diff --git a/package.json b/package.json index 9d5c979ab..05884e58a 100644 --- a/package.json +++ b/package.json @@ -36,7 +36,7 @@ ] }, "dependencies": { - "check-disk-space": "^2.0.0", + "check-disk-space": "^2.1.0", "gulp": "^4.0.2", "gulp-clean": "^0.4.0", "gulp-typescript": "^5.0.1" diff --git a/tsconfig.json b/tsconfig.json index c463920e8..3919b12bf 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,6 @@ { "compilerOptions": { "baseUrl": ".", - "paths": { "*": ["types/*"] }, "module": "commonjs", "strict": true, "declaration": true, diff --git a/types/check-disk-space.d.ts b/types/check-disk-space.d.ts deleted file mode 100644 index 9f4044bee..000000000 --- a/types/check-disk-space.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { totalmem } from 'os'; - -export = index; -declare function index( - directoryPath: string, -): Promise<{ free: number; size: number }>; -declare namespace index { - class InvalidPathError { - constructor(message: any); - name: any; - message: any; - } - class NoMatchError { - constructor(message: any); - name: any; - message: any; - } - function getFirstExistingParentPath(directoryPath: any): any; -}