version bump 0.3.0: necessary cleanup

- merged test repo with xls
- travis integration
- shifted to Apache 2.0 LICENSE
- mocha tests

The shift to Apache 2.0 was long overdue.  It's becoming clear that compliance
requires deeper integration with the xls libraries and other implementations
whose specifications are covered under the OSP.  It was a grave oversight for
the ISO and ECMA people to not try to implement parsers themselves, for if they
did I suspect the outcome would have been much different
This commit is contained in:
SheetJS 2013-10-30 12:26:07 -07:00
parent 5d79aca2da
commit 713f5aa417
10 changed files with 225 additions and 24 deletions

2
.gitmodules vendored

@ -1,3 +1,3 @@
[submodule "tests/files"]
path = tests/files
url = https://github.com/Niggler/js-xlsx-testfiles.git
url = https://github.com/Niggler/test_files.git

9
.travis.yml Normal file

@ -0,0 +1,9 @@
language: node_js
node_js:
- "0.10"
- "0.8"
before_install:
- "npm install -g mocha"
before_script:
- "make init"
- "cd tests/files; make; cd -"

17
LICENSE

@ -1,16 +1,17 @@
Copyright (C) 2012-2013 Niggler
The MIT License (MIT)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Except where noted, this license applies to any and all software programs and associated documentation files created by the Original Author and distributed with the Software:
'jszip.js' is a modified version of JSZip, Copyright (c) Stuart Knightley, David Duponchel, Franz Buchinger, Ant'onio Afonso. JSZip is dual licensed and is used according to the terms of the MIT License.
Any code shared between this project and the Apache-licensed XLS parser by the same author (all of which draws from the ECMA-376 specification) falls under this license.

