(config: Config, name: string)
| 61 | } |
| 62 | |
| 63 | export async function resolvePlugin(config: Config, name: string): Promise<Plugin | null> { |
| 64 | try { |
| 65 | const packagePath = resolveNode(config.app.rootDir, name, 'package.json'); |
| 66 | if (!packagePath) { |
| 67 | fatal(`Unable to find ${c.strong(`node_modules/${name}`)}.\n` + `Are you sure ${c.strong(name)} is installed?`); |
| 68 | } |
| 69 | |
| 70 | const rootPath = dirname(packagePath); |
| 71 | const meta = await readJSON(packagePath); |
| 72 | if (!meta) { |
| 73 | return null; |
| 74 | } |
| 75 | if (meta.capacitor) { |
| 76 | return { |
| 77 | id: name, |
| 78 | name: fixName(name), |
| 79 | version: meta.version, |
| 80 | rootPath, |
| 81 | repository: meta.repository, |
| 82 | manifest: meta.capacitor, |
| 83 | }; |
| 84 | } |
| 85 | const pluginXMLPath = join(rootPath, 'plugin.xml'); |
| 86 | const xmlMeta = await readXML(pluginXMLPath); |
| 87 | return { |
| 88 | id: name, |
| 89 | name: fixName(name), |
| 90 | version: meta.version, |
| 91 | rootPath: rootPath, |
| 92 | repository: meta.repository, |
| 93 | xml: xmlMeta.plugin, |
| 94 | }; |
| 95 | } catch (e) { |
| 96 | // ignore |
| 97 | } |
| 98 | return null; |
| 99 | } |
| 100 | |
| 101 | export function getDependencies(config: Config): string[] { |
| 102 | return [ |
no test coverage detected