Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Sep 4, 2024
1 parent b1bef51 commit 86adbc2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,21 @@ async function findByExtension(dir: string, ext: string): Promise<string[]> {
return matchedFiles
}

async function findPathPlugin(): Promise<{ iosPath: string; androidPath: string }> {
async function findPathPlugin(): Promise<{ iosPath: string, androidPath: string }> {
// iOS path
let iosPath = ''
const oldIosDir = './ios/Plugin'
const newIosDir = './ios/Sources'

if (existsSync(oldIosDir)) {
const files = await findByExtension(oldIosDir, 'm')
if (!files || !files[0]) {
throw new Error('File ending by .m not found in ios/Plugin, cannot guess your plugin name')
}
const fileName = files[0]
iosPath = join(oldIosDir, `${fileName}.swift`)
} else if (existsSync(newIosDir)) {
}
else if (existsSync(newIosDir)) {
const pluginDirs = await readdir(newIosDir)
const pluginDir = pluginDirs.find(dir => dir.toLowerCase().includes('plugin'))
if (!pluginDir) {
Expand All @@ -50,7 +51,8 @@ async function findPathPlugin(): Promise<{ iosPath: string; androidPath: string
}
const pluginFile = swiftFiles.find(file => file.toLowerCase().endsWith('plugin')) || swiftFiles[0]
iosPath = join(fullPluginDir, `${pluginFile}.swift`)
} else {
}
else {
throw new Error('iOS plugin directory not found')
}

Expand Down

0 comments on commit 86adbc2

Please sign in to comment.