Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# This file is for unifying the coding style for different editors and IDEs
# editorconfig.org

root = true

[*]
indent_style = tab
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[package.json]
indent_style = space
indent_size = 2

5 changes: 5 additions & 0 deletions .jscsrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"preset": "jquery"
"requireCamelCaseOrUpperCaseIdentifiers": {
"ignoreProperties": true
}
"excludeFiles": [ "external", "src/intro.js", "src/outro.js", "node_modules" ]
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ language: node_js
sudo: false
node_js:
- "5"
before_install: npm install -g grunt-cli
script: "npm run ci"
119 changes: 46 additions & 73 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*global module:false*/
module.exports = function(grunt) {
module.exports = function( grunt ) {

"use strict";

Expand All @@ -8,15 +8,15 @@ module.exports = function(grunt) {
var data = {};
try {
data = grunt.file.readJSON( filepath );
} catch(e) {}
} catch ( e ) {}
return data;
},
srcHintOptions = readOptionalJSON("src/.jshintrc");
srcHintOptions = readOptionalJSON( "src/.jshintrc" );
delete srcHintOptions.onevar;

// Project configuration.
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
grunt.initConfig( {
pkg: grunt.file.readJSON( "package.json" ),
files: [
"src/intro.js",
"src/version.js",
Expand Down Expand Up @@ -63,11 +63,28 @@ module.exports = function(grunt) {
instrumentedFiles: "temp/",
src: [ "dist/jquery-migrate.js" ],
htmlReport: "coverage/",
lcovReport: "coverage/",
linesThresholdPct: 85
}
},
files: [ "test/**/*.html" ]
},
coveralls: {
src: "coverage/lcov.info",
options: {

// Should not fail if coveralls is down
force: true
}
},
jscs: {
src: [
"test/**/*.js",
"<%= files %>",
"Gruntfile.js",
"build/**/*.js"
]
},
npmcopy: {
all: {
options: {
Expand All @@ -77,7 +94,7 @@ module.exports = function(grunt) {
"phantomjs-polyfill/bind-polyfill.js": "phantomjs-polyfill/bind-polyfill.js",
"qunit/qunit.js": "qunitjs/qunit/qunit.js",
"qunit/qunit.css": "qunitjs/qunit/qunit.css",
"qunit/LICENSE.txt": "qunitjs/LICENSE.txt" }
"qunit/LICENSE.txt": "qunitjs/LICENSE.txt" }
}
},
jshint: {
Expand Down Expand Up @@ -105,85 +122,41 @@ module.exports = function(grunt) {
}
},
options: {
banner: "/*! jQuery Migrate v<%= pkg.version %> | (c) <%= pkg.author.name %> | jquery.org/license */\n",
banner: "/*! jQuery Migrate v<%= pkg.version %>" +
" | (c) <%= pkg.author.name %> | jquery.org/license */\n",
beautify: {
ascii_only: true
}
}
},
watch: {
files: [ "src/*.js", "test/*.js" ],
tasks: [ "buildnounit" ]
},
});
tasks: [ "build" ]
}
} );

// Load grunt tasks from NPM packages
grunt.loadNpmTasks("grunt-git-authors");
grunt.loadNpmTasks("grunt-contrib-concat");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.loadNpmTasks("grunt-contrib-jshint");
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-qunit-istanbul");
grunt.loadNpmTasks("grunt-npmcopy");

// Default task.
grunt.registerTask( "default", [ "concat", "uglify", "jshint", "qunit" ] );
grunt.loadNpmTasks( "grunt-git-authors" );
grunt.loadNpmTasks( "grunt-contrib-concat" );
grunt.loadNpmTasks( "grunt-contrib-watch" );
grunt.loadNpmTasks( "grunt-contrib-jshint" );
grunt.loadNpmTasks( "grunt-jscs" );
grunt.loadNpmTasks( "grunt-contrib-uglify" );
grunt.loadNpmTasks( "grunt-qunit-istanbul" );
grunt.loadNpmTasks( "grunt-coveralls" );
grunt.loadNpmTasks( "grunt-npmcopy" );

