Skip to content

Commit c0990b9

Browse files
coiycoiy
authored andcommitted
Merge remote-tracking branch 'jquery/master'
2 parents 0a41ab3 + 1823a71 commit c0990b9

File tree

21 files changed

+326
-120
lines changed

21 files changed

+326
-120
lines changed

AUTHORS.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,3 +259,16 @@ Chris Rebert <github@rebertia.com>
259259
Gabriel Schulhof <gabriel.schulhof@intel.com>
260260
Gilad Peleg <giladp007@gmail.com>
261261
Martin Naumann <martin@geekonaut.de>
262+
Marek Lewandowski <m.lewandowski@cksource.com>
263+
Bruno Pérel <brunoperel@gmail.com>
264+
Reed Loden <reed@reedloden.com>
265+
Daniel Nill <daniellnill@gmail.com>
266+
Yongwoo Jeon <yongwoo.jeon@navercorp.com>
267+
Sean Henderson <seanh.za@gmail.com>
268+
Richard Kraaijenhagen <stdin+git@riichard.com>
269+
Connor Atherton <c.liam.atherton@gmail.com>
270+
Gary Ye <garysye@gmail.com>
271+
Christian Grete <webmaster@christiangrete.com>
272+
Liza Ramo <liza.h.ramo@gmail.com>
273+
Julian Alexander Murillo <julian.alexander.murillo@gmail.com>
274+
Joelle Fleurantin <joasqueeniebee@gmail.com>

