Skip to main content

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:

folder文件夹contents内容
bitsraw source files that make up the final script构成最终脚本的原始源文件
binserver-side bin scripts服务器端bin脚本 (xlsx.njs)
distdist files for web browsers and nonstandard JS environments用于web浏览器和非标准JS环境的dist文件
demosdemo projects for platforms like ExtendScript and WebpackExtendScript和Webpack等平台的演示项目
testsbrowser tests (run make ctest to rebuild)浏览器测试(运行make ctest以重建)
typestypescript definitions and teststypescript定义和测试
miscmiscellaneous supporting scripts其他支持脚本
test_filestest files (pulled from the test files repository)测试文件(从测试文件存储库中提取)

After cloning the repo, running make help will display a list of commands.克隆repo后,运行make help将显示命令列表。

OS-Specific Setup操作系统特定设置

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部分中继续)

Development开发

The xlsx.js and xlsx.mjs files are constructed from the files in the bits subdirectory. xlsx.jsxlsx.mjs文件是从bits子目录中的文件构造的。The build script (run make) will concatenate the individual bits to produce the scripts.构建脚本(运行make)将连接各个位以生成脚本。

To produce the dist files, run make dist. 要生成dist文件,请运行make distThe 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 tests/write.js.对于涉及没有现有读取能力的新写功能的测试,请将功能测试添加到kitchen sink tests/write.js