@ -1,11 +1,27 @@
DEPS=$(wildcard bits/*.js)
xlsx.js: $(DEPS)
TARGET=xlsx.js
$(TARGET): $(DEPS)
cat $^ > $@
.PHONY: clean
clean:
rm xlsx.js
rm $(TARGET)
test:
npm test
.PHONY: init
init:
git submodule init
git submodule update
git submodule foreach git pull origin master
.PHONY: test mocha
test mocha:
mocha -R spec
.PHONY: jasmine
jasmine:
npm run-script test-jasmine
.PHONY: lint
lint: $(TARGET)
jshint --show-non-errors $(TARGET)

@ -61,9 +61,15 @@ For more details:
- `index.html` is the live demo
- `bits/90_utils.js` contains the logic for generating CSV and JSON from sheets
## Test Files
Test files are housed in [another repo](https://github.com/Niggler/test_files).
## License
Please consult the attached LICENSE file for details. All rights not explicitly granted by the MIT license are reserved by the Original Author.
Please consult the attached LICENSE file for details. All rights not explicitly granted by the Apache 2.0 license are reserved by the Original Author.
It is the opinion of the Original Author that this code conforms to the terms of the Microsoft Open Specifications Promise, falling under the same terms as OpenOffice (which is governed by the Apache License v2). Given the vagaries of the promise, the Original Author makes no legal claim that in fact end users are protected from future actions. It is highly recommended that, for commercial uses, you consult a lawyer before proceeding.
## XLS Support
@ -73,3 +79,7 @@ XLS is not supported in this module. Due to Licensing issues [that are discusse
ISO/IEC 29500:2012(E) "Information technology — Document description and processing languages — Office Open XML File Formats"
OSP-covered specifications:
- [MS-XLSX]: Excel (.xlsx) Extensions to the Office Open XML SpreadsheetML File Format

@ -1,6 +1,6 @@
{
"name": "xlsx",
"version": "0.2.8",
"version": "0.3.0",
"author": "Niggler",
"description": "(one day) a full-featured XLSX parser and writer. For now, primitive parser",
"keywords": [
@ -10,19 +10,24 @@
"xlsx2csv": "./bin/xlsx2csv.njs"
},
"main": "./xlsx",
"dependencies": {
"codepage":"",
"commander":""
},
"devDependencies": {
"mocha":"",
"jasmine-node": "x"
},
"repository": {
"type":"git",
"url": "git://github.com/Niggler/js-xlsx.git"
},
"bugs": {
"url": "https://github.com/Niggler/js-xlsx/issues"
},
"devDependencies": {
"jasmine-node": "x"
},
"scripts": {
"pretest": "git submodule init && git submodule update",
"test": "jasmine-node --verbose tests/"
"test": "make mocha",
"test-jasmine": "jasmine-node --verbose tests/"
},
"bugs": { "url": "https://github.com/Niggler/js-xlsx/issues" },
"license": "Apache-2.0",
"engines": { "node": ">=0.6" }
}

39
test.js Normal file

@ -0,0 +1,39 @@
/* vim: set ts=2: */
var XLSX;
var fs = require('fs'), assert = require('assert');
describe('source', function() { it('should load', function() { XLSX = require('./'); }); });
var files = (fs.existsSync('tests.lst') ? fs.readFileSync('tests.lst', 'utf-8').split("\n") : fs.readdirSync('test_files')).filter(function(x){return x.substr(-5)==".xlsx" || x.substr(-13)==".xlsx.pending"});
function parsetest(x, wb) {
describe(x + ' should have all bits', function() {
var sname = './test_files/' + x + '.sheetnames';
it('should have all sheets', function() {
wb.SheetNames.forEach(function(y) { assert(wb.Sheets[y], 'bad sheet ' + y); });
});
it('should have the right sheet names', fs.existsSync(sname) ? function() {
var file = fs.readFileSync(sname, 'utf-8');
var names = wb.SheetNames.join("\n") + "\n";
assert.equal(file, names);
} : null);
});
describe(x + ' should generate correct output', function() {
wb.SheetNames.forEach(function(ws, i) {
var name = ('./test_files/' + x + '.' + i + '.csv');
it('#' + i + ' (' + ws + ')', fs.existsSync(name) ? function() {
var file = fs.readFileSync(name, 'utf-8');
var csv = XLSX.utils.make_csv(wb.Sheets[ws]);
assert.equal(file.replace(/"/g,""), csv.replace(/"/g,""), "CSV badness");
} : null);
});
});
}
describe('should parse test files', function() {
files.forEach(function(x) {
it(x, x.substr(-8) == ".pending" ? null : function() {
var wb = XLSX.readFile('./test_files/' + x);
parsetest(x, wb);
});
});
});

1
test_files Symbolic link

@ -0,0 +1 @@
tests/files

120
tests.lst Normal file

@ -0,0 +1,120 @@
45430.xlsx
45540_classic_Footer.xlsx.pending
45540_classic_Header.xlsx.pending
45540_form_Footer.xlsx
45540_form_Header.xlsx
45544.xlsx.pending
46535.xlsx
46536.xlsx
47090.xlsx
47504.xlsx
47668.xlsx
47737.xlsx
47804.xlsx
47813.xlsx
47862.xlsx
47889.xlsx
48495.xlsx
48539.xlsx
48703.xlsx
48779.xlsx
48923.xlsx
49156.xlsx
49273.xlsx
49325.xlsx
49609.xlsx
49783.xlsx
49872.xlsx
49928.xlsx.pending
49966.xlsx
50096.xlsx
50299.xlsx
50784-font_theme_colours.xlsx
50786-indexed_colours.xlsx
50795.xlsx
50846-border_colours.xlsx
50867_with_table.xlsx
51222.xlsx
51470.xlsx
51710.xlsx
51850.xlsx
51963.xlsx
52348.xlsx
52716.xlsx
53101.xlsx
53282.xlsx
53568.xlsx
53734.xlsx
53798.xlsx
53798_shiftNegative_TMPL.xlsx
54071.xlsx
54084 - Greek - beyond BMP.xlsx
54206.xlsx
54288-ref.xlsx
54288.xlsx
54436.xlsx
54524.xlsx
54607.xlsx
AverageTaxRates.xlsx
Booleans.xlsx
BrNotClosed.xlsx
CustomXMLMapping-singleattributenamespace.xlsx
CustomXMLMappings-complex-type.xlsx
CustomXMLMappings.xlsx
CustomXmlMappings-inverse-order.xlsx
DataValidations-49244.xlsx
DateFormatTests.xlsx
ElapsedFormatTests.xlsx
ForShifting.xlsx
FormatChoiceTests.xlsx
FormatConditionTests.xlsx
Formatting.xlsx.pending
FormulaEvalTestData_Copy.xlsx.pending
GeneralFormatTests.xlsx
InlineStrings.xlsx
NewlineInFormulas.xlsx
NumberFormatApproxTests.xlsx
NumberFormatTests.xlsx
RepeatingRowsCols.xlsx
SampleSS.xlsx
SimpleMultiCell.xlsx
SimpleWithComments.xlsx
Tables.xlsx
TextFormatTests.xlsx
TwoSheetsNoneHidden.xlsx
TwoSheetsOneHidden.xlsx
WithChart.xlsx
WithChartSheet.xlsx.pending
WithConditionalFormatting.xlsx
WithDrawing.xlsx
WithEmbeded.xlsx
WithMoreVariousData.xlsx
WithTable.xlsx
WithTextBox.xlsx
WithTextBox2.xlsx
WithThreeCharts.xlsx
WithTwoCharts.xlsx
WithVariousData.xlsx
atp.xlsx
chart_sheet.xlsx
comments.xlsx
formula_stress_test.xlsx.pending
interview.xlsx
issue.xlsx
mixed_sheets.xlsx
named_ranges_2011.xlsx
picture.xlsx
reordered_sheets.xlsx
sample-beta.xlsx
sample.xlsx
shared_formulas.xlsx
sheetProtection_allLocked.xlsx
sheetProtection_not_protected.xlsx
styles.xlsx
workbookProtection_not_protected.xlsx
workbookProtection_workbook_revision_protected.xlsx
workbookProtection_workbook_structure_protected.xlsx
workbookProtection_workbook_windows_protected.xlsx
workbookProtection_worksheet_protected.xlsx
xlsx-jdbc.xlsx
חישוב_נקודות_זיכוי.xlsx

@ -1 +1 @@
Subproject commit 340b4779c42e8b322de850679d6abbe787ee8afc
Subproject commit 20470bae65b2912a2d29dd3c1cc591fddbd002a0