Skip to content

Commit

Permalink
version bump 0.8.1: fixes to support node 4+
Browse files Browse the repository at this point in the history
- codepage updated to 1.6.0 (latest)
- clean up Makefile
- adapted .travis.yml to support 0.8
- removed test files that drifted from baseline
- removed XLSB pseudo-inverse tests due to fails in node 4+
  • Loading branch information
SheetJSDev committed Dec 31, 2016
1 parent 53f7f6d commit 2a756ff
Show file tree
Hide file tree
Showing 34 changed files with 369 additions and 276 deletions.
26 changes: 26 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[ignore]
.*/node_modules/.*
.*/dist/.*
.*/test.js

.*/bits/.*
.*/ctest/.*
.*/misc/.*
.*/perf/.*

.*/demo/browser.js
.*/shim.js

[include]
xlsx.js
.*/bin/.*.njs
.*/demo/browser.flow.js

[libs]
misc/flow.js
misc/flowdeps.js

[options]
module.file_ext=.js
module.file_ext=.njs

1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ test.js
.jscs.json
.gitmodules
.travis.yml
.flowconfig
bits/
odsbits/
tests/
12 changes: 8 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
language: node_js
node_js:
- "iojs"
- "0.11.14"
- "7"
- "6"
- "5"
- "4.2"
- "0.12"
- "0.10"
# - "0.8" # commented because of npm issue with camelcase
- "0.8"
before_install:
- "npm install -g mocha"
- "npm install -g npm@next"
- "npm install -g mocha voc"
- "npm install blanket"
- "npm install xlsjs"
- "npm install coveralls mocha-lcov-reporter"
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (C) 2012-2015 SheetJS
Copyright (C) 2012-present SheetJS

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
123 changes: 67 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
SHELL=/bin/bash
LIB=xlsx
FMT=xlsx xlsm xlsb ods xls xml misc full
REQS=jszip.js
ADDONS=dist/cpexcel.js
AUXTARGETS=ods.js
CMDS=bin/xlsx.njs
HTMLLINT=index.html

