2022-05-16 03:26:04 +00:00
|
|
|
---
|
2024-04-12 07:11:07 +00:00
|
|
|
title: Contributing
|
2022-06-21 12:26:53 +00:00
|
|
|
sidebar_position: 5
|
2022-05-16 03:26:04 +00:00
|
|
|
---
|
|
|
|
|
|
|
|
Due to the precarious nature of the Open Specifications Promise, it is very
|
2024-04-12 07:11:07 +00:00
|
|
|
important to ensure code is cleanroom.
|
|
|
|
|
|
|
|
[The Contribution Notes](https://git.sheetjs.com/sheetjs/sheetjs/src/branch/master/CONTRIBUTING.md)
|
|
|
|
should be perused before contributing code.
|
2022-05-16 03:26:04 +00:00
|
|
|
|
|
|
|
<details>
|
|
|
|
<summary><b>File organization</b> (click to show)</summary>
|
|
|
|
|
|
|
|
Folders:
|
|
|
|
|
|
|
|
| folder | contents |
|
|
|
|
|:-------------|:--------------------------------------------------------------|
|
|
|
|
| `bin` | server-side bin scripts (`xlsx.njs`) |
|
2022-09-05 10:00:35 +00:00
|
|
|
| `bits` | raw source files that make up the final script |
|
2022-05-16 03:26:04 +00:00
|
|
|
| `dist` | dist files for web browsers and nonstandard JS environments |
|
|
|
|
| `misc` | miscellaneous supporting scripts |
|
2022-09-05 10:00:35 +00:00
|
|
|
| `modules` | TypeScript source files that generate some of the bits |
|
|
|
|
| `packages` | Support libraries and tools |
|
2024-04-12 07:11:07 +00:00
|
|
|
| `test_files` | test files (pulled from the test artifacts distribution) |
|
2022-09-05 10:00:35 +00:00
|
|
|
| `tests` | browser tests (run `make ctest` to rebuild) |
|
|
|
|
| `types` | TypeScript definitions and tests |
|
2022-05-16 03:26:04 +00:00
|
|
|
|
|
|
|
</details>
|
|
|
|
|
|
|
|
After cloning the repo, running `make help` will display a list of commands.
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
## Setup
|
|
|
|
|
|
|
|
These instructions will cover system configuration, cloning the source repo,
|
|
|
|
building, reproducing official releases, and running NodeJS and browser tests.
|
|
|
|
|
2023-11-28 07:05:59 +00:00
|
|
|
:::note Tested Deployments
|
2023-04-05 03:17:05 +00:00
|
|
|
|
|
|
|
These instructions were tested on the following platforms:
|
|
|
|
|
2024-01-03 06:47:00 +00:00
|
|
|
| Platform | Architecture | Test Date |
|
|
|
|
|:------------------------------|:-------------|:-----------|
|
2024-07-12 19:39:46 +00:00
|
|
|
| Linux (Steam Deck Holo x64) | `linux-x64` | 2024-07-12 |
|
2024-05-11 04:39:43 +00:00
|
|
|
| Linux (Arch Linux AArch64) | `linux-arm` | 2024-05-10 |
|
2024-07-12 19:39:46 +00:00
|
|
|
| MacOS 14.4 (x64) | `darwin-x64` | 2024-07-12 |
|
2024-05-23 06:09:51 +00:00
|
|
|
| MacOS 14.5 (ARM64) | `darwin-arm` | 2024-05-23 |
|
2024-04-08 03:55:10 +00:00
|
|
|
| Windows 10 (x64) + WSL Ubuntu | `win10-x64` | 2024-04-04 |
|
2024-05-11 04:39:43 +00:00
|
|
|
| Windows 11 (x64) + WSL Ubuntu | `win11-x64` | 2024-05-10 |
|
2024-05-24 08:24:50 +00:00
|
|
|
| Windows 11 (ARM) + WSL Ubuntu | `win11-arm` | 2024-05-23 |
|
2023-04-05 03:17:05 +00:00
|
|
|
|
2023-09-08 09:11:11 +00:00
|
|
|
With some additional dependencies, the unminified scripts are reproducible and
|
2023-07-25 02:31:22 +00:00
|
|
|
tests will pass in Windows XP with NodeJS 5.10.0.
|
|
|
|
|
2023-04-05 03:17:05 +00:00
|
|
|
:::
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
### Install dependencies
|
|
|
|
|
|
|
|
#### OS-Specific Setup
|
2022-05-16 03:26:04 +00:00
|
|
|
|
|
|
|
import Tabs from '@theme/Tabs';
|
|
|
|
import TabItem from '@theme/TabItem';
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
<Tabs groupId="os">
|
2022-05-17 03:19:39 +00:00
|
|
|
<TabItem value="wsl" label="Windows WSL">
|
|
|
|
|
2023-04-05 03:17:05 +00:00
|
|
|
A) Ensure WSL ("WSL 2" in Windows 10) and the Ubuntu distribution are installed.
|
|
|
|
|
2024-04-08 04:47:04 +00:00
|
|
|
<details open>
|
|
|
|
<summary><b>Installation Notes</b> (click to hide)</summary>
|
2023-10-15 02:39:07 +00:00
|
|
|
|
2024-05-24 08:24:50 +00:00
|
|
|
In "Turn Windows features on or off", all available features from the following
|
|
|
|
list should be enabled:
|
2023-10-15 02:39:07 +00:00
|
|
|
|
|
|
|
- "Hyper-V" (including every sub-feature)
|
|
|
|
- "Virtual Machine Platform"
|
|
|
|
- "Windows Hypervisor Platform"
|
|
|
|
- "Windows Subsystem for Linux"
|
|
|
|
|
2024-05-24 08:24:50 +00:00
|
|
|
:::note pass
|
|
|
|
|
|
|
|
The WSL requirements have changed over the years. To be safe, it is recommended
|
|
|
|
to install every listed feature that is available for the Windows version.
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2023-10-15 02:39:07 +00:00
|
|
|
The following command installs Ubuntu within WSL:
|
|
|
|
|
|
|
|
```powershell
|
2024-05-11 04:39:43 +00:00
|
|
|
wsl --update
|
2023-10-15 02:39:07 +00:00
|
|
|
wsl --install Ubuntu
|
|
|
|
```
|
|
|
|
|
2023-11-13 23:19:19 +00:00
|
|
|
In some versions of `wsl`, the `-d` flag must be specified:
|
|
|
|
|
|
|
|
```powershell
|
2024-05-11 04:39:43 +00:00
|
|
|
wsl --update
|
2023-11-13 23:19:19 +00:00
|
|
|
wsl --install -d Ubuntu
|
|
|
|
```
|
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
:::info pass
|
2023-10-15 02:39:07 +00:00
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
In some tests, the install failed with a `WSL_E_DEFAULT_DISTRO_NOT_FOUND` error.
|
2023-10-15 02:39:07 +00:00
|
|
|
|
|
|
|
The resolution is to switch to WSL1, install, and switch back to WSL2:
|
|
|
|
|
|
|
|
```
|
|
|
|
wsl --set-default-version 1
|
|
|
|
wsl --install Ubuntu
|
|
|
|
wsl --set-default-version 2
|
|
|
|
wsl --install Ubuntu
|
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2024-04-14 07:40:38 +00:00
|
|
|
:::danger pass
|
2023-10-15 02:39:07 +00:00
|
|
|
|
|
|
|
**WSL will not run in a Windows on ARM VM on computers with the M1 CPU**
|
|
|
|
|
|
|
|
Apple Silicon M1 processors do not support nested virtualization.
|
|
|
|
|
|
|
|
M2 processors do support nested virtualization. SheetJS users have reported
|
|
|
|
success with Windows on ARM running on computers with the M2 Max CPU.
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
</details>
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
B) Install NVM within WSL:
|
2023-09-19 19:08:29 +00:00
|
|
|
|
|
|
|
```bash
|
2024-04-05 02:07:37 +00:00
|
|
|
sudo apt-get install curl
|
|
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
|
2023-09-19 19:08:29 +00:00
|
|
|
```
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
C) Exit the WSL session and start a new session
|
2022-05-16 03:26:04 +00:00
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
D) Install NodeJS 16 using NVM:
|
2023-09-19 19:08:29 +00:00
|
|
|
|
|
|
|
```bash
|
2024-04-05 02:07:37 +00:00
|
|
|
nvm install 16
|
|
|
|
nvm use 16
|
2023-07-25 02:31:22 +00:00
|
|
|
```
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
E) Clone the [`js-crc32` repo](https://git.sheetjs.com/sheetjs/js-crc32)
|
2023-09-19 19:08:29 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
git clone https://git.sheetjs.com/sheetjs/js-crc32
|
|
|
|
```
|
|
|
|
|
2023-10-15 02:39:07 +00:00
|
|
|
:::note pass
|
|
|
|
|
2023-11-13 23:19:19 +00:00
|
|
|
On Windows 10, this clone may fail due to issues with `core.filemode`:
|
|
|
|
|
|
|
|
```
|
|
|
|
fatal: could not set 'core.filemode' to 'false'
|
|
|
|
```
|
|
|
|
|
|
|
|
The main drive must be remounted with the metadata option:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd /
|
|
|
|
sudo umount /mnt/c
|
|
|
|
sudo mount -t drvfs C: /mnt/c -o metadata
|
|
|
|
cd -
|
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
:::note pass
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
If this clone fails with an error message that mentions SSL or secure connection
|
|
|
|
or certificates, build and install a version of Git with proper SSL support:
|
2022-05-16 03:26:04 +00:00
|
|
|
|
2022-05-17 03:19:39 +00:00
|
|
|
```bash
|
|
|
|
# Git does not support OpenSSL out of the box, must do this
|
2023-09-19 19:08:29 +00:00
|
|
|
curl -LO https://github.com/niko-dunixi/git-openssl-shellscript/raw/main/compile-git-with-openssl.sh
|
2022-05-17 03:19:39 +00:00
|
|
|
chmod +x compile-git-with-openssl.sh
|
|
|
|
./compile-git-with-openssl.sh
|
2022-05-16 03:26:04 +00:00
|
|
|
```
|
|
|
|
|
2023-10-15 02:39:07 +00:00
|
|
|
:::
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
F) Set `git` config `core.autocrlf` setting to `false`. The following commands
|
2023-09-19 19:08:29 +00:00
|
|
|
should be run twice, once within PowerShell (if Git for Windows is installed)
|
|
|
|
and once within WSL bash:
|
2023-01-14 03:13:35 +00:00
|
|
|
|
2023-05-11 21:28:29 +00:00
|
|
|
```bash
|
2023-01-14 03:13:35 +00:00
|
|
|
git config --global --add core.autocrlf false
|
|
|
|
git config --global --unset core.autocrlf true
|
2023-07-25 02:31:22 +00:00
|
|
|
```
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
G) Run `unzip`. If the program is missing, install manually:
|
2023-07-25 02:31:22 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install -y unzip
|
2023-10-15 02:39:07 +00:00
|
|
|
```
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
H) Run `make`. If the program is missing, install manually:
|
2023-10-15 02:39:07 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install -y make
|
2023-01-14 03:13:35 +00:00
|
|
|
```
|
2022-05-17 03:19:39 +00:00
|
|
|
|
|
|
|
</TabItem>
|
2023-01-14 03:13:35 +00:00
|
|
|
<TabItem value="osx" label="MacOS">
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
A) Open a terminal window and run `git`.
|
2023-01-14 03:13:35 +00:00
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
If Xcode or the command-line tools are not installed, you will be asked to
|
|
|
|
install. Click "Install" and run through the steps.
|
|
|
|
|
|
|
|
B) Open a terminal window and install the Homebrew package manager:
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
|
|
|
```
|
|
|
|
|
|
|
|
C) Close the window, open a new terminal window, and disable analytics:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
brew analytics off
|
|
|
|
```
|
|
|
|
|
|
|
|
To confirm analytics are disabled, run
|
|
|
|
|
|
|
|
```bash
|
|
|
|
brew analytics state
|
|
|
|
```
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
The message should state that analytics are disabled or destroyed.
|
2022-05-17 03:19:39 +00:00
|
|
|
|
2024-03-16 16:04:18 +00:00
|
|
|
D) Install NodeJS.
|
2022-05-17 03:19:39 +00:00
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
:::note pass
|
2022-11-12 09:16:51 +00:00
|
|
|
|
|
|
|
[The official NodeJS site](https://nodejs.org/en/download/) provides installers
|
|
|
|
for "LTS" and "Current" releases. The "LTS" version should be installed.
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
**Older versions of macOS are not compatible with newer versions of NodeJS.**
|
|
|
|
|
|
|
|
In local testing, macOS 10.13 required NodeJS version `12.22.12`:
|
|
|
|
|
|
|
|
```bash
|
2023-10-15 02:39:07 +00:00
|
|
|
curl -LO https://nodejs.org/download/release/v12.22.12/node-v12.22.12.pkg
|
2023-10-02 04:57:11 +00:00
|
|
|
open node-v12.22.12.pkg
|
|
|
|
```
|
2023-04-05 03:17:05 +00:00
|
|
|
|
2022-11-12 09:16:51 +00:00
|
|
|
:::
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
</TabItem>
|
2022-11-12 09:16:51 +00:00
|
|
|
<TabItem value="l" label="Linux">
|
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
A) Install `curl`, `git`, and build tools using the system package manager.
|
2022-05-17 03:19:39 +00:00
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
On Debian and Ubuntu systems, `build-essential`, `curl` and `git` are required:
|
|
|
|
|
|
|
|
```bash title="Debian and Ubuntu"
|
2023-04-14 08:13:40 +00:00
|
|
|
sudo apt update
|
2024-05-11 04:39:43 +00:00
|
|
|
sudo apt-get install build-essential curl git
|
|
|
|
```
|
|
|
|
|
|
|
|
On Arch Linux, `base-devel`, `curl` and `git` are required:
|
|
|
|
|
|
|
|
```bash title="Arch Linux"
|
|
|
|
sudo pacman -Syu base-devel curl git
|
2022-05-16 03:26:04 +00:00
|
|
|
```
|
|
|
|
|
2022-11-12 09:16:51 +00:00
|
|
|
Other Linux distributions may use other package managers.
|
|
|
|
|
2024-04-08 04:47:04 +00:00
|
|
|
<details open>
|
|
|
|
<summary><b>Steam Deck</b> (click to hide)</summary>
|
2022-11-12 09:16:51 +00:00
|
|
|
|
|
|
|
Desktop Mode on the Steam Deck uses `pacman`. It also requires a few steps.
|
|
|
|
|
|
|
|
0) Switch to Desktop mode and open `Konsole`
|
|
|
|
|
2023-11-28 07:05:59 +00:00
|
|
|
:::tip pass
|
|
|
|
|
|
|
|
At this point, it is strongly recommended to install the `ungoogled-chromium`
|
|
|
|
browser from the "Discover" app and open this page on the Steam Deck. Running
|
|
|
|
the browser on the device makes it easy to copy and paste commands.
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-11-12 09:16:51 +00:00
|
|
|
1) Set a password for the user by running `passwd` and following instructions.
|
|
|
|
|
|
|
|
2) Disable read-only mode:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo steamos-readonly disable
|
|
|
|
```
|
|
|
|
|
|
|
|
(When prompted, enter the password assigned in step 1)
|
|
|
|
|
|
|
|
3) Configure keyring:
|
|
|
|
|
|
|
|
```bash
|
2023-03-26 00:55:35 +00:00
|
|
|
sudo sh -c 'echo "keyserver hkps://keyserver.ubuntu.com" >> /etc/pacman.d/gnupg/gpg.conf'
|
2022-11-12 09:16:51 +00:00
|
|
|
sudo pacman-key --init
|
|
|
|
sudo pacman-key --populate
|
|
|
|
sudo pacman-key --refresh-keys
|
|
|
|
```
|
|
|
|
|
|
|
|
4) Install dependencies:
|
|
|
|
|
|
|
|
```bash
|
2024-05-11 04:39:43 +00:00
|
|
|
sudo pacman -S base-devel git curl
|
2022-11-12 09:16:51 +00:00
|
|
|
```
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
:::note pass
|
2023-06-03 09:10:50 +00:00
|
|
|
|
|
|
|
In local testing on the Steam Deck, some of the C / C++ demos failed to build.
|
|
|
|
This issue was resolved by manually installing `glibc` and `linux-api-headers`:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo pacman -S glibc linux-api-headers
|
|
|
|
```
|
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
These packages are *not required* for building or testing the library.
|
2023-06-03 09:10:50 +00:00
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-11-12 09:16:51 +00:00
|
|
|
</details>
|
|
|
|
|
2024-04-05 02:07:37 +00:00
|
|
|
B) Install NodeJS.
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
:::note pass
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2023-11-28 07:05:59 +00:00
|
|
|
[The official NodeJS site](https://nodejs.org/en/download/) provides Linux
|
|
|
|
binaries, but it is strongly recommended to use `nvm` to install NodeJS:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
|
|
|
|
```
|
|
|
|
|
|
|
|
After installing, start a new terminal session and install NodeJS "LTS":
|
|
|
|
|
|
|
|
```bash
|
|
|
|
nvm install --lts
|
|
|
|
```
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2023-04-14 08:13:40 +00:00
|
|
|
After installing, if running `node` in the terminal fails with a `glibc` error,
|
|
|
|
an older version of NodeJS should be installed. For example, Ubuntu 18.04 does
|
2023-11-28 07:05:59 +00:00
|
|
|
not support Node 18 but supports Node 16.20.0:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
nvm install 16
|
|
|
|
nvm use 16
|
|
|
|
```
|
2023-04-14 08:13:40 +00:00
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
:::
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
C) Run `unzip`. If the program is missing, install manually:
|
2023-12-02 08:39:35 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install -y unzip
|
|
|
|
```
|
|
|
|
|
2024-05-11 04:39:43 +00:00
|
|
|
D) Run `make`. If the program is missing, install manually:
|
2023-12-02 08:39:35 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
sudo apt-get install -y make
|
|
|
|
```
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
### Build from source tree
|
2022-11-12 09:16:51 +00:00
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
0) Clone the project:
|
2022-05-16 03:26:04 +00:00
|
|
|
|
|
|
|
```bash
|
2023-01-14 03:13:35 +00:00
|
|
|
git clone https://git.sheetjs.com/sheetjs/sheetjs
|
|
|
|
cd sheetjs
|
2022-05-17 03:19:39 +00:00
|
|
|
```
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
:::note pass
|
|
|
|
|
|
|
|
On older platforms, the clone may fail due to SSL certificate problems:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
fatal: unable to access 'https://git.sheetjs.com/sheetjs/sheetjs/': SSL certificate problem: certificate has expired
|
|
|
|
```
|
|
|
|
|
|
|
|
The simplest workaround is to disable SSL verification:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git config --global http.sslVerify false
|
|
|
|
```
|
|
|
|
|
|
|
|
**It is strongly recommended to re-enable SSL verification after cloning**:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
git config --global http.sslVerify true
|
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2023-08-31 22:09:08 +00:00
|
|
|
1) Install NodeJS modules for building the scripts:
|
2022-05-16 03:26:04 +00:00
|
|
|
|
2023-12-02 08:39:35 +00:00
|
|
|
```bash
|
|
|
|
npm i
|
|
|
|
npm i -g mocha@2.5.3 voc @sheetjs/uglify-js
|
|
|
|
```
|
|
|
|
|
|
|
|
:::caution pass
|
|
|
|
|
|
|
|
If `npm i -g` fails with a permissions issue, run the command with `sudo`:
|
|
|
|
|
2022-05-17 03:19:39 +00:00
|
|
|
```bash
|
2023-05-07 13:58:36 +00:00
|
|
|
npm i
|
2022-07-25 23:18:00 +00:00
|
|
|
sudo npm i -g mocha@2.5.3 voc @sheetjs/uglify-js
|
2022-05-17 03:19:39 +00:00
|
|
|
```
|
|
|
|
|
2023-12-02 08:39:35 +00:00
|
|
|
:::
|
|
|
|
|
2022-11-12 09:16:51 +00:00
|
|
|
:::note Older Versions of Dependencies
|
|
|
|
|
2024-05-23 06:09:51 +00:00
|
|
|
Some of the dependencies are wildly out of date. While SheetJS libraries aim to
|
|
|
|
run in older versions of NodeJS and browsers, some libraries have opted to break
|
|
|
|
backwards compatibility. The specific versions are used because they are known
|
|
|
|
to work and known to produce consistent and reproducible results.
|
2022-11-12 09:16:51 +00:00
|
|
|
|
|
|
|
:::
|
|
|
|
|
2022-05-17 03:19:39 +00:00
|
|
|
2) Initialize the test files:
|
|
|
|
|
|
|
|
```bash
|
2023-11-13 23:19:19 +00:00
|
|
|
rmdir test_files
|
|
|
|
curl -LO https://test-files.sheetjs.com/test_files.zip
|
|
|
|
unzip test_files.zip
|
|
|
|
mkdir -p tmp
|
2022-05-17 03:19:39 +00:00
|
|
|
```
|
|
|
|
|
2023-11-13 23:19:19 +00:00
|
|
|
:::note pass
|
|
|
|
|
|
|
|
The `rmdir` command may fail if the folder is missing. The error can be ignored.
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
|
|
|
This step may take a few minutes as the current test snapshot is large.
|
2022-05-17 03:19:39 +00:00
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
3) Run the `esbuild` tool once:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npx -y esbuild@0.14.14
|
|
|
|
```
|
|
|
|
|
|
|
|
4) Run a build and verify with a short test:
|
2022-05-17 03:19:39 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
# Full Build
|
2023-03-26 00:55:35 +00:00
|
|
|
cd modules; make clean; make; cd ..
|
2023-08-30 03:44:38 +00:00
|
|
|
make
|
2022-05-17 03:19:39 +00:00
|
|
|
make dist
|
2023-04-05 03:17:05 +00:00
|
|
|
|
2023-08-30 03:44:38 +00:00
|
|
|
# Short test
|
|
|
|
make test_misc
|
|
|
|
|
2023-04-05 03:17:05 +00:00
|
|
|
# Reset repo
|
|
|
|
git checkout -- .
|
2022-05-20 03:25:45 +00:00
|
|
|
```
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
:::info pass
|
|
|
|
|
|
|
|
In some tests on older releases of macOS, the build failed with an error:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
ReferenceError: n is not defined
|
|
|
|
```
|
|
|
|
|
|
|
|
The first error in the call stack points to `dist/xlsx.zahl.js`.
|
|
|
|
|
|
|
|
Older versions of macOS `sed` are known to misinterpret newline characters. The
|
|
|
|
workaround is to upgrade to a newer version of `sed`. On macOS:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
brew install gnu-sed
|
|
|
|
echo 'export PATH="/usr/local/opt/gnu-sed/libexec/gnubin:$PATH"' >> ~/.profile
|
|
|
|
. ~/.profile
|
|
|
|
```
|
|
|
|
|
|
|
|
:::
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
### Reproduce official builds
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
5) Run `git log` and search for the commit that matches a particular release
|
2024-07-12 19:39:46 +00:00
|
|
|
version. For example, version `0.20.3` can be found with:
|
2022-05-20 03:25:45 +00:00
|
|
|
|
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
git log | grep -B4 "version bump 0.20.3"
|
2022-07-23 09:06:31 +00:00
|
|
|
```
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
The output should look like:
|
2022-07-23 09:06:31 +00:00
|
|
|
|
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
$ git log | grep -B4 "version bump 0.20.3"
|
2023-01-14 03:13:35 +00:00
|
|
|
# highlight-next-line
|
2024-07-12 19:39:46 +00:00
|
|
|
commit 8a7cfd47bde8258c0d91df6a737bf0136699cdf8 <-- this is the commit hash
|
2023-01-14 03:13:35 +00:00
|
|
|
Author: SheetJS <dev@sheetjs.com>
|
2024-07-12 19:39:46 +00:00
|
|
|
Date: Fri Jul 12 11:47:14 2024 -0400
|
2023-01-14 03:13:35 +00:00
|
|
|
|
2024-07-12 19:39:46 +00:00
|
|
|
version bump 0.20.3
|
2022-05-16 03:26:04 +00:00
|
|
|
```
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
6) Switch to that commit:
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
git checkout 8a7cfd47bde8258c0d91df6a737bf0136699cdf8
|
2023-01-14 03:13:35 +00:00
|
|
|
```
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
7) Run the full build sequence
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
```bash
|
2023-09-08 09:11:11 +00:00
|
|
|
make clean; make
|
2023-03-26 00:55:35 +00:00
|
|
|
cd modules; make clean; make; cd ..
|
2023-01-14 03:13:35 +00:00
|
|
|
make
|
|
|
|
make dist
|
|
|
|
```
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
8) To verify that the files are intact, use `md5sum` (`md5` on MacOS).
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
The local checksum for the browser script can be computed with:
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
<Tabs groupId="os">
|
|
|
|
<TabItem value="wsl" label="Windows WSL">
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
```bash
|
2023-10-02 04:57:11 +00:00
|
|
|
md5sum dist/xlsx.full.min.js
|
2023-01-14 03:13:35 +00:00
|
|
|
```
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
</TabItem>
|
|
|
|
<TabItem value="osx" label="MacOS">
|
|
|
|
|
|
|
|
```bash
|
|
|
|
md5 dist/xlsx.full.min.js
|
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="l" label="Linux">
|
|
|
|
|
|
|
|
```bash
|
|
|
|
md5sum dist/xlsx.full.min.js
|
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
|
|
|
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
The checksum for the CDN version can be computed with:
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
<Tabs groupId="os">
|
|
|
|
<TabItem value="wsl" label="Windows WSL">
|
|
|
|
|
2023-01-14 03:13:35 +00:00
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
curl -L https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js | md5sum -
|
2023-10-02 04:57:11 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="osx" label="MacOS">
|
|
|
|
|
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
curl -k -L https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js | md5
|
2023-10-02 04:57:11 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
<TabItem value="l" label="Linux">
|
|
|
|
|
|
|
|
```bash
|
2024-07-12 19:39:46 +00:00
|
|
|
curl -L https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js | md5sum -
|
2023-10-02 04:57:11 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
</TabItem>
|
|
|
|
</Tabs>
|
|
|
|
|
2024-07-12 19:39:46 +00:00
|
|
|
When the demo was last tested on macOS, against version `0.20.3`:
|
2023-10-02 04:57:11 +00:00
|
|
|
|
2023-11-13 23:19:19 +00:00
|
|
|
>
|
2023-10-02 04:57:11 +00:00
|
|
|
```bash
|
|
|
|
$ md5 dist/xlsx.full.min.js
|
|
|
|
# highlight-next-line
|
2024-07-12 19:39:46 +00:00
|
|
|
MD5 (dist/xlsx.full.min.js) = 6b3130af1ceadf07caa0ec08af7addff
|
|
|
|
$ curl -k -L https://cdn.sheetjs.com/xlsx-0.20.3/package/dist/xlsx.full.min.js | md5
|
2023-10-02 04:57:11 +00:00
|
|
|
# highlight-next-line
|
2024-07-12 19:39:46 +00:00
|
|
|
6b3130af1ceadf07caa0ec08af7addff
|
2023-01-14 03:13:35 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
The two hashes should match.
|
|
|
|
|
2023-10-02 04:57:11 +00:00
|
|
|
9) Return to the `HEAD` commit:
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
```bash
|
2023-03-26 00:55:35 +00:00
|
|
|
git checkout master
|
2023-01-14 03:13:35 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
### Test in web browsers
|
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
10) Start local server:
|
2023-01-14 03:13:35 +00:00
|
|
|
|
|
|
|
```bash
|
|
|
|
make ctestserv
|
|
|
|
```
|
|
|
|
|
|
|
|
The terminal will display a port number. For example:
|
|
|
|
|
|
|
|
```
|
|
|
|
Serving HTTP on 0.0.0.0 port 8000 (http://0.0.0.0:8000/)
|
|
|
|
```
|
2022-05-16 03:26:04 +00:00
|
|
|
|
2023-09-19 19:08:29 +00:00
|
|
|
11) Open a browser window and access `http://localhost:8000`, replacing `8000`
|
2023-01-14 03:13:35 +00:00
|
|
|
with the port number from the terminal window.
|
2022-05-16 03:26:04 +00:00
|
|
|
|
2022-05-17 03:19:39 +00:00
|
|
|
## Development
|
|
|
|
|
|
|
|
The `xlsx.js` and `xlsx.mjs` files are constructed from the files in the `bits`
|
2022-08-24 00:51:18 +00:00
|
|
|
subfolder. The build script (run `make`) will concatenate the individual bits
|
|
|
|
to produce the scripts.
|
2022-05-17 03:19:39 +00:00
|
|
|
|
2023-08-30 03:44:38 +00:00
|
|
|
When changing the `.js` scripts in `bits`, the following sequence rebuilds the
|
|
|
|
`xlsx.js` and `xlsx.mjs` scripts:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
make
|
|
|
|
```
|
|
|
|
|
|
|
|
When changing the `.ts` scripts in `modules`, the following sequence rebuilds
|
|
|
|
the `xlsx.js` and `xlsx.mjs` scripts:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cd modules; make clean; make; cd ..
|
|
|
|
```
|
|
|
|
|
|
|
|
To produce the dist files, run `make dist`.
|
|
|
|
|
|
|
|
:::info pass
|
|
|
|
|
|
|
|
The various `xlsx.*` scripts in the base folder and the files in the `dist`
|
|
|
|
folder are updated on each version release.
|
|
|
|
|
|
|
|
**They should not be committed between versions!**
|
|
|
|
|
|
|
|
:::
|
2022-05-17 03:19:39 +00:00
|
|
|
|
|
|
|
## Tests
|
|
|
|
|
|
|
|
The `test_misc` target runs the targeted feature tests. It should take 5-10
|
|
|
|
seconds to perform feature tests without testing against the full test battery.
|
|
|
|
New features should be accompanied with tests for the relevant file formats.
|
2022-05-16 03:26:04 +00:00
|
|
|
|
|
|
|
For tests involving the read side, an appropriate feature test would involve
|
|
|
|
reading an existing file and checking the resulting workbook object. If a
|
|
|
|
parameter is involved, files should be read with different values to verify that
|
|
|
|
the feature is working as expected.
|
|
|
|
|
|
|
|
For tests involving a new write feature which can already be parsed, appropriate
|
|
|
|
feature tests would involve writing a workbook with the feature and then opening
|
|
|
|
and verifying that the feature is preserved.
|
|
|
|
|
|
|
|
For tests involving a new write feature without an existing read ability, please
|
|
|
|
add a feature test to the kitchen sink `tests/write.js`.
|
|
|
|
|