docs.sheetjs.com/tests/engines/chakracore.sh

45 lines
1.0 KiB
Bash
Raw Normal View History

2025-02-17 04:49:35 +00:00
#!/bin/bash
# https://docs.sheetjs.com/docs/demos/engines/chakra
cd /tmp
rm -rf sheetjs-chakra
mkdir sheetjs-chakra
cd sheetjs-chakra
git clone https://github.com/chakra-core/ChakraCore.git
cd ChakraCore
2026-01-21 06:14:24 +00:00
git checkout 792ee76
2025-02-17 04:49:35 +00:00
cd ..
cd ChakraCore
./build.sh --static --icu=/usr/local/opt/icu4c/include --test-build -j=8 --no-jit
cd ..
curl -L -O https://docs.sheetjs.com/chakra/sheetjs.ch.cpp
curl -L -O https://docs.sheetjs.com/chakra/Makefile
make
curl -L -O https://cdn.sheetjs.com/xlsx-latest/package/dist/xlsx.full.min.js
curl -L -O https://docs.sheetjs.com/pres.numbers
./sheetjs.ch pres.numbers
cp ChakraCore/out/Test/ch .
node -e "fs.writeFileSync('payload.js', 'var payload = \"' + fs.readFileSync('pres.numbers').toString('base64') + '\";')"
cat <<EOF >global.js
var global = (function(){ return this; }).call(null);
EOF
cat <<EOF >chakra.js
var wb = XLSX.read(payload, {type:'base64'});
console.log(XLSX.utils.sheet_to_csv(wb.Sheets[wb.SheetNames[0]]));
EOF
cat global.js xlsx.full.min.js payload.js chakra.js > xlsx.chakra.js
./ch xlsx.chakra.js