6.4 KiB
title | sidebar_label | pagination_prev | pagination_next | sidebar_custom_props | ||
---|---|---|---|---|---|---|
Sheets in a Box with boxednode | boxednode | demos/desktop/index | demos/data/index |
|
import current from '/version.js'; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; import CodeBlock from '@theme/CodeBlock';
export const r = {style: {color:"red"}}; export const B = {style: {fontWeight:"bold"}};
boxednode
1 is a tool for generating command-line tools that embed scripts.
It automates the process of building NodeJS from source.
SheetJS is a JavaScript library for reading and writing data from spreadsheets.
This demo uses boxednode
and SheetJS to create a standalone CLI tool for
parsing spreadsheets and converting to other formats.
:::note Tested Deployments
This demo was tested in the following deployments:
Architecture | Version | NodeJS | Date |
---|---|---|---|
darwin-x64 |
2.4.4 |
23.11.0 |
2025-04-21 |
darwin-arm |
2.4.4 |
22.14.0 |
2025-04-03 |
win11-x64 |
2.4.4 |
16.20.2 |
2025-05-07 |
linux-x64 |
2.4.4 |
23.11.0 |
2025-04-21 |
linux-arm |
2.4.4 |
23.8.0 |
2025-02-15 |
:::
Integration Details
The SheetJS NodeJS module can be
required from scripts. boxednode
will automatically handle packaging.
Script Requirements
Scripts that exclusively use SheetJS libraries and NodeJS built-in modules can
be bundled using boxednode
The demo script xlsx-cli.js
runs in NodeJS. It
is a simple command-line tool for reading and writing spreadsheets.
Complete Example
- Download the test file https://docs.sheetjs.com/pres.numbers:
curl -o pres.numbers https://docs.sheetjs.com/pres.numbers
- Download
xlsx-cli.js
curl -o xlsx-cli.js https://docs.sheetjs.com/cli/xlsx-cli.js
- Install the dependencies:
- Create the standalone program:
npx -y boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli
:::note pass
In previous linux-arm
test runs, the build failed with an error:
../deps/v8/src/base/small-vector.h: In instantiation of ‘class v8::base::SmallVector<std::pair<const v8::internal::compiler::turboshaft::PhiOp*, const v8::internal::compiler::turboshaft::OpIndex>, 16>’: ../deps/v8/src/compiler/turboshaft/loop-unrolling-reducer.h:444:11: required from here ../deps/v8/src/base/macros.h:206:55: error: static assertion failed: T should be trivially copyable {" 206 |"} static_assert(::v8::base::is_trivially_copyable<T>::value, \\ {" |"} ^~~~~
This affects NodeJS 22.2.0
, but does not affect 20.13.1
or 23.8.0
. It also
affects the V8 JavaScript Engine.
The -n
flag controls the target NodeJS version. For this demo, the following
command uses NodeJS 23.8.0
:
npx -y boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli -n 23.8.0
:::
npx -y boxednode@2.4.4 -s xlsx-cli.js -t xlsx-cli.exe -n 16.20.2
:::info pass
The Windows builds require Visual Studio with "Desktop development with C++" workload, Python 3.11, and NASM2.
The build command must be run in "x64 Native Tools Command Prompt"
:::
:::caution pass
In some test runs, the build failed:
Not an executable Python program
Could not find Python.
By default, Windows aliases python
to a Microsoft Store installer. If the
official installer was used, the alias should be disabled manually:
-
Open Start menu and type "app alias". Click "Manage app execution aliases".
-
Disable the App Installer for all items with
python
in the name.
Using Python 3.12, the build fails with an error:
Please use python3.11 or python3.10 or python3.9 or python3.8 or python3.7 or python3.6.
In the most recent test, Python 3.11.8 was installed from the official site.
:::
:::caution pass
When the demo was last tested on Windows, the build failed:
error MSB8020: The build tools for Visual Studio 2019 (Platform Toolset = 'v142') cannot be found. To build using the v142 build tools, please install Visual Studio 2019 build tools.
This error was fixed by installing the following components from Visual Studio:
C++/CLI support for v142 build tools
MSVC v142 - VS 2019 - C++ x64/x86 build tools
MSVC v142 - VS 2019 - C++ x64/x86 Spectre-mitigated libs
:::
:::caution pass
In the most recent Windows test against NodeJS 20.8.0
, the build failed due
to an issue in the OpenSSL dependency:
...\node-v20.8.0\deps\openssl\openssl\crypto\cversion.c(75,33): error C2153: integer literals must have at least one digit [...\node-v20.8.0\deps\openssl\openssl.vcxproj]
SheetJS libraries are compatible with NodeJS versions dating back to v0.8
. The
workaround is to select NodeJS v16.20.2
using the -n
flag. This version was
was chosen since NodeJS v18
upgraded the OpenSSL dependency.
:::
- Run the generated program, passing
pres.numbers
as the argument:
./xlsx-cli pres.numbers
.\xlsx-cli.exe pres.numbers
-
The project does not have a website. The source repository is publicly available. ↩︎
-
Downloads can be found at the main NASM project website ↩︎