CONTRIBUTING.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,6 @@ Run the build script
101101
$ npm run build
102102
```
103103

104-
Run the Grunt tools:
105-
106-
```bash
107-
$ grunt && grunt watch
108-
```
109-
110104
Now open the jQuery test suite in a browser at http://localhost/test. If there is a port, be sure to include it.
111105

112106
Success! You just built and tested jQuery!
@@ -118,13 +112,26 @@ During the process of writing your patch, you will run the test suite MANY times
118112

119113
Example:
120114

121-
http://localhost/test/?filter=css
115+
http://localhost/test/?module=css
122116

123117
This will only run the "css" module tests. This will significantly speed up your development and debugging.
124118

125119
**ALWAYS RUN THE FULL SUITE BEFORE COMMITTING AND PUSHING A PATCH!**
126120

127121

122+
#### Loading changes on the test page
123+
124+
Rather than rebuilding jQuery with `grunt` every time you make a change, you can use the included `grunt watch` task to rebuild distribution files whenever a file is saved.
125+
126+
```bash
127+
$ grunt watch
128+
```
129+
130+
Alternatively, you can **load tests in AMD** to avoid the need for rebuilding altogether.
131+
132+
Click "Load with AMD" after loading the test page.
133+
134+
128135
### Browser support
129136

130137
Remember that jQuery supports multiple browsers and their versions; any contributed code must work in all of them. You can refer to the [browser support page](http://jquery.com/browser-support/) for the current list of supported browsers.

Gruntfile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ module.exports = function( grunt ) {
3131
// But our modules can
3232
delete srcHintOptions.onevar;
3333

34+
if ( !grunt.option( "filename" ) ) {
35+
grunt.option( "filename", "jquery.js" );
36+
}
37+
3438
grunt.initConfig( {
3539
pkg: grunt.file.readJSON( "package.json" ),
3640
dst: readOptionalJSON( "dist/.destination.json" ),
@@ -173,12 +177,14 @@ module.exports = function( grunt ) {
173177
uglify: {
174178
all: {
175179
files: {
176-
"dist/jquery.min.js": [ "dist/jquery.js" ]
180+
"dist/<%= grunt.option('filename').replace('.js', '.min.js') %>":
181+
"dist/<%= grunt.option('filename') %>"
177182
},
178183
options: {
179184
preserveComments: false,
180185
sourceMap: true,
181-
sourceMapName: "dist/jquery.min.map",
186+
sourceMapName:
187+
"dist/<%= grunt.option('filename').replace('.js', '.min.map') %>",
182188
report: "min",
183189
beautify: {
184190
"ascii_only": true

build/release.js

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@
22
module.exports = function( Release ) {
33

44
var
5-
files = [ "dist/jquery.js", "dist/jquery.min.js", "dist/jquery.min.map" ],
5+
files = [
6+
"dist/jquery.js",
7+
"dist/jquery.min.js",
8+
"dist/jquery.min.map",
9+
"dist/jquery.slim.js",
10+
"dist/jquery.slim.min.js",
11+
"dist/jquery.slim.min.map"
12+
],
613
cdn = require( "./release/cdn" ),
714
dist = require( "./release/dist" ),
815
ensureSizzle = require( "./release/ensure-sizzle" ),
@@ -27,6 +34,11 @@ module.exports = function( Release ) {
2734
*/
2835
generateArtifacts: function( callback ) {
2936
Release.exec( "grunt", "Grunt command failed" );
37+
Release.exec(
38+
"grunt custom:-ajax,-effects,-deprecated --filename=jquery.slim.js && " +
39+
"grunt remove_map_comment --filename=jquery.slim.js",
40+
"Grunt custom failed"
41+
);
3042
cdn.makeReleaseCopies( Release );
3143
callback( files );
3244
},
@@ -47,7 +59,7 @@ module.exports = function( Release ) {
4759
*/
4860
dist: function( callback ) {
4961
cdn.makeArchives( Release, function() {
50-
dist( Release, callback );
62+
dist( Release, files, callback );
5163
} );
5264
}
5365
} );
@@ -56,5 +68,6 @@ module.exports = function( Release ) {
5668
module.exports.dependencies = [
5769
"archiver@0.14.2",
5870
"shelljs@0.2.6",
59-
"npm@2.3.0"
71+
"npm@2.3.0",
72+
"chalk@1.1.1"
6073
];

build/release/cdn.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,23 @@ var
55

66
cdnFolder = "dist/cdn",
77

8-
devFile = "dist/jquery.js",
9-
minFile = "dist/jquery.min.js",
10-
mapFile = "dist/jquery.min.map",
11-
128
releaseFiles = {
13-
"jquery-VER.js": devFile,
14-
"jquery-VER.min.js": minFile,
15-
"jquery-VER.min.map": mapFile
9+
"jquery-VER.js": "dist/jquery.js",
10+
"jquery-VER.min.js": "dist/jquery.min.js",
11+
"jquery-VER.min.map": "dist/jquery.min.map",
12+
"jquery-VER.slim.js": "dist/jquery.slim.js",
13+
"jquery-VER.slim.min.js": "dist/jquery.slim.min.js",
14+
"jquery-VER.slim.min.map": "dist/jquery.slim.min.map"
1615
},
1716

1817
googleFilesCDN = [
19-
"jquery.js", "jquery.min.js", "jquery.min.map"
18+
"jquery.js", "jquery.min.js", "jquery.min.map",
19+
"jquery.slim.js", "jquery.slim.min.js", "jquery.slim.min.map"
2020
],
2121

2222
msFilesCDN = [
23-
"jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map"
23+
"jquery-VER.js", "jquery-VER.min.js", "jquery-VER.min.map",
24+
"jquery-VER.slim.js", "jquery-VER.slim.min.js", "jquery-VER.slim.min.map"
2425
];
2526

2627
/**

build/release/dist.js

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
module.exports = function( Release, complete ) {
1+
module.exports = function( Release, files, complete ) {
22

33
var
44
fs = require( "fs" ),
55
shell = require( "shelljs" ),
66
pkg = require( Release.dir.repo + "/package.json" ),
7-
distRemote = Release.remote.replace( "jquery.git", "jquery-dist.git" ),
7+
distRemote = Release.remote
8+
9+
// For local and github dists
10+
.replace( /jquery(\.git|$)/, "jquery-dist$1" ),
811

912
// These files are included with the distribution
10-
files = [
13+
extras = [
1114
"src",
1215
"LICENSE.txt",
1316
"AUTHORS.txt",
@@ -54,17 +57,13 @@ module.exports = function( Release, complete ) {
5457
// Copy dist files
5558
var distFolder = Release.dir.dist + "/dist";
5659
shell.mkdir( "-p", distFolder );
57-
[
58-
"dist/jquery.js",
59-
"dist/jquery.min.js",
60-
"dist/jquery.min.map"
61-
].forEach( function( file ) {
62-
shell.cp( Release.dir.repo + "/" + file, distFolder );
60+
files.forEach( function( file ) {
61+
shell.cp( "-f", Release.dir.repo + "/" + file, distFolder );
6362
} );
6463

6564
// Copy other files
66-
files.forEach( function( file ) {
67-
shell.cp( "-r", Release.dir.repo + "/" + file, Release.dir.dist );
65+
extras.forEach( function( file ) {
66+
shell.cp( "-rf", Release.dir.repo + "/" + file, Release.dir.dist );
6867
} );
6968

7069
// Write generated bower file

build/release/ensure-sizzle.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
var fs = require( "fs" ),
22
npm = require( "npm" ),
3+
chalk = require( "chalk" ),
34
sizzleLoc = __dirname + "/../../external/sizzle/dist/sizzle.js",
45
rversion = /Engine v(\d+\.\d+\.\d+(?:-[-\.\d\w]+)?)/;
56

@@ -37,12 +38,12 @@ function ensureSizzle( Release, callback ) {
3738

3839
// colors is inherited from jquery-release
3940
console.log(
40-
"The Sizzle version in the src folder (" + version.red +
41-
") is not the latest tag (" + latest.green + ")."
41+
"The Sizzle version in the src folder (" + chalk.red( version ) +
42+
") is not the latest tag (" + chalk.green( latest ) + ")."
4243
);
4344
Release.confirm( callback );
4445
} else {
45-
console.log( "Sizzle is latest (" + latest.green + ")" );
46+
console.log( "Sizzle is latest (" + chalk.green( latest ) + ")" );
4647
callback();
4748
}
4849
} );

build/tasks/build.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ module.exports = function( grunt ) {
1515
config = {
1616
baseUrl: "src",
1717
name: "jquery",
18-
out: "dist/jquery.js",
1918

2019
// We have multiple minify steps
2120
optimize: "none",
@@ -115,7 +114,7 @@ module.exports = function( grunt ) {
115114
done = this.async(),
116115
flags = this.flags,
117116
optIn = flags[ "*" ],
118-
name = this.data.dest,
117+
name = grunt.option( "filename" ),
119118
minimum = this.data.minimum,
120119
removeWith = this.data.removeWith,
121120
excluded = [],
@@ -205,6 +204,11 @@ module.exports = function( grunt ) {
205204
}
206205
};
207206

207+
// Filename can be passed to the command line using
208+
// command line options
209+
// e.g. grunt build --filename=jquery-custom.js
210+
name = name ? ( "dist/" + name ) : this.data.dest;
211+
208212
// append commit id to version
209213
if ( process.env.COMMIT ) {
210214
version += " " + process.env.COMMIT;

build/tasks/dist.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@ module.exports = function( grunt ) {
22

33
"use strict";
44

5-
var fs = require( "fs" ),
5+
var fs = require( "fs" ),
6+
filename = grunt.option( "filename" ),
67
distpaths = [
7-
"dist/jquery.js",
8-
"dist/jquery.min.map",
9-
"dist/jquery.min.js"
8+
"dist/" + filename,
9+
"dist/" + filename.replace( ".js", ".min.map" ),
10+
"dist/" + filename.replace( ".js", ".min.js" )
1011
];
1112

1213
// Process files for distribution

build/tasks/sourcemap.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
var fs = require( "fs" );
22

33
module.exports = function( grunt ) {
4-
var minLoc = Object.keys( grunt.config( "uglify.all.files" ) )[ 0 ];
4+
var config = grunt.config( "uglify.all.files" );
55
grunt.registerTask( "remove_map_comment", function() {
6+
var minLoc = grunt.config.process( Object.keys( config )[ 0 ] );
67

78
// Remove the source map comment; it causes way too many problems.
89
// The map file is still generated for manual associations

0 commit comments

Comments
 (0)