From c13170fbd51371e491e0c3599b8568631b97487b Mon Sep 17 00:00:00 2001
From: SheetJS <dev@sheetjs.com>
Date: Sun, 9 Apr 2017 03:11:08 -0400
Subject: [PATCH] windows build (see #589 h/t @simon-p-r) [ci skip]

---
 README.md             | 28 ++++++++++++++++++++++++++++
 docbits/95_contrib.md | 26 ++++++++++++++++++++++++++
 make.cmd              |  2 ++
 misc/docs/SUMMARY.md  |  2 ++
 misc/strip_flow.js    |  1 +
 5 files changed, 59 insertions(+)
 create mode 100644 make.cmd
 create mode 100644 misc/strip_flow.js

diff --git a/README.md b/README.md
index 975bb19..5a61e9a 100644
--- a/README.md
+++ b/README.md
@@ -86,6 +86,8 @@ with a unified JS representation, and ES3/ES5 browser compatibility back to IE6.
   * [Tested Environments](#tested-environments)
   * [Test Files](#test-files)
 - [Contributing](#contributing)
+  * [OSX/Linux](#osxlinux)
+  * [Windows](#windows)
 - [License](#license)
 - [References](#references)
 - [Badges](#badges)
@@ -1406,6 +1408,8 @@ Running `make init` will refresh the `test_files` submodule and get the files.
 Due to the precarious nature of the Open Specifications Promise, it is very
 important to ensure code is cleanroom.  Consult CONTRIBUTING.md
 
+### OSX/Linux
+
 The xlsx.js file is constructed from the files in the `bits` subdirectory. The
 build script (run `make`) will concatenate the individual bits to produce the
 script.  Before submitting a contribution, ensure that running make will produce
@@ -1421,7 +1425,31 @@ $ 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*.
 
+### Windows
 
+The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
+Building is as simple as:
+
+```cmd
+> make.cmd
+```
+
+To prepare dev environment:
+
+```cmd
+> npm install -g mocha
+> npm install
+> mocha -t 30000
+```
+
+The normal approach uses a variety of command line tools to grab the test files.
+For windows users, please download the latest version of the test files snapshot
+from [github](https://github.com/SheetJS/test_files/releases)
+
+Latest test files snapshot:
+<https://github.com/SheetJS/test_files/releases/download/20170409/test_files.zip>
+
+Download and unzip to the `test_files` subdirectory.
 ## License
 
 Please consult the attached LICENSE file for details.  All rights not explicitly
diff --git a/docbits/95_contrib.md b/docbits/95_contrib.md
index 97b7c66..d253e6e 100644
--- a/docbits/95_contrib.md
+++ b/docbits/95_contrib.md
@@ -3,6 +3,8 @@
 Due to the precarious nature of the Open Specifications Promise, it is very
 important to ensure code is cleanroom.  Consult CONTRIBUTING.md
 
+### OSX/Linux
+
 The xlsx.js file is constructed from the files in the `bits` subdirectory. The
 build script (run `make`) will concatenate the individual bits to produce the
 script.  Before submitting a contribution, ensure that running make will produce
@@ -18,4 +20,28 @@ $ 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*.
 
+### Windows
 
+The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
+Building is as simple as:
+
+```cmd
+> make.cmd
+```
+
+To prepare dev environment:
+
+```cmd
+> npm install -g mocha
+> npm install
+> mocha -t 30000
+```
+
+The normal approach uses a variety of command line tools to grab the test files.
+For windows users, please download the latest version of the test files snapshot
+from [github](https://github.com/SheetJS/test_files/releases)
+
+Latest test files snapshot:
+<https://github.com/SheetJS/test_files/releases/download/20170409/test_files.zip>
+
+Download and unzip to the `test_files` subdirectory.
diff --git a/make.cmd b/make.cmd
new file mode 100644
index 0000000..9af8589
--- /dev/null
+++ b/make.cmd
@@ -0,0 +1,2 @@
+type bits\* > xlsx.flow.js
+node misc\strip_flow.js > xlsx.js
diff --git a/misc/docs/SUMMARY.md b/misc/docs/SUMMARY.md
index fd322af..fbc9c01 100644
--- a/misc/docs/SUMMARY.md
+++ b/misc/docs/SUMMARY.md
@@ -63,6 +63,8 @@
   * [Tested Environments](README.md#tested-environments)
   * [Test Files](README.md#test-files)
 - [Contributing](README.md#contributing)
+  * [OSX/Linux](README.md#osxlinux)
+  * [Windows](README.md#windows)
 - [License](README.md#license)
 - [References](README.md#references)
 - [Badges](README.md#badges)
diff --git a/misc/strip_flow.js b/misc/strip_flow.js
new file mode 100644
index 0000000..44bc90b
--- /dev/null
+++ b/misc/strip_flow.js
@@ -0,0 +1 @@
+process.stdout.write(require("fs").readFileSync("xlsx.flow.js","utf8").replace(/^[ \t]*\/\*[:#][^*]*\*\/\s*(\n)?/gm,"").replace(/\/\*[:#][^*]*\*\//gm,""))