Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 1x 1x 1x 1x 1x 1x 1x | import { readJSON } from "fs-extra"; import glob from "glob"; import { join, dirname, relative } from "path"; import { promisify } from "util"; import { InstalledPluginData } from "./types"; import { pathToPosix } from "shared/lib/helpers/path"; const globAsync = promisify(glob); export const getPluginsInProject = async (projectPath: string) => { const projectRoot = dirname(projectPath); const pluginPaths = await globAsync(join(projectRoot, "**/plugin.json")); const plugins: InstalledPluginData[] = []; for (const pluginPath of pluginPaths) { try { const pluginJSON = await readJSON(pluginPath); Iif ("version" in pluginJSON && typeof pluginJSON.version === "string") { plugins.push({ path: pathToPosix(relative(join(projectRoot, "plugins"), pluginPath)), version: pluginJSON.version, }); } } catch (e) { console.error("Error: Unable to parse " + pluginPath); } } return plugins; }; |