From ac6e3daa1c18f768e45465427e0c66a5e9eb6da6 Mon Sep 17 00:00:00 2001 From: SheetJS Date: Sun, 14 Apr 2024 03:05:36 -0400 Subject: [PATCH] automated vitejs and browserify tests --- README.md | 2 +- .../02-frontend/19-bundler/03-vitejs.md | 6 +- .../02-frontend/19-bundler/09-browserify.md | 17 ++- docz/docusaurus.config.js | 2 +- tests/bundler-browserify.sh | 100 ++++++++++++++++++ tests/bundler-vite.sh | 69 ++++++++++++ tests/{nashorntest.sh => engines-nashorn.sh} | 7 +- 7 files changed, 193 insertions(+), 10 deletions(-) create mode 100755 tests/bundler-browserify.sh create mode 100755 tests/bundler-vite.sh rename tests/{nashorntest.sh => engines-nashorn.sh} (94%) diff --git a/README.md b/README.md index 3001a4f..50d7bda 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ $ make graph # build format graph and legend The original documentation used [GFM](https://github.github.com/gfm/). -Pages currently use MDX v1. +Pages currently use MDX v2.
MDX Notes (click to show) 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 91ae83d..70109ab 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.0.5` | 2023-12-04 | -| `4.5.0` | 2023-12-04 | -| `3.2.7` | 2023-12-05 | +| `5.2.8` | 2024-04-13 | +| `4.5.3` | 2024-04-13 | +| `3.2.10` | 2024-04-13 | ::: diff --git a/docz/docs/03-demos/02-frontend/19-bundler/09-browserify.md b/docz/docs/03-demos/02-frontend/19-bundler/09-browserify.md index 5b08f16..8fb206a 100644 --- a/docz/docs/03-demos/02-frontend/19-bundler/09-browserify.md +++ b/docz/docs/03-demos/02-frontend/19-bundler/09-browserify.md @@ -34,8 +34,21 @@ This demo was tested in the following environments: | Browserify | Date | |:-----------|:-----------| -| `17.0.0` | 2023-12-04 | -| `3.46.1` | 2023-12-04 | +| `17.0.0` | 2024-04-13 | +| `16.5.2` | 2024-04-13 | +| `15.2.0` | 2024-04-13 | +| `14.5.0` | 2024-04-13 | +| `13.3.0` | 2024-04-13 | +| `12.0.2` | 2024-04-13 | +| `11.2.0` | 2024-04-13 | +| `10.2.6` | 2024-04-13 | +| `9.0.8` | 2024-04-13 | +| `8.1.3` | 2024-04-13 | +| `7.1.0` | 2024-04-13 | +| `6.3.4` | 2024-04-13 | +| `5.13.1` | 2024-04-13 | +| `4.2.3` | 2024-04-13 | +| `3.46.1` | 2024-04-13 | ::: diff --git a/docz/docusaurus.config.js b/docz/docusaurus.config.js index a69a7f3..48fb04c 100644 --- a/docz/docusaurus.config.js +++ b/docz/docusaurus.config.js @@ -181,7 +181,7 @@ const config = { } }) }, - additionalLanguages: [ "visual-basic", "swift", "java", "php", "csharp", "perl", "ruby", "cpp", "applescript", "liquid", "rust", "dart", "wolfram", "matlab", "stata", "zig", "diff" ], + additionalLanguages: [ "visual-basic", "swift", "java", "php", "csharp", "perl", "ruby", "cpp", "applescript", "liquid", "rust", "dart", "wolfram", "matlab", "stata", "zig", "diff", "bash" ], }, liveCodeBlock: { playgroundPosition: 'top' diff --git a/tests/bundler-browserify.sh b/tests/bundler-browserify.sh new file mode 100755 index 0000000..1777c7d --- /dev/null +++ b/tests/bundler-browserify.sh @@ -0,0 +1,100 @@ +#!/bin/bash +# https://docs.sheetjs.com/docs/demos/frontend/bundler/browserify +# requires global puppeteer and express + +# sudo npm i -g puppeteer express@4 +cd /tmp +rm -rf sheetjs-browserify-tests +mkdir sheetjs-browserify-tests +cd sheetjs-browserify-tests + +for n in {3..17}; do +mkdir sheetjs-browserify-$n +cd sheetjs-browserify-$n +npm init -y + +npm i --save https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz + +cat >index.js < index.min.js + +cat >index.html < + + + +

SheetJS Presidents Demo

+ + + + +EOF + +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}); + await page.goto('http://localhost:7262/'); + await page.click("#xport"); + await new Promise((res,rej) => setTimeout(res, 1000)); + await browser.close(); + process.exit(); +}); +EOF + +node test.js + +cd - +done diff --git a/tests/bundler-vite.sh b/tests/bundler-vite.sh new file mode 100755 index 0000000..2a26d4a --- /dev/null +++ b/tests/bundler-vite.sh @@ -0,0 +1,69 @@ +#!/bin/bash +# https://docs.sheetjs.com/docs/demos/frontend/bundler/vitejs +# NOTE: this only checks whether data or SheetJS code is added to the bundle + +cd /tmp +rm -rf sheetjs-vite-tests +mkdir sheetjs-vite-tests +cd sheetjs-vite-tests + +for n in {3..5}; do +npm create vite@$n sheetjs-vite$n -- --template vue-ts +cd sheetjs-vite$n +npm i +npm i --save https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz +npm ls | grep vite + +curl -O https://docs.sheetjs.com/vitejs/vite.config.ts + +mkdir -p data +curl -L -o data/pres.xlsx https://sheetjs.com/pres.xlsx + +cat >src/components/HelloWorld.vue < +// @ts-ignore +import data from '../../data/pres.xlsx?sheetjs'; + + + +EOF + +npm run build +echo "### Results: " $(grep Clinton -R dist | wc -l) $(grep BESSELJ -R dist | wc -l) + +cat >src/components/HelloWorld.vue < +// @ts-ignore +import b64 from '../../data/pres.xlsx?b64'; +import { read, utils } from "xlsx"; +/* parse workbook and convert first sheet to row array */ +const wb = read(b64); +const ws = wb.Sheets[wb.SheetNames[0]]; +interface IPresident { Name: string; Index: number; }; +const data = utils.sheet_to_json(ws); + + + +EOF + +npm run build +echo "### Results: " $(grep Clinton -R dist | wc -l) $(grep BESSELJ -R dist | wc -l) +cd - + +done diff --git a/tests/nashorntest.sh b/tests/engines-nashorn.sh similarity index 94% rename from tests/nashorntest.sh rename to tests/engines-nashorn.sh index 4b6663c..7df20fd 100755 --- a/tests/nashorntest.sh +++ b/tests/engines-nashorn.sh @@ -1,8 +1,9 @@ #!/bin/bash - +# https://docs.sheetjs.com/docs/demos/engines/nashorn cd /tmp -mkdir -p nashorn -cd nashorn +rm -rf sheetjs-nashorn +mkdir -p sheetjs-nashorn +cd sheetjs-nashorn curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js curl -LO https://cdn.sheetjs.com/xlsx-latest/package/dist/shim.min.js