From 4fa5b7d133e7c42c32c09fd1b007c49f2a41ef72 Mon Sep 17 00:00:00 2001 From: Lovepreet Singh Date: Thu, 17 Nov 2022 09:12:53 +0000 Subject: [PATCH] Fix lint issues --- packages/cache/__tests__/tar.test.ts | 3 +-- packages/cache/src/internal/constants.ts | 2 +- packages/cache/src/internal/tar.ts | 27 ++++++++++++------------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/cache/__tests__/tar.test.ts b/packages/cache/__tests__/tar.test.ts index ec214181..abf8eecb 100644 --- a/packages/cache/__tests__/tar.test.ts +++ b/packages/cache/__tests__/tar.test.ts @@ -196,7 +196,7 @@ test('gzip create tar', async () => { 'manifest.txt', '-z', '-cf', - IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip, + IS_WINDOWS ? CacheFilename.Gzip.replace(/\\/g, '/') : CacheFilename.Gzip ] .concat(IS_WINDOWS ? ['--force-local'] : []) .concat(IS_MAC ? ['--delay-directory-restore'] : []), @@ -281,4 +281,3 @@ test('gzip list tar', async () => { {cwd: undefined} ) }) - diff --git a/packages/cache/src/internal/constants.ts b/packages/cache/src/internal/constants.ts index 0acea2ef..c6d8a490 100644 --- a/packages/cache/src/internal/constants.ts +++ b/packages/cache/src/internal/constants.ts @@ -25,4 +25,4 @@ export const SocketTimeout = 5000 // The default path of GNUtar on hosted Windows runners export const GnuTarPathOnWindows = `${process.env['PROGRAMFILES']}\\Git\\usr\\bin\\tar.exe` -export const SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe` \ No newline at end of file +export const SystemTarPathOnWindows = `${process.env['SYSTEMDRIVE']}\\Windows\\System32\\tar.exe` diff --git a/packages/cache/src/internal/tar.ts b/packages/cache/src/internal/tar.ts index 450cde3b..182bc7bb 100644 --- a/packages/cache/src/internal/tar.ts +++ b/packages/cache/src/internal/tar.ts @@ -3,7 +3,7 @@ import * as io from '@actions/io' import {existsSync, writeFileSync} from 'fs' import * as path from 'path' import * as utils from './cacheUtils' -import {CompressionMethod, GnuTarPathOnWindows, SystemTarPathOnWindows} from './constants' +import {CompressionMethod, SystemTarPathOnWindows} from './constants' const IS_WINDOWS = process.platform === 'win32' @@ -16,7 +16,7 @@ async function getTarPath(args: string[]): Promise { if (gnuTar) { // Use GNUtar as default on windows if (args.length > 0) { - args.push('--force-local') + args.push('--force-local') } return gnuTar } else if (existsSync(systemTar)) { @@ -54,7 +54,9 @@ function getWorkingDirectory(): string { } // Common function for extractTar and listTar to get the compression method -async function getCompressionProgram(compressionMethod: CompressionMethod): Promise { +async function getCompressionProgram( + compressionMethod: CompressionMethod +): Promise { // -d: Decompress. // unzstd is equivalent to 'zstd -d' // --long=#: Enables long distance matching with # bits. Maximum is 30 (1GB) on 32-bit OS and 31 (2GB) on 64-bit. @@ -68,7 +70,7 @@ async function getCompressionProgram(compressionMethod: CompressionMethod): Prom } return [ '--use-compress-program', - IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30', + IS_WINDOWS ? 'zstd -d --long=30' : 'unzstd --long=30' ] case CompressionMethod.ZstdWithoutLong: if (BSD_TAR_ZSTD) { @@ -136,9 +138,7 @@ export async function createTar( switch (compressionMethod) { case CompressionMethod.Zstd: if (BSD_TAR_ZSTD) { - return [ - '-O', '|', 'zstd -T0 --long=30 -o' - ] + return ['-O', '|', 'zstd -T0 --long=30 -o'] } return [ '--use-compress-program', @@ -147,11 +147,13 @@ export async function createTar( ] case CompressionMethod.ZstdWithoutLong: if (BSD_TAR_ZSTD) { - return [ - '-O', '|', 'zstd -T0 -o' - ] + return ['-O', '|', 'zstd -T0 -o'] } - return ['--use-compress-program', IS_WINDOWS ? 'zstd -T0' : 'zstdmt', '-cf'] + return [ + '--use-compress-program', + IS_WINDOWS ? 'zstd -T0' : 'zstdmt', + '-cf' + ] default: return ['-z', '-cf'] } @@ -166,8 +168,7 @@ export async function createTar( '--files-from', manifestFilename, ...(await getCompressionProgram()), - cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/'), - + cacheFileName.replace(new RegExp(`\\${path.sep}`, 'g'), '/') ] await execTar(args, archiveFolder) }