diff --git a/lib/util/fs/index.ts b/lib/util/fs/index.ts index 68c16d04e180a6b57f43a5ebddf71bc73685bdd6..b0c41376fac38acce3b8bdb725b9d97d77e86f58 100644 --- a/lib/util/fs/index.ts +++ b/lib/util/fs/index.ts @@ -29,7 +29,7 @@ export async function readLocalFile( ): Promise<string | null>; export async function readLocalFile( fileName: string, - encoding?: string + encoding?: BufferEncoding ): Promise<string | Buffer | null> { const localFileName = ensureLocalPath(fileName); try { @@ -263,13 +263,16 @@ export async function readCacheFile( ): Promise<string>; export function readCacheFile( fileName: string, - encoding?: string + encoding?: BufferEncoding ): Promise<string | Buffer> { const fullPath = ensureCachePath(fileName); return encoding ? fs.readFile(fullPath, encoding) : fs.readFile(fullPath); } -export function outputCacheFile(file: string, data: unknown): Promise<void> { +export function outputCacheFile( + file: string, + data: string | NodeJS.ArrayBufferView +): Promise<void> { const filePath = ensureCachePath(file); return fs.outputFile(filePath, data); } @@ -281,7 +284,7 @@ export async function readSystemFile( ): Promise<string>; export function readSystemFile( fileName: string, - encoding?: string + encoding?: BufferEncoding ): Promise<string | Buffer> { return encoding ? fs.readFile(fileName, encoding) : fs.readFile(fileName); } diff --git a/lib/util/git/private-key.ts b/lib/util/git/private-key.ts index 06a15b407c4df415ff315a3b795a72c155e320e5..64cd923b21dff674a2b8e193c21bec992be28b4c 100644 --- a/lib/util/git/private-key.ts +++ b/lib/util/git/private-key.ts @@ -25,7 +25,7 @@ async function importKey(): Promise<void> { return; } const keyFileName = upath.join(os.tmpdir() + '/git-private.key'); - await fs.outputFile(keyFileName, gitPrivateKey); + await fs.outputFile(keyFileName, gitPrivateKey!); const { stdout, stderr } = await exec(`gpg --import ${keyFileName}`); logger.debug({ stdout, stderr }, 'Private key import result'); keyId = `${stdout}${stderr}` diff --git a/package.json b/package.json index c7e0811ba76a442222b2815d2b379747759acc43..198879ab849f6ce264cd84152f5fe5deafda91a6 100644 --- a/package.json +++ b/package.json @@ -260,7 +260,7 @@ "@types/conventional-commits-detector": "1.0.0", "@types/diff": "5.0.2", "@types/eslint": "8.4.10", - "@types/fs-extra": "9.0.13", + "@types/fs-extra": "11.0.1", "@types/git-url-parse": "9.0.1", "@types/github-url-from-git": "1.5.1", "@types/global-agent": "2.1.1", diff --git a/yarn.lock b/yarn.lock index cdd41e6689a714f1b82c971514fdc03a2d7466b2..5f26060241ce2ddfd545c9c3b3991a4bb7c75e9d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2893,11 +2893,12 @@ resolved "https://registry.yarnpkg.com/@types/estree/-/estree-1.0.0.tgz#5fb2e536c1ae9bf35366eed879e827fa59ca41c2" integrity sha512-WulqXMDUTYAXCjZnk6JtIHPigp55cVtDgDrO2gHRwhyJto21+1zbVCtOYB2L1F9w4qCQ0rOGWBnBe0FNTiEJIQ== -"@types/fs-extra@9.0.13": - version "9.0.13" - resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-9.0.13.tgz#7594fbae04fe7f1918ce8b3d213f74ff44ac1f45" - integrity sha512-nEnwB++1u5lVDM2UI4c1+5R+FYaKfaAzS4OococimjVm3nQw3TuzH5UNsocrcTBbhnerblyHj4A49qXbIiZdpA== +"@types/fs-extra@11.0.1": + version "11.0.1" + resolved "https://registry.yarnpkg.com/@types/fs-extra/-/fs-extra-11.0.1.tgz#f542ec47810532a8a252127e6e105f487e0a6ea5" + integrity sha512-MxObHvNl4A69ofaTRU8DFqvgzzv8s9yRtaPPm5gud9HDNvpB3GPQFvNuTWAI59B9huVGV5jXYJwbCsmBsOGYWA== dependencies: + "@types/jsonfile" "*" "@types/node" "*" "@types/git-url-parse@9.0.1": @@ -2979,6 +2980,13 @@ resolved "https://registry.yarnpkg.com/@types/json5/-/json5-0.0.29.tgz#ee28707ae94e11d2b827bcbe5270bcea7f3e71ee" integrity sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ== +"@types/jsonfile@*": + version "6.1.1" + resolved "https://registry.yarnpkg.com/@types/jsonfile/-/jsonfile-6.1.1.tgz#ac84e9aefa74a2425a0fb3012bdea44f58970f1b" + integrity sha512-GSgiRCVeapDN+3pqA35IkQwasaCh/0YFH5dEF6S88iDvEn901DjOeH3/QPY+XYP1DFzDZPvIvfeEgk+7br5png== + dependencies: + "@types/node" "*" + "@types/keyv@^3.1.4": version "3.1.4" resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.4.tgz#3ccdb1c6751b0c7e52300bcdacd5bcbf8faa75b6"