From 954ab5fe7ed22c3d07d874b025a0d442e620146b Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sun, 28 Apr 2024 00:43:55 -0400 Subject: [PATCH] RequireJS demo automation --- .../02-frontend/19-bundler/03-vitejs.md | 6 +- .../02-frontend/19-bundler/11-requirejs.md | 4 +- .../02-frontend/19-bundler/21-swcpack.md | 6 +- docz/docs/03-demos/12-static/12-astro.md | 8 +- tests/bundler-requirejs.sh | 156 ++++++++++++++++++ 5 files changed, 169 insertions(+), 11 deletions(-) create mode 100755 tests/bundler-requirejs.sh diff --git a/docz/docs/03-demos/02-frontend/19-bundler/03-vitejs.md b/docz/docs/03-demos/02-frontend/19-bundler/03-vitejs.md index f1b05cf..4db5438 100644 --- a/docz/docs/03-demos/02-frontend/19-bundler/03-vitejs.md +++ b/docz/docs/03-demos/02-frontend/19-bundler/03-vitejs.md @@ -41,9 +41,9 @@ This demo was tested in the following environments: | ViteJS | Date | |:---------|:-----------| -| `5.2.8` | 2024-04-13 | -| `4.5.3` | 2024-04-13 | -| `3.2.10` | 2024-04-13 | +| `5.2.10` | 2024-04-27 | +| `4.5.3` | 2024-04-27 | +| `3.2.10` | 2024-04-27 | ::: diff --git a/docz/docs/03-demos/02-frontend/19-bundler/11-requirejs.md b/docz/docs/03-demos/02-frontend/19-bundler/11-requirejs.md index ac86beb..86f41b2 100644 --- a/docz/docs/03-demos/02-frontend/19-bundler/11-requirejs.md +++ b/docz/docs/03-demos/02-frontend/19-bundler/11-requirejs.md @@ -40,8 +40,8 @@ This demo was tested in the following environments: | RequireJS | Date | |:----------|:-----------| -| `2.3.6` | 2024-03-01 | -| `2.1.22` | 2023-12-04 | +| `2.3.6` | 2024-04-27 | +| `2.1.22` | 2024-04-27 | ::: diff --git a/docz/docs/03-demos/02-frontend/19-bundler/21-swcpack.md b/docz/docs/03-demos/02-frontend/19-bundler/21-swcpack.md index c8d06f1..81aa044 100644 --- a/docz/docs/03-demos/02-frontend/19-bundler/21-swcpack.md +++ b/docz/docs/03-demos/02-frontend/19-bundler/21-swcpack.md @@ -35,7 +35,7 @@ This demo was tested in the following environments: | Version | Date | |:----------|:-----------| -| `1.2.246` | 2023-12-04 | +| `1.2.246` | 2024-04-27 | ::: @@ -65,7 +65,7 @@ import { utils, writeFile } from 'xlsx'; :::danger pass -When this demo was tested against the `@swc/core@1.3.100`, `spack` crashed: +When this demo was tested against recent versions of `@swc/core`, `spack` crashed: ``` thread '' panicked at 'cannot access a scoped thread local variable without calling `set` first', @@ -73,6 +73,8 @@ thread '' panicked at 'cannot access a scoped thread local variable wit **This is a bug in SWC** +This bug is known to affect versions `1.3.100` and `1.4.17`. + Until the bug is fixed, it is strongly recommended to use `@swc/core@1.2.246`. ::: diff --git a/docz/docs/03-demos/12-static/12-astro.md b/docz/docs/03-demos/12-static/12-astro.md index a1f1cdd..e2de28e 100644 --- a/docz/docs/03-demos/12-static/12-astro.md +++ b/docz/docs/03-demos/12-static/12-astro.md @@ -50,10 +50,10 @@ npx astro telemetry disable This demo was tested in the following environments: -| AstroJS | Template | Date | -|:--------|:------------------|:-----------| -| `3.6.5` |: Starlight 0.14.0 | 2024-04-14 | -| `4.6.1` |: Starlight 0.21.5 | 2024-04-14 | +| AstroJS | Template | Date | +|:--------|:-----------------|:-----------| +| `3.6.5` | Starlight 0.14.0 | 2024-04-14 | +| `4.6.1` | Starlight 0.21.5 | 2024-04-14 | ::: diff --git a/tests/bundler-requirejs.sh b/tests/bundler-requirejs.sh new file mode 100755 index 0000000..f70a4a5 --- /dev/null +++ b/tests/bundler-requirejs.sh @@ -0,0 +1,156 @@ +#!/bin/bash +# https://docs.sheetjs.com/docs/demos/frontend/bundler/requirejs +# requires global puppeteer and express + +# sudo npm i -g puppeteer express@4 + +cd /tmp +rm -rf sheetjs-requirejs +mkdir sheetjs-requirejs +cd sheetjs-requirejs + +curl -LO https://cdn.sheetjs.com/xlsx-0.20.2/package/dist/xlsx.full.min.js + +cat >SheetJSRequire.js <build.js <test1.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}); + await page.goto('http://localhost:7262/', {waitUntil: 'domcontentloaded'}); + + /* wait for requirejs to request xlsx.full.min.js */ + await page.waitForRequest(request => request.url().indexOf('xlsx.full.min.js') !== -1); + await new Promise((res,rej) => setTimeout(res, 1000)); + + await page.click("#xport"); + await new Promise((res,rej) => setTimeout(res, 1000)); + await browser.close(); + process.exit(); +}); +EOF + +cat >test2.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}); + await page.goto('http://localhost:7262/optimized.html'); + await page.click("#xport"); + await new Promise((res,rej) => setTimeout(res, 1000)); + await browser.close(); + process.exit(); +}); +EOF + +for n in 2.3.6 2.1.22; do + +echo $n Standalone + +cat >index.html < + + + +

SheetJS Presidents Demo

+ + + + + + +EOF + +node test1.js + +echo $n Optimizer + +npx -p requirejs@$n r.js -o build.js + +cat >optimized.html < + + + +

SheetJS Presidents Demo

+ + + + + +EOF + +node test2.js + +done