Skip to content

Commit 5e5ad43

Browse files
gulp build task improved
1 parent 285ff3f commit 5e5ad43

File tree

5 files changed

+44
-23
lines changed

5 files changed

+44
-23
lines changed

example/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@
127127
mdxTo.innerHTML = "<b>Basic MDX:</b> <i>" + (typeof req === "object" ? req.basicMDX : req)
128128
+ "</i>";
129129

130-
console.log(setup);
131-
132130
var lp = new LightPivotTable(setup); // create widget
133131

134132
</script>

gulpfile.js

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ var gulp = require("gulp"),
88
htmlReplace = require("gulp-html-replace"),
99
header = require("gulp-header"),
1010
replace = require("gulp-replace"),
11-
pkg = require("./package.json");
11+
pkg = require("./package.json"),
12+
zip = require("gulp-zip"),
13+
rename = require("gulp-rename");
1214

1315
var banner = [
1416
"/** <%= pkg.name %>",
@@ -37,43 +39,58 @@ gulp.task("gatherScripts", ["clean"], function () {
3739
}
3840
}))
3941
.pipe(header(banner, { pkg: pkg }))
40-
.pipe(gulp.dest("build/js/"));
42+
.pipe(gulp.dest("build/WEBModule/js/"));
4143
});
4244

4345
gulp.task("gatherCSS", ["clean"], function () {
4446
return gulp.src("source/css/*.css")
4547
.pipe(concat("lightPivotTable.css"))
4648
.pipe(minifyCSS())
47-
.pipe(gulp.dest("build/css/"));
49+
.pipe(gulp.dest("build/WEBModule/css/"));
4850
});
4951

5052
gulp.task("addExample", ["clean"], function () {
51-
gulp.src("example/index.html")
53+
return gulp.src("example/index.html")
5254
.pipe(htmlReplace({
53-
"css": "../css/lightPivotTable.css",
54-
"js": "../js/lightPivotTable.js"
55+
"css": "css/lightPivotTable.css",
56+
"js": "js/lightPivotTable.js"
5557
}))
56-
.pipe(gulp.dest("build/example/"));
57-
});
58-
59-
gulp.task("exportCacheXML", ["clean", "gatherScripts", "gatherCSS"], function () {
60-
gulp.src("export/LightPivotTable.xml")
61-
.pipe(replace(/\{\{replace:css}}/, fs.readFileSync("build/css/lightPivotTable.css")))
62-
.pipe(replace(/\{\{replace:js}}/, fs.readFileSync("build/js/lightPivotTable.js")))
63-
.pipe(gulp.dest("build/"));
58+
.pipe(gulp.dest("build/WEBModule/"));
6459
});
6560

6661
gulp.task("copyLICENSE", ["clean"], function (){
67-
gulp.src("LICENSE")
62+
return gulp.src("LICENSE")
6863
.pipe(gulp.dest("build/"));
6964
});
7065

7166
gulp.task("copyREADME", ["clean"], function (){
72-
gulp.src("readme.md")
67+
return gulp.src("readme.md")
7368
.pipe(gulp.dest("build/"));
7469
});
7570

71+
gulp.task("exportCacheXML", [
72+
"clean", "addExample", "gatherScripts", "gatherCSS", "copyLICENSE", "copyREADME"
73+
], function () {
74+
return gulp.src("export/LightPivotTable.xml")
75+
.pipe(
76+
replace(/\{\{replace:css}}/,
77+
fs.readFileSync("build/WEBModule/css/lightPivotTable.css"))
78+
)
79+
.pipe(
80+
replace(/\{\{replace:js}}/,
81+
fs.readFileSync("build/WEBModule/js/lightPivotTable.js"))
82+
)
83+
.pipe(rename(function (path) { path.basename += "-v" + pkg["version"]; }))
84+
.pipe(gulp.dest("build/Caché"));
85+
});
86+
87+
gulp.task("zipRelease", ["exportCacheXML"], function () {
88+
return gulp.src("build/**/*")
89+
.pipe(zip("LightPivotTable-v" + pkg["version"] + ".zip"))
90+
.pipe(gulp.dest("build"));
91+
});
92+
7693
gulp.task("default", [
7794
"clean", "gatherScripts", "gatherCSS", "addExample", "copyLICENSE", "copyREADME",
78-
"exportCacheXML"
95+
"exportCacheXML", "zipRelease"
7996
]);

package.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,22 @@
44
"version": "1.0.0-beta",
55
"description": "A lightweight pivot table for MDX2JSON source for InterSystems Cache",
66
"main": "test/testServer.js",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/ZitRos/LightPivotTable"
10+
},
711
"devDependencies": {
812
"express": "^5.0.0-alpha.1",
913
"gulp": "^3.8.10",
1014
"gulp-clean": "^0.3.1",
1115
"gulp-concat": "^2.4.1",
1216
"gulp-html-replace": "^1.4.1",
1317
"gulp-minify-css": "^0.3.11",
18+
"gulp-rename": "^1.2.0",
19+
"gulp-replace": "^0.5.0",
1420
"gulp-uglify": "^1.0.1",
1521
"gulp-wrap": "^0.5.0",
16-
"gulp-replace": "^0.5.0"
22+
"gulp-zip": "^2.0.2"
1723
},
1824
"scripts": {
1925
"test": "node test/testServer.js"

source/js/DataSource.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ DataSource.prototype.getCurrentData = function (callback) {
162162

163163
var data = ready.data;
164164

165-
console.log("Retrieved data:", ready);
165+
//console.log("Retrieved data:", ready);
166166

167167
(data.Info || {}).action = _.ACTION;
168168
if (_.ACTION === "MDXDrillthrough") {
@@ -220,7 +220,7 @@ DataSource.prototype.getCurrentData = function (callback) {
220220
mdx = mdxParser.applyFilter(mdx, filters[i]);
221221
}
222222

223-
console.log("Requesting MDX: " + mdx);
223+
console.log("LPT MDX request:", mdx);
224224

225225
_._post(_.SOURCE_URL + "/" + _.ACTION + (_.NAMESPACE ? "?Namespace=" + _.NAMESPACE : ""), {
226226
MDX: mdx

source/js/PivotView.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,7 @@ PivotView.prototype.renderRawData = function (data) {
489489
}
490490
};
491491

492-
console.log("Data to render: ", data);
492+
//console.log("Data to render: ", data);
493493

494494
// fill header
495495
header.textContent = info.leftHeaderColumnsNumber ? rawData[0][0].value : "";

0 commit comments

Comments
 (0)