UNPKG

react-automation-profiler

Version:

Automated React profiling and data visualization using React's Profiler API, Puppeteer, and D3.

31 lines 1.14 kB
import automate, { OutputType } from '../automation.js'; import path from 'path'; import { fileURLToPath } from 'url'; import { deleteJsonFiles } from '../file.util.js'; export class Automation { static async run({ averageOf = 1, includeMount = false, page, }) { let results = {}; const scriptPath = fileURLToPath(import.meta.url); const packagePath = `${scriptPath.slice(0, scriptPath.lastIndexOf('/'))}`; await deleteJsonFiles(packagePath); for (let automationCount = 1; automationCount <= averageOf; automationCount++) { const automationResult = await automate({ automationCount, averageOf, cwd: path.resolve(), includeMount, isServerReady: false, packagePath, serverPort: 0, url: page, headless: true, output: OutputType.JSON, }); if (automationResult) { results = automationResult; } } return results; } } //# sourceMappingURL=Automation.js.map