Skip to content

Commit 83ec606

Browse files
committed
Windows build (fixes SheetJS#589 h/t @simon-p-r)
run `make help` for more info
1 parent 0fd1104 commit 83ec606

File tree

4 files changed

+61
-14
lines changed

4 files changed

+61
-14
lines changed

README.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -1540,15 +1540,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
15401540
Building is as simple as:
15411541

15421542
```cmd
1543-
> make.cmd
1543+
> make
15441544
```
15451545

15461546
To prepare dev environment:
15471547

15481548
```cmd
1549-
> npm install -g mocha
1550-
> npm install
1551-
> mocha -t 30000
1549+
> make init
1550+
```
1551+
1552+
The full list of commands available in Windows are displayed in `make help`:
1553+
1554+
```
1555+
make init -- install deps and global modules
1556+
make lint -- run eslint linter
1557+
make test -- run mocha test suite
1558+
make misc -- run smaller test suite
1559+
make book -- rebuild README and summary
1560+
make help -- display this message
15521561
```
15531562

15541563
The normal approach uses a variety of command line tools to grab the test files.

docbits/95_contrib.md

+13-4
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
2626
Building is as simple as:
2727

2828
```cmd
29-
> make.cmd
29+
> make
3030
```
3131

3232
To prepare dev environment:
3333

3434
```cmd
35-
> npm install -g mocha
36-
> npm install
37-
> mocha -t 30000
35+
> make init
36+
```
37+
38+
The full list of commands available in Windows are displayed in `make help`:
39+
40+
```
41+
make init -- install deps and global modules
42+
make lint -- run eslint linter
43+
make test -- run mocha test suite
44+
make misc -- run smaller test suite
45+
make book -- rebuild README and summary
46+
make help -- display this message
3847
```
3948

4049
The normal approach uses a variety of command line tools to grab the test files.

make.cmd

+30-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
1-
type bits\* > xlsx.flow.js
2-
node misc\strip_flow.js > xlsx.js
1+
@echo off
2+
REM vim: set ts=2:
3+
4+
if "%1" == "help" (
5+
echo make init -- install deps and global modules
6+
echo make lint -- run eslint linter
7+
echo make test -- run mocha test suite
8+
echo remember to download the test_files release!
9+
echo make misc -- run smaller test suite
10+
echo make book -- rebuild README and summary
11+
echo make help -- display this message
12+
) else if "%1" == "init" (
13+
npm install
14+
npm install -g eslint eslint-plugin-html eslint-plugin-json
15+
npm install -g mocha markdown-toc
16+
) else if "%1" == "lint" (
17+
eslint --ext .js,.njs,.json,.html,.htm xlsx.js xlsx.flow.js bin/xlsx.njs package.json bower.json
18+
) else if "%1" == "test" (
19+
SET FMTS=
20+
mocha -R spec -t 30000
21+
) else if "%1" == "misc" (
22+
SET FMTS=misc
23+
mocha -R spec -t 30000
24+
) else if "%1" == "book" (
25+
type docbits\*.md > README.md
26+
markdown-toc -i README.md
27+
) else (
28+
type bits\*.js > xlsx.flow.js
29+
node misc\strip_flow.js > xlsx.js
30+
)

test.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ if(process.env.FMTS) ex=process.env.FMTS.split(":").map(function(x){return x[0]=
1919
var exp = ex.map(function(x){ return x + ".pending"; });
2020
function test_file(x){ return ex.indexOf(x.substr(-5))>=0||exp.indexOf(x.substr(-13))>=0 || ex.indexOf(x.substr(-4))>=0||exp.indexOf(x.substr(-12))>=0; }
2121

22-
var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n") : fs.readdirSync('test_files')).filter(test_file);
23-
var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n") : []).filter(test_file);
22+
var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n").map(function(x) { return x.trim(); }) : fs.readdirSync('test_files')).filter(test_file);
23+
var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n").map(function(x) { return x.trim(); }) : []).filter(test_file);
2424

2525
/* Excel enforces 31 character sheet limit, although technical file limit is 255 */
2626
function fixsheetname(x) { return x.substr(0,31); }
@@ -987,6 +987,7 @@ describe('parse features', function() {
987987
describe('page margins', function() {
988988
var wb1, wb2, wb3, wb4, wb5, wbs;
989989
var bef = (function() {
990+
if(!fs.existsSync(paths.pmxls)) return wbs=[];
990991
wb1 = X.readFile(paths.pmxls);
991992
wb2 = X.readFile(paths.pmxls5);
992993
wb3 = X.readFile(paths.pmxml);
@@ -1251,7 +1252,7 @@ describe('roundtrip features', function() {
12511252
});
12521253
});
12531254

1254-
describe('should preserve page margins', function() {[
1255+
(fs.existsSync(paths.pmxlsx) ? describe : describe.skip)('should preserve page margins', function() {[
12551256
//['xlml', paths.pmxml],
12561257
['xlsx', paths.pmxlsx],
12571258
['xlsb', paths.pmxlsb]
@@ -1654,7 +1655,7 @@ describe('encryption', function() {
16541655

16551656
describe('multiformat tests', function() {
16561657
var mfopts = opts;
1657-
var mft = fs.readFileSync('multiformat.lst','utf-8').split("\n");
1658+
var mft = fs.readFileSync('multiformat.lst','utf-8').split("\n").map(function(x) { return x.trim(); });
16581659
var csv = true, formulae = false;
16591660
mft.forEach(function(x) {
16601661
if(x[0]!="#") describe('MFT ' + x, function() {

0 commit comments

Comments
 (0)