Skip to content

Commit

Permalink
Windows build (fixes SheetJS#589 h/t @simon-p-r)
Browse files Browse the repository at this point in the history
run `make help` for more info
  • Loading branch information
reviewher committed Apr 24, 2017
1 parent 0fd1104 commit 83ec606
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 14 deletions.
17 changes: 13 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1540,15 +1540,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
Building is as simple as:

```cmd
> make.cmd
> make
```

To prepare dev environment:

```cmd
> npm install -g mocha
> npm install
> mocha -t 30000
> 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
```

The normal approach uses a variety of command line tools to grab the test files.
Expand Down
17 changes: 13 additions & 4 deletions docbits/95_contrib.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,24 @@ The included `make.cmd` script will build `xlsx.js` from the `bits` directory.
Building is as simple as:

```cmd
> make.cmd
> make
```

To prepare dev environment:

```cmd
> npm install -g mocha
> npm install
> mocha -t 30000
> 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
```

The normal approach uses a variety of command line tools to grab the test files.
Expand Down
32 changes: 30 additions & 2 deletions make.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,30 @@
type bits\* > xlsx.flow.js
node misc\strip_flow.js > xlsx.js
@echo off
REM vim: set ts=2:

if "%1" == "help" (
echo make init -- install deps and global modules
echo make lint -- run eslint linter
echo make test -- run mocha test suite
echo remember to download the test_files release!
echo make misc -- run smaller test suite
echo make book -- rebuild README and summary
echo make help -- display this message
) else if "%1" == "init" (
npm install
npm install -g eslint eslint-plugin-html eslint-plugin-json
npm install -g mocha markdown-toc
) else if "%1" == "lint" (
eslint --ext .js,.njs,.json,.html,.htm xlsx.js xlsx.flow.js bin/xlsx.njs package.json bower.json
) else if "%1" == "test" (
SET FMTS=
mocha -R spec -t 30000
) else if "%1" == "misc" (
SET FMTS=misc
mocha -R spec -t 30000
) else if "%1" == "book" (
type docbits\*.md > README.md
markdown-toc -i README.md
) else (
type bits\*.js > xlsx.flow.js
node misc\strip_flow.js > xlsx.js
)
9 changes: 5 additions & 4 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ if(process.env.FMTS) ex=process.env.FMTS.split(":").map(function(x){return x[0]=
var exp = ex.map(function(x){ return x + ".pending"; });
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; }

var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n") : fs.readdirSync('test_files')).filter(test_file);
var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n") : []).filter(test_file);
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);
var fileA = (fs.existsSync('testA.lst') ? fs.readFileSync('testA.lst', 'utf-8').split("\n").map(function(x) { return x.trim(); }) : []).filter(test_file);

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

describe('should preserve page margins', function() {[
(fs.existsSync(paths.pmxlsx) ? describe : describe.skip)('should preserve page margins', function() {[
//['xlml', paths.pmxml],
['xlsx', paths.pmxlsx],
['xlsb', paths.pmxlsb]
Expand Down Expand Up @@ -1654,7 +1655,7 @@ describe('encryption', function() {

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

0 comments on commit 83ec606

Please sign in to comment.