---
sidebar_position: 5
---
# Contributing
Due to the precarious nature of the Open Specifications Promise, it is very
important to ensure code is cleanroom.  [Contribution Notes](https://git.sheetjs.com/sheetjs/sheetjs/src/branch/master/CONTRIBUTING.md)
  File organization (click to show)
Folders:
| folder       | contents                                                      |
|:-------------|:--------------------------------------------------------------|
| `bin`        | server-side bin scripts (`xlsx.njs`)                          |
| `bits`       | raw source files that make up the final script                |
| `dist`       | dist files for web browsers and nonstandard JS environments   |
| `misc`       | miscellaneous supporting scripts                              |
| `modules`    | TypeScript source files that generate some of the bits        |
| `packages`   | Support libraries and tools                                   |
| `test_files` | test files (pulled from the test files repository)            |
| `tests`      | browser tests (run `make ctest` to rebuild)                   |
| `types`      | TypeScript definitions and tests                              |
 
After cloning the repo, running `make help` will display a list of commands.
## Setup
These instructions will cover system configuration, cloning the source repo,
building, reproducing official releases, and running NodeJS and browser tests.
:::note
These instructions were tested on the following platforms:
| Platform                      | Test Date  |
|:------------------------------|:-----------|
| Linux (Steam Deck Holo x64)   | 2023-09-22 |
| Linux (Ubuntu 18 AArch64)     | 2023-09-07 |
| MacOS 10.13.6 (x64)           | 2023-09-30 |
| MacOS 13.6 (ARM64)            | 2023-09-30 |
| Windows 10 (x64) + WSL Ubuntu | 2023-07-23 |
| Windows 11 (x64) + WSL Ubuntu | 2023-08-31 |
| Windows 11 (ARM) + WSL Ubuntu | 2023-09-18 |
With some additional dependencies, the unminified scripts are reproducible and
tests will pass in Windows XP with NodeJS 5.10.0.
:::
### Install dependencies
#### OS-Specific Setup
import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
  
A) Ensure WSL ("WSL 2" in Windows 10) and the Ubuntu distribution are installed.
B) Install mercurial and subversion:
```bash
sudo apt-get update
sudo apt-get install mercurial subversion
```
:::note pass
In some Windows 10 runs, `mercurial` and `subversion` were not available in the
default Ubuntu distro. A separate repository is available:
```bash
# Install support programs for the build and test commands
sudo add-apt-repository ppa:mercurial-ppa/releases
sudo apt-get update
sudo apt-get install mercurial subversion
sudo add-apt-repository --remove ppa:mercurial-ppa/releases
```
If the first command displays an error involving a missing release file, remove
the repo before proceeding:
```bash
sudo add-apt-repository --remove ppa:mercurial-ppa/releases
```
:::
C) Install NodeJS
:::info pass
In the most recent test, the script showed a deprecation notice.
**The script worked as expected.**
The official workaround does not currently work with WSL. When the issues are
resolved, the instructions will be updated.
:::
```bash
# Install bootstrap NodeJS and NPM within the WSL
curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash -
sudo apt-get install -y nodejs
```
Exit the WSL window and open a new one before proceeding:
```bash
# Switch to `n`-managed NodeJS
sudo npm i -g n
sudo n 16
```
:::note pass
If `npm` is missing, it can be installed with
```bash
sudo apt-get install -y npm
```
:::
D) Test clone the [`js-crc32` repo](https://git.sheetjs.com/sheetjs/js-crc32)
```bash
git clone https://git.sheetjs.com/sheetjs/js-crc32
```
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:
```bash
# Git does not support OpenSSL out of the box, must do this
curl -LO https://github.com/niko-dunixi/git-openssl-shellscript/raw/main/compile-git-with-openssl.sh
chmod +x compile-git-with-openssl.sh
./compile-git-with-openssl.sh
```
E) Set `git` config `core.autocrlf` setting to `false`. The following commands
should be run twice, once within PowerShell (if Git for Windows is installed)
and once within WSL bash:
```bash
git config --global --add core.autocrlf false
git config --global --unset core.autocrlf true
```
F) Run `unzip`. If the program is missing, install manually:
```bash
sudo apt-get install -y unzip
```
  
  
A) Open a terminal window and run `git`.
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:
```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
```
The message should state that analytics are disabled or destroyed.
D) Install Mercurial and Subversion:
```bash
brew install mercurial subversion
```
E) Install NodeJS.
:::note pass
[The official NodeJS site](https://nodejs.org/en/download/) provides installers
for "LTS" and "Current" releases.  The "LTS" version should be installed.
**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
curl -LO https://nodejs.org/download/release/v12.22.12/node-v12.22.12.pkg 
open node-v12.22.12.pkg
```
:::
  
  
A) Install `curl`, `mercurial`, `git`, and `subversion` using the system package
manager. On Debian and Ubuntu systems, `apt-get` installs packages:
```bash
sudo apt update
sudo apt-get install curl git mercurial subversion
```
Other Linux distributions may use other package managers.
Steam Deck (click to show)
Desktop Mode on the Steam Deck uses `pacman`.  It also requires a few steps.
0) Switch to Desktop mode and open `Konsole`
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
sudo sh -c 'echo "keyserver hkps://keyserver.ubuntu.com" >> /etc/pacman.d/gnupg/gpg.conf'
sudo pacman-key --init
sudo pacman-key --populate
sudo pacman-key --refresh-keys
```
4) Install dependencies:
```bash
sudo pacman -S base-devel mercurial subversion
```
:::note pass
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
```
This is *not required* for building or testing the library.
:::