#!/bin/bash # https://docs.sheetjs.com/docs/demos/static/esbuild cd /tmp rm -rf sheetjs-esb mkdir sheetjs-esb cd sheetjs-esb npm init -y npm i --save https://cdn.sheetjs.com/xlsx-latest/xlsx-latest.tgz npm i --save puppeteer express cat >index.html < SheetJS + ESBuild EOF cat >app.js < \` \${row.Name} \${row.Index} \`).join("") + ""; document.body.appendChild(elt); EOF curl -LO https://docs.sheetjs.com/esbuild/build.mjs curl -LO https://docs.sheetjs.com/pres.numbers cat >test.js < { await new Promise((res,rej) => setTimeout(res, 1000)); const browser = await puppeteer.launch(); const page = await browser.newPage(); page.on("console", msg => console.log("PAGE LOG:", msg.text())); await page.setViewport({width: 1920, height: 1080}); const client = await page.target().createCDPSession(); await client.send('Browser.setDownloadBehavior', { behavior: 'allow', downloadPath: require("path").resolve('./') }); page.on('request', req => console.log(req.url())); await page.goto('http://localhost:7262/'); await new Promise((res,rej) => setTimeout(res, 1000)); const innerText = await page.evaluate(() => document.body.innerText); console.log(innerText); await browser.close(); process.exit(); }); EOF for n in 0.9.1 0.{9..24}; do npm i --save esbuild@$n npm ls | grep esbuild rm -f out.js node build.mjs echo "Clinton" $(grep Clinton out.js | wc -l) "BESSELJ" $(grep BESSELJ out.js | wc -l) node test.js done