import fs from 'fs' import path from 'path' import { config } from 'pear' const pearBin = path.join(config.pearDir, 'bin') const paths = process.env.PATH.split(path.delimiter) customElements.define('system-status', class extends HTMLElement { constructor () { super() this.vianode = false this.installed = paths.some((p) => { if (p.includes('node') && p.includes('bin')) this.vianode = fs.existsSync(path.join(p, 'pear')) return p === pearBin }) this.template = document.createElement('template') this.template.innerHTML = `
Pear is installed.
✔ Pear is in the system PATH and ready to go.
` : `Pear setup is nearly complete.
Click the button to add ${pearBin} to the system PATH