Skip to content
This repository has been archived by the owner on Dec 5, 2017. It is now read-only.

Commit

Permalink
version bump 1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SheetJSDev committed Dec 5, 2017
1 parent 0ba2ead commit 9c4e6c4
Show file tree
Hide file tree
Showing 17 changed files with 701 additions and 299 deletions.
21 changes: 21 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"env": { "shared-node-browser":true },
"globals": {},
"parserOptions": {
"ecmaVersion": 3,
},
"plugins": [ "html", "json" ],
"!extends": "eslint:recommended",
"rules": {
"no-use-before-define": [ 1, {
"functions":false, "classes":true, "variables":false
}],
"no-console": 0,
"no-bitwise": 0,
"curly": 0,
"comma-style": [ 2, "last" ],
"no-trailing-spaces": 2,
"semi": [ 2, "always" ],
"comma-dangle": [ 2, "never" ]
}
}
33 changes: 33 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
[ignore]
.*/node_modules/.*
.*/dist/.*
.*/tmp/.*

.*/ctest/.*
.*/misc/.*
.*/perf/.*
.*/_book/.*

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

.*/xlsx.js
.*/xlsxworker.js
.*/jszip.js
.*/tests/.*
.*/demos/.*

[include]
j.js
.*/bin/.*.njs
test.js

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

[options]
module.file_ext=.js
module.file_ext=.njs
module.ignore_non_literal_requires=true
suppress_comment= \\(.\\|\n\\)*\\$FlowIgnore
32 changes: 30 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,32 @@
node_modules/
node_modules
test_files/
tmp/
package-lock.json
*.tgz
_book/
misc/coverage.html
misc/prof.js
v8.log
tmp
*.[tT][xX][tT]
*.[cC][sS][vV]
*.[dD][iIbB][fF]
*.[pP][rR][nN]
*.[sS][lL][kK]
*.socialcalc
*.[xX][lL][sSwWcC]
*.[xX][lL][sS][xXmMbB]
*.[oO][dD][sS]
*.[fF][oO][dD][sS]
*.[xX][mM][lL]
*.[uU][oO][sS]
*.[wW][kKqQbB][S1234567890]
*.[qQ][pP][wW]
*.[bB][iI][fF][fF][23458]
*.[rR][tT][fF]
*.[eE][tT][hH]
*.123
*.htm
*.html
*.sheetjs
*.exe
*.img
19 changes: 19 additions & 0 deletions .spelling
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
SheetJS
js-xlsx
xls
xlsb
xlsx
js-xls
js-harb

# Excel-related terms
FoxPro
OpenDocument
Quattro
SpreadsheetML
dBASE
Ethercalc

# Other terms
UTF-16

3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
language: node_js
node_js:
- "9"
- "8"
- "7"
- "6"
- "5"
- "4"
- "0.12"
- "0.10"
- "0.9"
- "0.8"
before_install:
- "npm install -g npm@4.3.0"
Expand Down
51 changes: 36 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ CMDS=bin/j.njs
HTMLLINT=

TARGET=$(LIB).js
UGLIFYOPTS=--support-ie8
FLOWTARGET=$(LIB).js
FLOWTGTS=$(TARGET) $(AUXTARGETS) $(AUXSCPTS)
UGLIFYOPTS=--support-ie8 -m
CLOSURE=/usr/local/lib/node_modules/google-closure-compiler/compiler.jar

## Main Targets

Expand All @@ -31,38 +34,51 @@ formats.png: formats.dot
.PHONY: nexe
nexe: j.exe ## Build nexe standalone executable

j.exe: bin/j.njs
nexe -i $< -o $@ --flags
j.exe: bin/j.njs j.js
tail -n+2 $< | sed 's#\.\./#./j#g' > nexe.js
nexe -i nexe.js -o $@
rm nexe.js

.PHONY: pkg
pkg: bin/j.njs j.js ## Build pkg standalone executable
pkg $<

## Testing

.PHONY: test mocha
test mocha: test.js ## Run test suite
mocha -R spec -t 30000
mocha -R spec -t 20000

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

.PHONY: 2011
2011:
./tests/open_excel_2011.sh
.PHONY: travis
travis: ## Run test suite with minimal output
mocha -R dot -t 30000

.PHONY: numbers
numbers:
./tests/open_numbers.sh

## Code Checking

.PHONY: fullint
fullint: lint old-lint flow ## Run all checks

.PHONY: lint
lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
lint: $(TARGET) $(AUXTARGETS) ## Run eslint checks
@eslint --ext .js,.njs,.json,.html,.htm $(TARGET) $(AUXTARGETS) $(CMDS) $(HTMLLINT) package.json bower.json
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi

.PHONY: old-lint
old-lint: $(TARGET) $(AUXTARGETS) ## Run jshint and jscs checks
@jshint --show-non-errors $(TARGET) $(AUXTARGETS)
@jshint --show-non-errors $(CMDS)
@jshint --show-non-errors package.json
@jshint --show-non-errors package.json test.js
@jshint --show-non-errors --extract=always $(HTMLLINT)
@jscs $(TARGET) $(AUXTARGETS)
@jscs $(TARGET) $(AUXTARGETS) test.js
if [ -e $(CLOSURE) ]; then java -jar $(CLOSURE) $(REQS) $(FLOWTARGET) --jscomp_warning=reportUnknownTypes >/dev/null; fi

.PHONY: flow
flow: lint ## Run flow checker
Expand All @@ -78,12 +94,17 @@ $(COVFMT): cov_%:
FMTS=$* make cov

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

.PHONY: coveralls
coveralls: ## Coverage Test + Send to coveralls.io
mocha --require blanket --reporter mocha-lcov-reporter -t 30000 | node ./node_modules/coveralls/bin/coveralls.js
mocha --require blanket --reporter mocha-lcov-reporter -t 20000 | node ./node_modules/coveralls/bin/coveralls.js

MDLINT=README.md
.PHONY: mdlint
mdlint: $(MDLINT) ## Check markdown documents
alex $^
mdspell -a -n -x -r --en-us $^

.PHONY: help
help:
Expand Down
69 changes: 41 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# J