ULIB=$(shell echo $(LIB) | tr a-z A-Z)
DEPS=$(sort $(wildcard bits/*.js))
TARGET=$(LIB).js
FLOWTARGET=$(LIB).flow.js

## Main Targets

.PHONY: all
all: $(TARGET) $(AUXTARGETS)
all: $(TARGET) $(AUXTARGETS) ## Build library and auxiliary scripts

$(TARGET): $(DEPS)
cat $^ | tr -d '\15\32' > $@
Expand All @@ -21,96 +27,101 @@ bits/18_cfb.js: node_modules/cfb/dist/xlscfb.js
cp $^ $@

.PHONY: clean
clean:
clean: ## Remove targets and build artifacts
rm -f $(TARGET)

.PHONY: clean-data
clean-data:
rm -f *.xlsx *.xlsm *.xlsb *.xls *.xml

.PHONY: init
init:
init: ## Initial setup for development
git submodule init
git submodule update
git submodule foreach git pull origin master
git submodule foreach make
mkdir -p tmp

.PHONY: dist
dist: dist-deps $(TARGET) bower.json ## Prepare JS files for distribution
cp $(TARGET) dist/
cp LICENSE dist/
uglifyjs $(TARGET) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).min.js
uglifyjs $(REQS) $(TARGET) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).core.min.js
uglifyjs $(REQS) $(ADDONS) $(TARGET) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).full.min.js

.PHONY: dist-deps
dist-deps: ods.js ## Copy dependencies for distribution
cp node_modules/codepage/dist/cpexcel.full.js dist/cpexcel.js
cp jszip.js dist/jszip.js
cp ods.js dist/ods.js

bower.json: misc/_bower.json package.json
cat $< | sed 's/_VERSION_/'`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`'/' > $@

.PHONY: aux
aux: $(AUXTARGETS)

.PHONY: ods
ods: ods.js

ODSDEPS=$(sort $(wildcard odsbits/*.js))
ods.js: $(ODSDEPS) ## Build ODS support library
cat $(ODSDEPS) | tr -d '\15\32' > $@
cp ods.js dist/ods.js


## Testing

.PHONY: test mocha
test mocha: test.js
mkdir -p tmp
test mocha: test.js ## Run test suite
mocha -R spec -t 20000

.PHONY: prof
prof:
cat misc/prof.js test.js > prof.js
node --prof prof.js

#* To run tests for one format, make test_<fmt>
TESTFMT=$(patsubst %,test_%,$(FMT))
.PHONY: $(TESTFMT)
$(TESTFMT): test_%:
FMTS=$* make test


## Code Checking

.PHONY: lint
lint: $(TARGET)
jshint --show-non-errors $(TARGET) $(AUXTARGETS)
jshint --show-non-errors package.json bower.json
jscs $(TARGET) $(AUXTARGETS)
lint: $(TARGET) ## Run jshint and jscs checks
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
@jshint --show-non-errors $(CMDS)
@jshint --show-non-errors package.json bower.json
@jshint --show-non-errors --extract=always $(HTMLLINT)
@jscs $(TARGET) $(AUXTARGETS)

.PHONY: test-osx
test-osx:
node tests/write.js
open -a Numbers sheetjs.xlsx
open -a "Microsoft Excel" sheetjs.xlsx
.PHONY: flow
flow: lint ## Run flow checker
@flow check --all --show-all-errors

.PHONY: cov cov-spin
cov: misc/coverage.html
cov-spin:
make cov & bash misc/spin.sh $$!
cov: misc/coverage.html ## Run coverage test

#* To run coverage tests for one format, make cov_<fmt>
COVFMT=$(patsubst %,cov_%,$(FMT))
.PHONY: $(COVFMT)
$(COVFMT): cov_%:
FMTS=$* make cov

misc/coverage.html: $(TARGET) test.js
mocha --require blanket -R html-cov > $@
mocha --require blanket -R html-cov -t 20000 > $@

.PHONY: coveralls coveralls-spin
coveralls:
mocha --require blanket --reporter mocha-lcov-reporter | ./node_modules/coveralls/bin/coveralls.js

coveralls-spin:
make coveralls & bash misc/spin.sh $$!

bower.json: misc/_bower.json package.json
cat $< | sed 's/_VERSION_/'`grep version package.json | awk '{gsub(/[^0-9a-z\.-]/,"",$$2); print $$2}'`'/' > $@

.PHONY: dist
dist: dist-deps $(TARGET) bower.json
cp $(TARGET) dist/
cp LICENSE dist/
uglifyjs $(TARGET) -o dist/$(LIB).min.js --source-map dist/$(LIB).min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).min.js
uglifyjs $(REQS) $(TARGET) -o dist/$(LIB).core.min.js --source-map dist/$(LIB).core.min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).core.min.js
uglifyjs $(REQS) $(ADDONS) $(TARGET) -o dist/$(LIB).full.min.js --source-map dist/$(LIB).full.min.map --preamble "$$(head -n 1 bits/00_header.js)"
misc/strip_sourcemap.sh dist/$(LIB).full.min.js
coveralls: ## Coverage Test + Send to coveralls.io
mocha --require blanket --reporter mocha-lcov-reporter -t 20000 | node ./node_modules/coveralls/bin/coveralls.js

.PHONY: aux
aux: $(AUXTARGETS)

.PHONY: ods
ods: ods.js
.PHONY: help
help:
@grep -hE '(^[a-zA-Z_-][ a-zA-Z_-]*:.*?|^#[#*])' $(MAKEFILE_LIST) | bash misc/help.sh

ODSDEPS=$(sort $(wildcard odsbits/*.js))
ods.js: $(ODSDEPS)
cat $(ODSDEPS) | tr -d '\15\32' > $@
cp ods.js dist/ods.js

.PHONY: dist-deps
dist-deps: ods.js
cp node_modules/codepage/dist/cpexcel.full.js dist/cpexcel.js
cp jszip.js dist/jszip.js
cp ods.js dist/ods.js
#* To show a spinner, append "-spin" to any target e.g. cov-spin
%-spin:
@make $* & bash misc/spin.sh $$!
Loading

1 comment on commit 2a756ff

@timruffles
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 great! :)

Please sign in to comment.