UNPKG

@applicaster/zapplicaster-cli

Version:

CLI Tool for the zapp app and Quick Brick project

55 lines (41 loc) 1.17 kB
const { readdirAsync } = require("../../../file"); const logger = require("../../../logger"); const { existsSync } = require("fs"); const podspecSuffix = ".podspec.json"; async function getIosModuleName({ pluginPath }) { logger.log({ pluginPath }); const filePodspec = await getPodspecFile({ pluginAppleFolder: `${pluginPath}/apple`, }); if (filePodspec) { return filePodspec.replace(podspecSuffix, ""); } return null; } async function getPodspecFile({ pluginAppleFolder }) { if (existsSync(pluginAppleFolder)) { const files = await readdirAsync(pluginAppleFolder); for (const i in files) { const currentPath = files[i]; if (currentPath && currentPath.endsWith(podspecSuffix)) { return currentPath; } } } return null; } async function getPodspecFilePath({ pluginAppleFolder }) { const fileName = await getPodspecFile({ pluginAppleFolder }); if (fileName && fileName.endsWith(podspecSuffix)) { return `${pluginAppleFolder}/${fileName}`; } } function abort(message) { console.log(message); process.exit(1); } module.exports = { abort, getPodspecFilePath, getIosModuleName, };