Skip to content

Commit

Permalink
Merge pull request #10 from Yuriuh/fix-spelling
Browse files Browse the repository at this point in the history
fix: typo
  • Loading branch information
sudongyuer authored Aug 1, 2022
2 parents e01b69d + 4da2127 commit 9466797
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-boxes-complain.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"easy-tinypng-cli": patch
---

typo fix
12 changes: 6 additions & 6 deletions packages/easy-tinypng-cli/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export async function isRecord(pathDir: string) {

export async function record(pathDir: string) {
const isExist = await isFileExist(RecordFilePath)
const fileName = getFIleName(pathDir)
const fileName = getFileName(pathDir)
if (isExist) {
const json: Object = fse.readJSONSync(RecordFilePath)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -91,7 +91,7 @@ export async function record(pathDir: string) {
export async function removeRecord(pathDir: string) {
const RecordFilePath = path.resolve(cwd(), 'record.json')
const isExist = await isFileExist(RecordFilePath)
const fileName = getFIleName(pathDir)
const fileName = getFileName(pathDir)
if (isExist) {
const json: Object = fse.readJSONSync(RecordFilePath)
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand All @@ -101,7 +101,7 @@ export async function removeRecord(pathDir: string) {
}
}

export function getFIleName(pathDir: string) {
export function getFileName(pathDir: string) {
return path.basename(pathDir)
}

Expand All @@ -110,7 +110,7 @@ export function getExtName(pathDir: string) {
}

export function autoRecord(action: 'add' | 'unlink' | 'change', pathDir: string) {
if (!isImageFIle(pathDir))
if (!isImageFile(pathDir))
return

if (action === 'add')
Expand All @@ -120,7 +120,7 @@ export function autoRecord(action: 'add' | 'unlink' | 'change', pathDir: string)
removeRecord(pathDir)
}

export function isImageFIle(pathDir: string) {
export function isImageFile(pathDir: string) {
const fileExtname = getExtName(pathDir)
const supportFiles = ['webp', 'jpeg', 'png']
return supportFiles.includes(fileExtname)
Expand All @@ -131,7 +131,7 @@ export async function reduceImage(fileDir: string, targetDir: string) {
if (recorded)
return

if (!isImageFIle(fileDir))
if (!isImageFile(fileDir))
return
const spinner = ora('Loading').start()
try {
Expand Down

0 comments on commit 9466797

Please sign in to comment.