Contributing贡献
Due to the precarious nature of the Open Specifications Promise, it is very important to ensure code is cleanroom. 由于开放规范承诺的不稳定性质,确保代码是干净的非常重要。Contribution Notes贡献备忘
File organization (click to show)
At a high level, the final script is a concatenation of the individual files in the 在较高级别上,最终脚本是bits
folder. bits
文件夹中各个文件的串联。Running 运行make
should reproduce the final output on all platforms.make
应该在所有平台上重现最终输出。
Folders:
bits | |
bin | xlsx.njs ) |
dist | |
demos | |
tests | make ctest to rebuild)make ctest 以重建) |
types | |
misc | |
test_files |
After cloning the repo, running 克隆repo后,运行make help
will display a list of commands.make help
将显示命令列表。
OS-Specific Setup操作系统特定设置
- Windows WSL
- OSX/Linux
The OSX/Linux workflow works in WSL. OSX/Linux工作流在WSL中工作。Initial setup is involved:涉及初始设置:
1) Install mercurial and subversion.安装mercurial和subversion。
# 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
2) Install NodeJS安装Node.js
# 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
# CLOSE AND REOPEN SHELL BEFORE CONTINUING
# Switch to `n`-managed NodeJS
sudo npm i -g n
sudo n 16
3) follow https://github.com/paul-nelson-baker/git-openssl-shellscript to build and install a version of Git with OpenSSL:跟随https://github.com/paul-nelson-baker/git-openssl-shellscript以使用OpenSSL构建和安装Git版本,请执行以下操作:
# Git does not support OpenSSL out of the box, must do this
curl -LO https://github.com/paul-nelson-baker/git-openssl-shellscript/raw/main/compile-git-with-openssl.sh
chmod +x compile-git-with-openssl.sh
./compile-git-with-openssl.sh
(instructions continued in the OSX/Linux part)(说明在OSX/Linux部分中继续)
Initial setup:初始设置:
0) Ensure mercurial, subversion, and NodeJS are installed. 确保安装了mercurial、subversion和Node.js。The WSL instructions will have installed these dependencies, so WSL users can skip to step 1.WSL指令将安装这些依赖项,因此WSL用户可以跳到步骤1。
On Linux:在Linux上:
sudo apt-get install mercurial subversion
On MacOS, install using brew:在MacOS上,使用brew安装:
brew install mercurial subversion
NodeJS installers can be found at Node.js安装程序可以在以下位置找到:https://nodejs.org/en/download/
1) Install NodeJS modules for building the scripts安装Node.js模块以构建脚本
# Install dev dependencies
npm install
# Install global dependencies
sudo npm install -g [email protected] voc @sheetjs/uglify-js
2) Initialize the test files:初始化测试文件:
make init
This step may take a while as it will be downloading a number of test files.这一步可能需要一段时间,因为它将下载许多测试文件。
3) Run a short test, then run a build运行短测试,然后运行生成
# Short test
make test_misc
# Full Build
cd modules; make; cd ..
make dist
4) (For Deno testing) Install Deno:(用于Deno测试)安装Deno:
curl -fsSL https://deno.land/install.sh | sh
Development开发
The xlsx.js
and xlsx.mjs
files are constructed from the files in the bits
subdirectory. xlsx.js
和xlsx.mjs
文件是从bits
子目录中的文件构造的。The build script (run 构建脚本(运行make
) will concatenate the individual bits to produce the scripts.make
)将连接各个位以生成脚本。
To produce the dist files, run 要生成dist文件,请运行make dist
. make dist
。The dist files are updated in each version release and should not be committed between versions.dist文件在每个版本中都会更新,不应在版本之间提交。
A note on Older Versions关于旧版本的说明
Some of the dependencies are wildly out of date. 有些依赖关系已经过时了。While SheetJS aims to run in older versions of NodeJS and browsers, some libraries have chosen to break backwards compatibility. 虽然SheetJS的目标是在旧版本的Node.js和浏览器中运行,但一些库选择了破坏向后兼容性。The specific versions are used because they are known to work and known to produce consistent results.之所以使用特定版本,是因为已知它们可以工作,并且可以产生一致的结果。
Tests
The test_misc
target runs the targeted feature tests. test_misc
目标运行目标功能测试。It should take 5-10 seconds to perform feature tests without testing against the full test battery. 在不使用完整测试电池进行测试的情况下,执行功能测试应该需要5-10秒。New features should be accompanied with tests for the relevant file formats.新功能应附带相关文件格式的测试。
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 对于涉及没有现有读取能力的新写功能的测试,请将功能测试添加到kitchen sink tests/write.js
.tests/write.js
。