Skip to content

Commit

Permalink
♻️ chore(core): Rename overrideFile flag in unzipArchive (#913)
Browse files Browse the repository at this point in the history
  • Loading branch information
duckception authored Oct 4, 2023
1 parent 6f40dee commit 605f8b8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/unzipArchive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import unzippper from 'unzipper'

type UnzipArchiveOptions = {
archivePath: string
overrideFile?: boolean
overwrite?: boolean
}

type UnzipArchiveResult = {
Expand All @@ -13,14 +13,14 @@ type UnzipArchiveResult = {
}

export async function unzipArchive(options: UnzipArchiveOptions) {
const { archivePath, overrideFile } = options
const { archivePath, overwrite } = options

const resultPromise = new Promise<UnzipArchiveResult>((resolve, reject) => {
const archiveFileExtension = archivePath.split('.').slice(-1)
const outputPath = archivePath.replace(`.${archiveFileExtension}`, '')

const fileExists = fs.existsSync(outputPath)
if (fileExists && !overrideFile) {
if (fileExists && !overwrite) {
resolve({
outputPath,
unzipSkipped: true
Expand Down
4 changes: 2 additions & 2 deletions packages/core/test/unzipArchive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,12 @@ describe('unzipArchive', () => {
expect(createReadStreamSpy).not.toHaveBeenCalled()
})

it('overwrites the output directory if the `overrideFile` flag is present', async () => {
it('overwrites the output directory if the `overwrite` flag is present', async () => {
createTestZipArchive(ARCHIVE_PATH)

const result = await unzipArchive({
archivePath: ARCHIVE_PATH,
overrideFile: true
overwrite: true
})

expect(result).toStrictEqual({
Expand Down

0 comments on commit 605f8b8

Please sign in to comment.