Skip to content

Commit

Permalink
Ported to Gulp (#30)
Browse files Browse the repository at this point in the history
* Ported to Gulp

* Update README.md

* Update package.json

* Update README.md

* Delete Makefile
  • Loading branch information
Corentin Noël authored and marcelklehr committed Dec 18, 2017
1 parent 4547753 commit a737e3d
Show file tree
Hide file tree
Showing 6 changed files with 98 additions and 35 deletions.
45 changes: 45 additions & 0 deletions Gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var filesExist = require('files-exist');
var jshint = require('gulp-jshint');

js_top_file = 'module-wrapper-top.js';
js_bottom_file = 'module-wrapper-bottom.js';

js_files = [
'socialcalcconstants.js',
'socialcalc-3.js',
'socialcalctableeditor.js',
'formatnumber2.js',
'formula1.js',
'socialcalcpopup.js',
'socialcalcspreadsheetcontrol.js',
'socialcalcviewer.js'
];

gulp.task('validate-js', function () {
for (js_file of filesExist(js_files)) {
gulp.src(js_file)
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
}

// We need the wrapper to be complete in order to process it.
var module_wrapper_files = filesExist([js_top_file, js_bottom_file]);
gulp.src(module_wrapper_files)
.pipe(concat('module-wrapper.js'))
.pipe(jshint())
.pipe(jshint.reporter('jshint-stylish'));
});


gulp.task('js', ['validate-js'], function () {
var files = filesExist([].concat(js_top_file, js_files, js_bottom_file));
return gulp.src(files)
.pipe(concat('SocialCalc.js'))
.pipe(gulp.dest('.'));
});

gulp.task('default', ['js'], function () {});

12 changes: 0 additions & 12 deletions Makefile

This file was deleted.

11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ socialCalcControl.InitializeSpreadsheetControl(el /*, height, width, spacebelow*

This package also works in node.js. You don't need to callc `InitializeSpreadsheetControl` here, because that is just initializing the rendering.

## Build from sources

SocialCalc uses npm and gulp, to get the dependencies, use:
```bash
npm install
```
You can now compile the project using
```bash
npm run build
```

## Licensing
### Common Public Attribution License (Socialtext Inc.)
* socialcalcspreadsheetcontrol.js
Expand Down
31 changes: 20 additions & 11 deletions SocialCalc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
root.SocialCalc = factory.call(root, this);
}
}(this, function (window) {

//
/*
// The module of the SocialCalc package with customizable constants, strings, etc.
Expand Down Expand Up @@ -900,6 +901,7 @@ SocialCalc.ConstantsSetImagePrefix = function(imagePrefix) {

}


//
// The main SocialCalc code module of the SocialCalc package
//
Expand Down Expand Up @@ -7392,6 +7394,7 @@ SocialCalc.SetConvertedCell = function(sheet, cr, rawvalue) {

}


//
// SocialCalcTableEditor
//
Expand Down Expand Up @@ -13820,6 +13823,7 @@ SocialCalc.ProcessKey = function (ch, e) {
}



//
/*
// SocialCalc Number Formatting Library
Expand Down Expand Up @@ -14850,6 +14854,7 @@ SocialCalc.intFunc = function(n) {
}
}


//
//
/*
Expand Down Expand Up @@ -21375,6 +21380,7 @@ SocialCalc.Formula.TestCriteria = function(value, type, criteria) {
return cond;

}

//
/*
// The module of the SocialCalc package for the optional popup menus in socialcalcspreadsheetcontrol.js
Expand Down Expand Up @@ -22995,6 +23001,7 @@ SocialCalc.Popup.Types.ColorChooser.CloseOK = function(e) {

}


//
// SocialCalcSpreadsheetControl
//
Expand Down Expand Up @@ -26891,6 +26898,7 @@ SocialCalc.CtrlSEditorDone = function(idprefix, whichpart) {

}


//
// SocialCalcViewer
//
Expand Down Expand Up @@ -27604,18 +27612,19 @@ str = str.replace(/([^\n])\r([^\n])/g, "$1\r\n$2");

// END OF FILE


if('undefined' === typeof document) {
// We don't really need a DOM-based presentation layer on the server
SocialCalc.GetEditorCellElement = function () {};
SocialCalc.ReplaceCell = function () {};
SocialCalc.EditorRenderSheet = function () {};
SocialCalc.SpreadsheetControlSortSave = function () { return "" };
SocialCalc.SpreadsheetControlStatuslineCallback = function () {};
SocialCalc.DoPositionCalculations = function (editor) {
SocialCalc.EditorSheetStatusCallback(
null, "doneposcalc", null, editor
);
}
// We don't really need a DOM-based presentation layer on the server
SocialCalc.GetEditorCellElement = function () {};
SocialCalc.ReplaceCell = function () {};
SocialCalc.EditorRenderSheet = function () {};
SocialCalc.SpreadsheetControlSortSave = function () { return ""; };
SocialCalc.SpreadsheetControlStatuslineCallback = function () {};
SocialCalc.DoPositionCalculations = function (editor) {
SocialCalc.EditorSheetStatusCallback(
null, "doneposcalc", null, editor
);
};
}

// Compatibility with webworker-threads
Expand Down
22 changes: 11 additions & 11 deletions module-wrapper-bottom.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
if('undefined' === typeof document) {
// We don't really need a DOM-based presentation layer on the server
SocialCalc.GetEditorCellElement = function () {};
SocialCalc.ReplaceCell = function () {};
SocialCalc.EditorRenderSheet = function () {};
SocialCalc.SpreadsheetControlSortSave = function () { return "" };
SocialCalc.SpreadsheetControlStatuslineCallback = function () {};
SocialCalc.DoPositionCalculations = function (editor) {
SocialCalc.EditorSheetStatusCallback(
null, "doneposcalc", null, editor
);
}
// We don't really need a DOM-based presentation layer on the server
SocialCalc.GetEditorCellElement = function () {};
SocialCalc.ReplaceCell = function () {};
SocialCalc.EditorRenderSheet = function () {};
SocialCalc.SpreadsheetControlSortSave = function () { return ""; };
SocialCalc.SpreadsheetControlStatuslineCallback = function () {};
SocialCalc.DoPositionCalculations = function (editor) {
SocialCalc.EditorSheetStatusCallback(
null, "doneposcalc", null, editor
);
};
}

// Compatibility with webworker-threads
Expand Down
12 changes: 11 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "Collaborative spreadsheet editor",
"main": "SocialCalc.js",
"scripts": {
"build": "gulp",
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
Expand All @@ -28,5 +29,14 @@
"bugs": {
"url": "https://github.com/marcelklehr/socialcalc/issues"
},
"homepage": "https://github.com/marcelklehr/socialcalc#readme"
"homepage": "https://github.com/marcelklehr/socialcalc#readme",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-jshint": "^2.0.4",
"jshint": "^2.9.5",
"jshint-stylish": "^2.2.1",
"gulp-uglify": "^3.0.0",
"gulp-concat": "^2.6.1",
"files-exist": "^1.0.2"
}
}

0 comments on commit a737e3d

Please sign in to comment.