| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | ## Contributing
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Due to the precarious nature of the Open Specifications Promise, it is very | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | important to ensure code is cleanroom.  [Contribution Notes](CONTRIBUTING.md) | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | <details> | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  |   <summary><b>File organization</b> (click to show)</summary> | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | At a high level, the final script is a concatenation of the individual files in | 
					
						
							|  |  |  | the `bits` folder.  Running `make` should reproduce the final output on all | 
					
						
							|  |  |  | platforms.  The README is similarly split into bits in the `docbits` folder. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | Folders: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | | folder       | contents                                                      | | 
					
						
							|  |  |  | |:-------------|:--------------------------------------------------------------| | 
					
						
							|  |  |  | | `bits`       | raw source files that make up the final script                | | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | | `docbits`    | raw markdown files that make up `README.md`                   | | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | | `bin`        | server-side bin scripts (`xlsx.njs`)                          | | 
					
						
							|  |  |  | | `dist`       | dist files for web browsers and nonstandard JS environments   | | 
					
						
							|  |  |  | | `demos`      | demo projects for platforms like ExtendScript and Webpack     | | 
					
						
							|  |  |  | | `tests`      | browser tests (run `make ctest` to rebuild)                   | | 
					
						
							|  |  |  | | `types`      | typescript definitions and tests                              | | 
					
						
							|  |  |  | | `misc`       | miscellaneous supporting scripts                              | | 
					
						
							|  |  |  | | `test_files` | test files (pulled from the test files repository)            | | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | </details> | 
					
						
							| 
									
										
										
										
											2017-04-28 07:28:03 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | After cloning the repo, running `make help` will display a list of commands. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | ### OSX/Linux
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | <details> | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  |   <summary>(click to show)</summary> | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | The `xlsx.js` file is constructed from the files in the `bits` subdirectory. The | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | build script (run `make`) will concatenate the individual bits to produce the | 
					
						
							|  |  |  | script.  Before submitting a contribution, ensure that running make will produce | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | the `xlsx.js` file exactly.  The simplest way to test is to add the script: | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```bash | 
					
						
							|  |  |  | $ git add xlsx.js | 
					
						
							|  |  |  | $ make clean | 
					
						
							|  |  |  | $ make | 
					
						
							|  |  |  | $ git diff xlsx.js | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | To produce the dist files, run `make dist`.  The dist files are updated in each | 
					
						
							|  |  |  | version release and *should not be committed between versions*. | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | </details> | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | ### Windows
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | <details> | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  |   <summary>(click to show)</summary> | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | The included `make.cmd` script will build `xlsx.js` from the `bits` directory. | 
					
						
							|  |  |  | Building is as simple as: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ```cmd | 
					
						
							| 
									
										
										
										
											2017-04-24 10:39:00 +00:00
										 |  |  | > make
 | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | To prepare development environment: | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | ```cmd | 
					
						
							| 
									
										
										
										
											2017-04-24 10:39:00 +00:00
										 |  |  | > make init
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | The full list of commands available in Windows are displayed in `make help`: | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | ``` | 
					
						
							|  |  |  | make init -- install deps and global modules | 
					
						
							|  |  |  | make lint -- run eslint linter | 
					
						
							|  |  |  | make test -- run mocha test suite | 
					
						
							|  |  |  | make misc -- run smaller test suite | 
					
						
							|  |  |  | make book -- rebuild README and summary | 
					
						
							|  |  |  | make help -- display this message | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | ``` | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | </details> | 
					
						
							| 
									
										
										
										
											2017-04-09 07:11:08 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | ### Tests
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <details> | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  |   <summary>(click to show)</summary> | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | The `test_misc` target (`make test_misc` on Linux/OSX / `make misc` on Windows) | 
					
						
							|  |  |  | runs the targeted feature tests.  It should take 5-10 seconds to perform feature | 
					
						
							|  |  |  | tests without testing against the entire test battery.  New features should be | 
					
						
							|  |  |  | accompanied with tests for the relevant file formats and features. | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | For tests involving the read side, an appropriate feature test would involve | 
					
						
							|  |  |  | reading an existing file and checking the resulting workbook object.  If a | 
					
						
							| 
									
										
										
										
											2017-09-24 23:40:09 +00:00
										 |  |  | parameter is involved, files should be read with different values to verify that | 
					
						
							|  |  |  | the feature is working as expected. | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | 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. | 
					
						
							| 
									
										
										
										
											2017-03-20 09:02:25 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 17:45:35 +00:00
										 |  |  | For tests involving a new write feature without an existing read ability, please | 
					
						
							|  |  |  | add a feature test to the kitchen sink `tests/write.js`. | 
					
						
							| 
									
										
										
										
											2017-04-30 20:37:53 +00:00
										 |  |  | </details> | 
					
						
							| 
									
										
										
										
											2017-04-10 05:10:54 +00:00
										 |  |  | 
 |