UNPKG

webextension-store-meta

Version:

Get browser extension(webextension) item meta from Chrome Web Store, Firefox add-ons, and Microsoft Edge Add-ons.

32 lines (25 loc) 757 B
import { fetchText } from "../../utils/fetch-text"; const IDs = [ "cdonnmffkdaoajfknoeeecmchibpmkmg", "lmjdlojahmbbcodnpecnjnmlddbkjhnn", "chphlpgkkbolifaimnlloiipkdnihall", ]; export async function fixtures(): Promise<string[]> { const exts = new Set(IDs); if (process.env.CI) { const idMatcher = /\/detail\/(?:[^/]+\/)?([\d\w]+)/g; const html = await fetchText("https://chromewebstore.google.com/"); const initialSize = exts.size; for ( let match = idMatcher.exec(html); exts.size - initialSize < 5 && match; match = idMatcher.exec(html) ) { exts.add(match[1]); } if (exts.size - initialSize <= 0) { throw new Error("No extensions found"); } } return [...exts.values()]; }