UNPKG

@percy/core

Version:

The core component of Percy's CLI and SDKs that handles creating builds, discovering snapshot assets, uploading snapshots, and finalizing builds. Uses `@percy/client` for API communication, a Chromium browser for asset discovery, and starts a local API se

21 lines (18 loc) 823 B
import fs from 'fs'; try { if (!['false', '0', undefined].includes(process.env.PERCY_POSTINSTALL_BROWSER)) { // Automatically download and install Chromium if PERCY_POSTINSTALL_BROWSER is set await import('./dist/install.js').then(install => install.chromium()); } else if (!process.send && fs.existsSync('./src')) { // In development, fork this script with the development loader and always install await import('child_process').then(cp => cp.fork('./post-install.js', { execArgv: ['--no-warnings', '--loader=../../scripts/loader.js'], env: { PERCY_POSTINSTALL_BROWSER: true } })); } } catch (error) { const { logger } = await import('@percy/logger'); const log = logger('core:post-install'); log.error('Encountered an error while installing Chromium'); log.error(error); }