From 8ee0b208b064206877244d9638358b6bda4b07ef Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 13:25:52 +0100 Subject: [PATCH 01/11] Indent consistency --- Gruntfile.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 46febf0..3f79cd5 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -3,13 +3,13 @@ module.exports = function (grunt) { // Project configuration. grunt.initConfig({ - jshint: { + jshint: { all: ['grunt.js', 'lib/**/*.js', 'test/**/*.js'], options: { - jshintrc: '.jshintrc' + jshintrc: '.jshintrc' } }, - watch: { + watch: { files: '', tasks: 'lint' } From ea4ef3771040e78d1468b37f4aa1255760474d7a Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 13:26:30 +0100 Subject: [PATCH 02/11] Fixing paths for browserify --- lib/tld.js | 2 +- test/rule.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tld.js b/lib/tld.js index 3cba730..f3f9f80 100644 --- a/lib/tld.js +++ b/lib/tld.js @@ -1,6 +1,6 @@ "use strict"; -var Rule = require(__dirname + '/rule.js'); +var Rule = require('./rule.js'); /** * tld library diff --git a/test/rule.js b/test/rule.js index db0ce10..45d3b79 100644 --- a/test/rule.js +++ b/test/rule.js @@ -2,7 +2,7 @@ /* global suite, test, suiteSetup */ -var Rule = require(__dirname + '/../lib/rule.js'); +var Rule = require('../lib/rule.js'); var expect = require('expect.js'); suite('Public Suffix Rule', function () { From a1201dedab2ea7e0e312f6c29c74511700cd4c42 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:19:55 +0100 Subject: [PATCH 03/11] Requiring grunt task the proper way --- Gruntfile.js | 5 +---- lib/grunt/update.js | 7 ++----- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 3f79cd5..1754269 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -21,8 +21,5 @@ module.exports = function (grunt) { grunt.registerTask('default', 'jshint'); // Custom Task to build files - grunt.registerTask('update', - 'Update ruleset from publicsuffix.org dataset.', - require(__dirname + '/lib/grunt/update.js')(grunt) - ); + grunt.loadTasks('lib/grunt'); }; diff --git a/lib/grunt/update.js b/lib/grunt/update.js index af72f46..a69dcf2 100644 --- a/lib/grunt/update.js +++ b/lib/grunt/update.js @@ -31,10 +31,7 @@ module.exports = function(grunt){ return provider && config.providers[provider] ? provider : defaultProvider; } - /** - * @param {string|undefined} provider - */ - return function tldUpdate(provider){ + grunt.registerTask('update', function tldUpdate(provider){ var done, config; done = this.async(); @@ -64,5 +61,5 @@ module.exports = function(grunt){ queue.drain = done; queue.push(require(__dirname + '/../exports/index.js')); }); - }; + }); }; \ No newline at end of file From 6ec6ea4faf7ef3703d22014fd87cb52911e00188 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:22:49 +0100 Subject: [PATCH 04/11] `src` -> `dist` Renaming to be less confusing on the fact it's generated code. --- {src => dist}/.gitignore | 0 {src => dist}/.npmignore | 0 index.js | 2 +- lib/grunt/update.js | 2 +- 4 files changed, 2 insertions(+), 2 deletions(-) rename {src => dist}/.gitignore (100%) rename {src => dist}/.npmignore (100%) diff --git a/src/.gitignore b/dist/.gitignore similarity index 100% rename from src/.gitignore rename to dist/.gitignore diff --git a/src/.npmignore b/dist/.npmignore similarity index 100% rename from src/.npmignore rename to dist/.npmignore diff --git a/index.js b/index.js index bb78fbf..e4e6379 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,6 @@ "use strict"; var tld = require('./lib/tld.js').init(); -tld.rules = require('./src/rules.json'); +tld.rules = require('./dist/rules.json'); module.exports = tld; \ No newline at end of file diff --git a/lib/grunt/update.js b/lib/grunt/update.js index a69dcf2..46f6bb4 100644 --- a/lib/grunt/update.js +++ b/lib/grunt/update.js @@ -53,7 +53,7 @@ module.exports = function(grunt){ data = JSON.stringify(data); - grunt.file.write(__dirname + '/../../src/'+filename, data); + grunt.file.write('dist/'+filename, data); callback(); }, 5); From 78855ea7475ec6067ef51051d960ff3c46d3788e Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:25:45 +0100 Subject: [PATCH 05/11] Frontend builder --- dist/.gitignore | 2 +- package.json | 31 ++++++++++++++++++++++++++----- 2 files changed, 27 insertions(+), 6 deletions(-) diff --git a/dist/.gitignore b/dist/.gitignore index 94a2dd1..f59ec20 100644 --- a/dist/.gitignore +++ b/dist/.gitignore @@ -1 +1 @@ -*.json \ No newline at end of file +* \ No newline at end of file diff --git a/package.json b/package.json index eeb72c2..7164d40 100644 --- a/package.json +++ b/package.json @@ -13,27 +13,48 @@ }, "main": "index.js", "scripts": { - "test": "./node_modules/.bin/mocha --ui tdd", - "build": "grunt update", - "prepublish": "grunt update" + "test": "npm run test-node && npm run test-browser", + "test-node": "mocha --ui tdd --reporter dot", + "test-browser": "testling", + "build": "npm run build-rules && npm run build-browser", + "build-rules": "grunt update", + "build-browser": "browserify -r ./lib/tld.js > dist/tld.js", + "prepublish": "npm run test && npm run build" }, "engines": { "node": "0.8.x || 0.10.x" }, + "testling": { + "browsers": [ + "ie6", + "ie7", + "ie8", + "ie9", + "firefox/15", + "chrome/22", + "opera/12", + "safari/5.1" + ], + "harness": "mocha-tdd", + "files": "test/*.js" + }, "dependencies": {}, "devDependencies": { "request": "~2.12.0", "grunt": "~0.4.1", - "mocha": "~1.7.4", + "mocha": "~1.13.0", "expect.js": "~0.2.0", "grunt-contrib-watch": "~0.3.1", - "grunt-contrib-jshint": "~0.4.3" + "grunt-contrib-jshint": "~0.4.3", + "testling": "~1.5.1", + "browserify": "~2.34.0" }, "keywords": [ "tld", "sld", "domain", "travis", + "browser", "uri", "url", "domain name", From 127ed124368029996de25b69dce4fb0df70bcd35 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:30:41 +0100 Subject: [PATCH 06/11] Removing useless grunt tasks - calling directly jshint - removing default es5 - running again jshint --- .jshintrc | 3 +-- .travis.yml | 8 +++----- Gruntfile.js | 18 ++---------------- package.json | 7 +++++-- 4 files changed, 11 insertions(+), 25 deletions(-) diff --git a/.jshintrc b/.jshintrc index 4334ed7..0c43157 100644 --- a/.jshintrc +++ b/.jshintrc @@ -10,6 +10,5 @@ "boss": true, "eqnull": true, "node": true, - "strict": true, - "es5": true + "strict": true } \ No newline at end of file diff --git a/.travis.yml b/.travis.yml index 78e14f0..cd491c4 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,10 @@ language: "node_js" node_js: - - 0.8 - - 0.10 + - "0.8" + - "0.10" notifications: email: on_success: change on_failure: change -before_install: - - npm install -g grunt-cli --production before_script: - - npm run-script build + - npm run build diff --git a/Gruntfile.js b/Gruntfile.js index 1754269..abd03a2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -2,23 +2,9 @@ module.exports = function (grunt) { // Project configuration. - grunt.initConfig({ - jshint: { - all: ['grunt.js', 'lib/**/*.js', 'test/**/*.js'], - options: { - jshintrc: '.jshintrc' - } - }, - watch: { - files: '', - tasks: 'lint' - } - }); + grunt.initConfig({}); - grunt.loadNpmTasks('grunt-contrib-jshint'); - grunt.loadNpmTasks('grunt-contrib-watch'); - - grunt.registerTask('default', 'jshint'); + grunt.registerTask('default', []); // Custom Task to build files grunt.loadTasks('lib/grunt'); diff --git a/package.json b/package.json index 7164d40..9aad5a8 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,8 @@ }, "main": "index.js", "scripts": { - "test": "npm run test-node && npm run test-browser", + "test": "npm run lint && npm run test-node && npm run test-browser", + "lint": "jshint --config .jshintrc lib/**/*.js", "test-node": "mocha --ui tdd --reporter dot", "test-browser": "testling", "build": "npm run build-rules && npm run build-browser", @@ -47,7 +48,9 @@ "grunt-contrib-watch": "~0.3.1", "grunt-contrib-jshint": "~0.4.3", "testling": "~1.5.1", - "browserify": "~2.34.0" + "browserify": "~2.34.0", + "grunt-cli": "~0.1.9", + "jshint": "~2.1.11" }, "keywords": [ "tld", From 14c1a0c6db9b62d14a0e00d675f77d749bff1c91 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:35:12 +0100 Subject: [PATCH 07/11] Testling badge --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 89d873d..ed20504 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ tld.js ====== [![Build Status](https://secure.travis-ci.org/oncletom/tld.js.png?branch=master)](http://travis-ci.org/oncletom/tld.js) +[![browser support](https://ci.testling.com/oncletom/tld.js.png)](https://ci.testling.com/oncletom/tld.js) Handful API to do stuff with domain names and URIs: validity, public etc. From b012521eee0e3fb0a7ca0d1a1c7340336ea5a7cf Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:46:53 +0100 Subject: [PATCH 08/11] Need actually to build prior to test --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 9aad5a8..dd58809 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,7 @@ "build": "npm run build-rules && npm run build-browser", "build-rules": "grunt update", "build-browser": "browserify -r ./lib/tld.js > dist/tld.js", - "prepublish": "npm run test && npm run build" + "prepublish": "npm run build && npm run test" }, "engines": { "node": "0.8.x || 0.10.x" From 4c8dcd0dc92aa322a12f55ac5c75c0aca38c7475 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 15:54:59 +0100 Subject: [PATCH 09/11] Removing prepublish as it's blocking on npm install --- package.json | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/package.json b/package.json index dd58809..f22baf7 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,7 @@ "test-browser": "testling", "build": "npm run build-rules && npm run build-browser", "build-rules": "grunt update", - "build-browser": "browserify -r ./lib/tld.js > dist/tld.js", - "prepublish": "npm run build && npm run test" + "build-browser": "browserify -r ./lib/tld.js > dist/tld.js" }, "engines": { "node": "0.8.x || 0.10.x" From cd878d18a04034c53e43c684fd0f5d6f280f5985 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 16:00:27 +0100 Subject: [PATCH 10/11] Updating tests --- test/publicsuffix.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/publicsuffix.js b/test/publicsuffix.js index 125ae0b..a56905a 100644 --- a/test/publicsuffix.js +++ b/test/publicsuffix.js @@ -92,12 +92,12 @@ suite('http://publicsuffix.org/list/test.txt', function(){ }); test('TLD with a wildcard rule and exceptions', function(){ - checkPublicSuffix('om', null); - checkPublicSuffix('test.om', null); - checkPublicSuffix('b.test.om', 'b.test.om'); - checkPublicSuffix('a.b.test.om', 'b.test.om'); - checkPublicSuffix('songfest.om', 'songfest.om'); - checkPublicSuffix('www.songfest.om', 'songfest.om'); + checkPublicSuffix('ck', null); + checkPublicSuffix('test.ck', null); + checkPublicSuffix('b.test.ck', 'b.test.ck'); + checkPublicSuffix('a.b.test.ck', 'b.test.ck'); + checkPublicSuffix('www.ck', 'www.ck'); + checkPublicSuffix('www.www.ck', 'www.ck'); }); test('US K12', function(){ From 8c87d705202205e75a9f970ab530e5e3e9298fe4 Mon Sep 17 00:00:00 2001 From: Thomas Parisot Date: Wed, 9 Oct 2013 16:29:07 +0100 Subject: [PATCH 11/11] Testling with Travis is problematic --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f22baf7..107a623 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ }, "main": "index.js", "scripts": { - "test": "npm run lint && npm run test-node && npm run test-browser", + "test": "npm run lint && npm run test-node", "lint": "jshint --config .jshintrc lib/**/*.js", "test-node": "mocha --ui tdd --reporter dot", "test-browser": "testling",