// Skip unit tests, used by testswarm
grunt.registerTask( "buildnounit", [ "concat", "uglify", "jshint" ] );
// Integrate jQuery migrate specific tasks
grunt.loadTasks( "build/tasks" );

// Testswarm
grunt.registerTask( "testswarm", function( commit, configFile, destName ) {
var jobName,
testswarm = require( "testswarm" ),
runs = {},
done = this.async(),
pull = /PR-(\d+)/.exec( commit ),
config = grunt.file.readJSON( configFile ).jquerymigrate,
tests = grunt.config( "tests" )[ destName ],
browserSets = destName || config.browserSets;
// Just an alias
grunt.registerTask( "test", [ "qunit" ] );

if ( browserSets[ 0 ] === "[" ) {
// We got an array, parse it
browserSets = JSON.parse( browserSets );
}
grunt.registerTask( "lint", [ "jshint", "jscs" ] );
grunt.registerTask( "build", [ "concat", "uglify", "lint" ] );

if ( pull ) {
jobName = "Pull <a href='https://github.com/jquery/jquery-migrate/pull/" +
pull[ 1 ] + "'>#" + pull[ 1 ] + "</a>";
} else {
jobName = "Commit <a href='https://github.com/jquery/jquery-migrate/commit/" +
commit + "'>" + commit.substr( 0, 10 ) + "</a>";
}
grunt.registerTask( "default", [ "build", "test" ] );

tests.forEach(function( test ) {
var plugin_jquery = test.split("+");
runs[test] = config.testUrl + commit + "/test/index.html?plugin=" +
plugin_jquery[0] + "&jquery=" + plugin_jquery[1];
});

// TODO: create separate job for git so we can do different browsersets
testswarm.createClient( {
url: config.swarmUrl
} )
.addReporter( testswarm.reporters.cli )
.auth( {
id: config.authUsername,
token: config.authToken
})
.addjob(
{
name: jobName,
runs: runs,
runMax: config.runMax,
browserSets: browserSets,
timeout: 1000 * 60 * 30
}, function( err, passed ) {
if ( err ) {
grunt.log.error( err );
}
done( passed );
}
);
});
// For CI
grunt.registerTask( "ci", [ "build", "test", "coveralls" ] );
};
37 changes: 28 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# jquery-migrate: Migrate older jQuery code to jQuery 1.9+
[![Build Status](https://travis-ci.org/jquery/jquery-migrate.svg?branch=master)](https://travis-ci.org/jquery/jquery-migrate)
[![Coverage Status](https://img.shields.io/coveralls/jquery/jquery-migrate.svg?style=flat)](https://coveralls.io/r/jquery/jquery-migrate?branch=master)

# Migrate older jQuery code to jQuery 1.9+

This plugin can be used to detect and restore APIs or features that have been deprecated in jQuery and removed as of version 1.9.
See the [warnings page](https://github.com/jquery/jquery-migrate/blob/master/warnings.md) for more information regarding messages the plugin generates.
Expand Down Expand Up @@ -65,19 +68,35 @@ Bugs in jQuery itself should be reported on the [jQuery Core bug tracker](http:/

For other questions about the plugin that aren't bugs, ask on the [jQuery Forum](http://forum.jquery.com).

How to run the tests:
Build and run tests:
====================================================
Clone this repo, install `grunt`:

## Build with `npm` commands
```sh
$ git clone git://github.com/jquery/jquery-migrate.git
$ cd jquery-migrate
$ npm install
$ npm run build
```

## Build with [`grunt`](http://gruntjs.com/)

```sh
$ git clone git://github.com/jquery/jquery-migrate.git
$ cd jquery-migrate
$ npm install
$ npm install -g grunt-cli
$ grunt build
```

### Run tests

```sh
git clone git://github.com/jquery/jquery-migrate.git
cd jquery-migrate
npm install
npm install -g grunt-cli
$ npm test
```

Run `grunt` to `jshint`, `qunit` and `uglify` release.
### Or

```sh
grunt
$ grunt test
```
Loading