NOTE: this library / tool is a relic from a time when the SheetJS Spreadsheet
Parsing and Writing libraries were separate entities. They have been unified in
the [js-xlsx project](https://git.io/xlsx), [`xlsx` on NPM](http://npm.im/xlsx).
New projects should be using that library directly.

Simple data wrapper that attempts to wrap SheetJS libraries to provide a uniform
way to access data from Excel and other spreadsheet files:

- JS-XLS: [xlsjs on npm](http://npm.im/xlsjs)
- JS-XLSX: [xlsx on npm](http://npm.im/xlsx)
- JS-HARB: [harb on npm](http://npm.im/harb)
- JS-XLSX: [`xlsx` on NPM](http://npm.im/xlsx)
- JS-XLS: [`xlsjs` on NPM](http://npm.im/xlsjs)
- JS-HARB: [`harb` on NPM](http://npm.im/harb)

Excel files are parsed based on the content (not by filename). For example, CSV
Excel files are parsed based on the content (not by extension). For example, CSV
files can be renamed to .XLS and excel will do the right thing.

Supported Formats:
Expand All @@ -17,29 +22,31 @@ Supported Formats:
| **Excel Worksheet/Workbook Formats** |:-----:|:-----:|
| Excel 2007+ XML Formats (XLSX/XLSM) | :o: | :o: |
| Excel 2007+ Binary Format (XLSB BIFF12) | :o: | :o: |
| Excel 2003-2004 XML Format (XML "SpreadsheetML") | :o: | |
| Excel 97-2004 (XLS BIFF8) | :o: | |
| Excel 5.0/95 (XLS BIFF5) | :o: | |
| Excel 2003-2004 XML Format (XML "SpreadsheetML") | :o: | :o: |
| Excel 97-2004 (XLS BIFF8) | :o: | :o: |
| Excel 5.0/95 (XLS BIFF5) | :o: | :o: |
| Excel 4.0 (XLS/XLW BIFF4) | :o: | |
| Excel 3.0 (XLS BIFF3) | :o: | |
| Excel 2.0/2.1 (XLS BIFF2) | :o: | :o: |
| **Excel Supported Text Formats** |:-----:|:-----:|
| Delimiter-Separated Values (CSV/TSV/DSV) | :o: | :o: |
| Delimiter-Separated Values (CSV/TXT) | :o: | :o: |
| Data Interchange Format (DIF) | :o: | :o: |
| Symbolic Link (SYLK/SLK) | :o: | :o: |
| Space-Delimited Text (PRN) | :o: | |
| UTF-16 Unicode Text (TXT) | :o: | |
| Lotus Formatted Text (PRN) | :o: | :o: |
| UTF-16 Unicode Text (TXT) | :o: | :o: |
| **Other Workbook/Worksheet Formats** |:-----:|:-----:|
| OpenDocument Spreadsheet (ODS) | :o: | :o: |
| Flat XML ODF Spreadsheet (FODS) | :o: | :o: |
| Uniform Office Format Spreadsheet (标文通 UOS1/UOS2) | :o: | |
| dBASE II/III/IV / Visual FoxPro (DBF) | :o: | |
| dBASE II/III/IV / Visual FoxPro (DBF) | :o: | :o: |
| Lotus 1-2-3 (WKS/WK1/WK2/WK3/WK4/123) | :o: | |
| Quattro Pro Spreadsheet (WQ1/WQ2/WB1/WB2/WB3/QPW) | :o: | |
| **Other Common Spreadsheet Output Formats** |:-----:|:-----:|
| HTML Tables | :o: | :o: |
| Rich Text Format tables (RTF) | | :o: |
| Ethercalc Record Format (ETH) | :o: | :o: |
| Markdown Tables | | :o: |
| **Other Output Formats** |:-----:|:-----:|
| XML Data (XML) | | :o: |
| SocialCalc | :o: | :o: |

![circo graph of format support](formats.png)

Expand All @@ -55,13 +62,13 @@ $ npm install -g j
var J = require('j');
```

`J.readFile(filename)` opens the file specified by filename and returns an array
`J.readFile(filename)` opens file specified by `filename` and returns an array
whose first object is the parsing object (XLS or XLSX) and whose second object
is the parsed file.

`J.utils` has various helpers that expect an array like those from readFile:
`J.utils` has various helpers that expect an array like those from `readFile`:

| Format | util helper |
| Format | utility function |
|:---------------------------------------------------------|:------------------|
| Excel 2007+ XML Formats (XLSX/XLSM) | `to_xlsx/to_xlsm` |
| Excel 2007+ Binary Format (XLSB BIFF12) | `to_xlsb` |
Expand All @@ -74,7 +81,7 @@ is the parsed file.
| HTML Tables | `to_html` |
| Markdown Tables | `to_md` |
| XML Data (XML) | `to_xml` |
| SocialCalc | `to_socialcalc` |
| Ethercalc Record Format (ETH) | `to_socialcalc` |
| JSON Row Objects | `to_json` |
| List of Formulae | `to_formulae` |

Expand All @@ -91,7 +98,7 @@ $ j --help
-h, --help output usage information
-V, --version output the version number
-f, --file <file> use specified file (- for stdin)
-f, --file <file> use specified workbook (- for stdin)
-s, --sheet <sheet> print specified sheet (default first sheet)
-N, --sheet-index <idx> use specified sheet index (0-based)
-p, --password <pw> if file is encrypted, try with specified pw
Expand All @@ -101,27 +108,33 @@ $ j --help
-M, --xlsm emit XLSM to <sheetname> or <file>.xlsm
-X, --xlsx emit XLSX to <sheetname> or <file>.xlsx
-Y, --ods emit ODS to <sheetname> or <file>.ods
-8, --xls emit XLS to <sheetname> or <file>.xls (BIFF8)
-5, --biff5 emit XLS to <sheetname> or <file>.xls (BIFF5)
-2, --biff2 emit XLS to <sheetname> or <file>.xls (BIFF2)
-6, --xlml emit SSML to <sheetname> or <file>.xls (2003 XML)
-T, --fods emit FODS to <sheetname> or <file>.fods (Flat ODS)
-S, --formulae print formulae
-S, --formulae emit list of values and formulae
-j, --json emit formatted JSON (all fields text)
-J, --raw-js emit raw JS object (raw numbers)
-A, --arrays emit rows as JS objects (raw numbers)
-H, --html emit HTML to <sheetname> or <file>.html
-D, --dif emit DIF to <sheetname> or <file>.dif (Lotus DIF)
-U, --dbf emit DBF to <sheetname> or <file>.dbf (MSVFP DBF)
-K, --sylk emit SYLK to <sheetname> or <file>.slk (Excel SYLK)
-P, --prn emit PRN to <sheetname> or <file>.prn (Lotus PRN)
-E, --eth emit ETH to <sheetname> or <file>.eth (Ethercalc)
-t, --txt emit TXT to <sheetname> or <file>.txt (UTF-8 TSV)
-r, --rtf emit RTF to <sheetname> or <file>.txt (Table RTF)
-x, --xml emit XML
-H, --html emit HTML
-m, --markdown emit markdown table
-D, --dif emit data interchange format (dif)
-K, --sylk emit symbolic link (sylk)
-E, --socialcalc emit socialcalc
-F, --field-sep <sep> CSV field separator
-R, --row-sep <sep> CSV row separator
-n, --sheet-rows <num> Number of rows to process (0=all rows)
--sst generate shared string table for XLS* formats
--compress use compression when writing XLSX/M/B and ODS
--perf do not generate output
--all parse everything
--read read but do not generate output
--all parse everything; write as much as possible
--dev development mode
--read read but do not print out contents
-q, --quiet quiet mode
```

Expand All @@ -144,9 +157,9 @@ Please consult the attached LICENSE file for details. All rights not explicitly



## Using J for diffing XLS/XLSB/XLSM/XLSX files
## Using J for diffing spreadsheet files

Using git textconv, you can use `J` to generate more meaningful diffs!
Using `git textconv`, you can use `J` to generate more meaningful diffs!

One-time configuration (`misc/gitdiff.sh`):

Expand Down
Loading

0 comments on commit 9c4e6c4

Please sign in to comment.