Skip to content

Commit bb82c32

Browse files
committed
added sauce and compare-size to grunt
1 parent 3b3e469 commit bb82c32

File tree

4 files changed

+135
-70
lines changed

4 files changed

+135
-70
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@
33
/node_modules
44
.DS_Store
55
npm-debug.log
6+
7+
.sizecache.json
8+
9+
sauce_connect.log

Gruntfile.js

Lines changed: 78 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,40 @@
1-
/*jshint node: true */
1+
/*jshint node: true, camelcase: false */
22

33
"use strict";
44

55
module.exports = function (grunt) {
66

77
grunt.initConfig({
88
pkg: grunt.file.readJSON("package.json"),
9+
compare_size: {
10+
files: [
11+
"jquery.ui-contextmenu.min.js",
12+
"jquery.ui-contextmenu.js"
13+
],
14+
options: {
15+
compress: {
16+
gz: function (fileContents) {
17+
return require("gzip-js").zip(fileContents, {}).length;
18+
}
19+
}
20+
}
21+
},
22+
connect: {
23+
demo: {
24+
options: {
25+
hostname: "*", // make accessible from everywhere
26+
port: 8080,
27+
base: "./",
28+
keepalive: true
29+
}
30+
},
31+
sauce: {
32+
options: {
33+
port: 9999,
34+
base: ""
35+
}
36+
}
37+
},
938
exec: {
1039
tabfix: {
1140
// Cleanup whitespace according to http://contribute.jquery.org/style-guide/js/
@@ -18,9 +47,6 @@ module.exports = function (grunt) {
1847
cmd: "pyftpsync --progress upload . ftp://www.wwwendt.de/tech/demo/jquery-contextmenu --delete-unmatched --omit dist,node_modules,.*,_* -x"
1948
}
2049
},
21-
qunit: {
22-
all: ["test/index.html"]
23-
},
2450
jshint: {
2551
files: [
2652
"Gruntfile.js",
@@ -31,47 +57,73 @@ module.exports = function (grunt) {
3157
jshintrc: ".jshintrc"
3258
}
3359
},
60+
qunit: {
61+
all: ["test/index.html"]
62+
},
63+
"saucelabs-qunit": {
64+
all: {
65+
options: {
66+
urls: ["http://128.0.0.1:9999/test/index.html"],
67+
// username: process.env.SAUCE_USERNAME,
68+
// key: process.env.SAUCE_ACCESS_KEY,
69+
tunnelTimeout: 5,
70+
build: process.env.TRAVIS_JOB_ID,
71+
concurrency: 3,
72+
browsers: [
73+
// { browserName: "safari", platform: "OS X 10.8"},
74+
// { browserName: "firefox", platform: "Windows 7"},
75+
// { browserName: "firefox", platform: "Windows XP"},
76+
{ browserName: "firefox", platform: "Linux"}
77+
// { browserName: "chrome", platform: "Windows 7"},
78+
// { browserName: "internet explorer", platform: "Windows 8", version: "10" },
79+
// { browserName: "internet explorer", platform: "Windows 7", version: "9" }
80+
],
81+
testname: "jquery.ui-contextmenu qunit tests"
82+
}
83+
}
84+
},
3485
uglify: {
3586
options: {
3687
banner: "/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - " +
37-
"<%= grunt.template.today('yyyy-mm-dd') %> | " +
38-
"<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" +
39-
" Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" +
40-
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n"
88+
"<%= grunt.template.today('yyyy-mm-dd') %> | " +
89+
"<%= pkg.homepage ? ' ' + pkg.homepage + ' | ' : '' %>" +
90+
" Copyright (c) <%= grunt.template.today('yyyy') %> <%= pkg.author.name %>;" +
91+
" Licensed <%= _.pluck(pkg.licenses, 'type').join(', ') %> */\n",
92+
report: "gzip"
4193
},
4294
build: {
4395
src: "jquery.ui-contextmenu.js",
4496
// dest: "build/jquery.ui-contextmenu-<%= pkg.version %>.min.js"
4597
dest: "jquery.ui-contextmenu.min.js"
4698
}
47-
},
48-
connect: {
49-
demo: {
50-
options: {
51-
hostname: "*", // make accessible from everywhere
52-
port: 8080,
53-
base: "./",
54-
keepalive: true
55-
}
56-
}
5799
}
58100
});
59101

60-
grunt.loadNpmTasks("grunt-contrib-connect");
61-
grunt.loadNpmTasks("grunt-contrib-jshint");
62-
grunt.loadNpmTasks("grunt-contrib-qunit");
63-
grunt.loadNpmTasks("grunt-contrib-uglify");
64-
grunt.loadNpmTasks("grunt-contrib-connect");
65-
grunt.loadNpmTasks("grunt-exec");
66-
102+
// Loadi "grunt*" dependencies
103+
for (var key in grunt.file.readJSON("package.json").devDependencies) {
104+
if (key !== "grunt" && key.indexOf("grunt") === 0) {
105+
grunt.loadNpmTasks(key);
106+
}
107+
}
67108
grunt.registerTask("server", ["connect:demo"]);
68109
grunt.registerTask("test", ["jshint",
69110
"qunit"]);
111+
112+
//
113+
// See
114+
// https://saucelabs.com/docs/javascript-unit-testing-tutorial
115+
//
116+
grunt.registerTask("saucelabs", ["connect:sauce",
117+
"saucelabs-qunit"]);
118+
70119
grunt.registerTask("travis", ["test"]);
71120
grunt.registerTask("default", ["test"]);
72121
grunt.registerTask("build", ["exec:tabfix",
73122
"test",
74-
"uglify"]);
123+
"uglify",
124+
"compare_size"
125+
// "saucelabs"
126+
]);
75127
grunt.registerTask("upload", ["build",
76128
"exec:upload"]);
77129
grunt.registerTask("server", ["connect:demo"]);

jquery.ui-contextmenu.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 51 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,54 @@
11
{
2-
"name": "ui-contextmenu",
3-
"version": "1.2.3",
4-
5-
"title": "jQuery UI context menu plugin",
6-
"description": "Turn a jQuery UI Menu widget into a contextmenu.",
7-
"keywords": ["context-menu", "contextmenu", "delegate",
8-
"jquery-ui-menu", "menu", "navigation", "popup",
9-
"right-click", "right-click-menu"],
10-
11-
"author": {
12-
"name": "Martin Wendt",
13-
"email": "jquery@wwwendt.de",
14-
"url": "http://careers.stackoverflow.com/martin-wendt"
15-
},
16-
"repository": {
17-
"type": "git",
18-
"url": "https://github.com/mar10/jquery-ui-contextmenu"
19-
},
20-
"homepage": "https://github.com/mar10/jquery-ui-contextmenu",
21-
"demo": "http://wwwendt.de/tech/demo/jquery-contextmenu/demo/",
22-
"docs": "https://github.com/mar10/jquery-ui-contextmenu/blob/master/README.md",
23-
"bugs": "https://github.com/mar10/jquery-ui-contextmenu/issues",
24-
"licenses": [
25-
{
26-
"type": "MIT",
27-
"url": "https://github.com/mar10/jquery-ui-contextmenu/blob/master/MIT-LICENSE.txt"
28-
}
29-
],
30-
"dependencies": {
31-
"jquery": ">=1.7"
32-
},
33-
"devDependencies": {
34-
"grunt": "~0.4.1",
35-
"grunt-contrib-jshint": "~0.3.0",
36-
"grunt-contrib-uglify": "~0.2.0",
37-
"grunt-contrib-qunit": "~0.2.0",
38-
"grunt-contrib-concat": "~0.1.3",
39-
"grunt-exec": "~0.4.0",
40-
"grunt-contrib-connect": "~0.3.0"
41-
},
42-
"scripts": {
43-
"test": "grunt ci --verbose"
2+
"name": "ui-contextmenu",
3+
"version": "1.2.3-1",
4+
"title": "jQuery UI context menu plugin",
5+
"description": "Turn a jQuery UI Menu widget into a contextmenu.",
6+
"keywords": [
7+
"context-menu",
8+
"contextmenu",
9+
"delegate",
10+
"jquery-ui-menu",
11+
"menu",
12+
"navigation",
13+
"popup",
14+
"right-click",
15+
"right-click-menu"
16+
],
17+
"author": {
18+
"name": "Martin Wendt",
19+
"email": "jquery@wwwendt.de",
20+
"url": "http://careers.stackoverflow.com/martin-wendt"
21+
},
22+
"repository": {
23+
"type": "git",
24+
"url": "https://github.com/mar10/jquery-ui-contextmenu"
25+
},
26+
"homepage": "https://github.com/mar10/jquery-ui-contextmenu",
27+
"demo": "http://wwwendt.de/tech/demo/jquery-contextmenu/demo/",
28+
"docs": "https://github.com/mar10/jquery-ui-contextmenu/blob/master/README.md",
29+
"bugs": "https://github.com/mar10/jquery-ui-contextmenu/issues",
30+
"licenses": [
31+
{
32+
"type": "MIT",
33+
"url": "https://github.com/mar10/jquery-ui-contextmenu/blob/master/MIT-LICENSE.txt"
4434
}
35+
],
36+
"dependencies": {
37+
"jquery": ">=1.7"
38+
},
39+
"devDependencies": {
40+
"grunt": "~0.4.1",
41+
"grunt-contrib-jshint": "~0.3.0",
42+
"grunt-contrib-uglify": "~0.2.0",
43+
"grunt-contrib-qunit": "~0.2.0",
44+
"grunt-contrib-concat": "~0.1.3",
45+
"grunt-exec": "~0.4.0",
46+
"grunt-contrib-connect": "~0.3.0",
47+
"grunt-saucelabs": "~4.1.2",
48+
"grunt-compare-size": "~0.4.0",
49+
"gzip-js": "~0.3.2"
50+
},
51+
"scripts": {
52+
"test": "grunt ci --verbose"
53+
}
4554
}

0 commit comments

Comments
 (0)