Skip to content

Commit ac7ff97

Browse files
committed
Use grunt and bower packages as local dependencies. Close jquerygh-1433.
1 parent 1a13e0b commit ac7ff97

12 files changed

+59
-44
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ dist
99
dist/.destination.json
1010
dist/.sizecache.json
1111
build/.sizecache.json
12+
bower_modules
1213
node_modules
13-
bower_components

.jshintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
src/intro.js
22
src/outro.js
3-
test/qunit/**
43
test/data/jquery-1.9.1.js
4+
bower_modules
55
test/data/badcall.js
66
test/data/badjson.js
77
test/data/json_obj.js

.travis.yml

-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
language: node_js
22
node_js:
33
- '0.10'
4-
before_install:
5-
- npm install grunt-cli bower -g

Gruntfile.js

+12
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ module.exports = function( grunt ) {
1010
}
1111

1212
var gzip = require( "gzip-js" ),
13+
path = require( "path" ),
1314
srcHintOptions = readOptionalJSON( "src/.jshintrc" );
1415

1516
// The concatenated file won't pass onevar
@@ -46,6 +47,17 @@ module.exports = function( grunt ) {
4647
}
4748
}
4849
},
50+
bower: {
51+
install: {
52+
options: {
53+
targetDir: "bower_modules",
54+
cleanup: true,
55+
layout: function( type ) {
56+
return path.join( type );
57+
}
58+
}
59+
}
60+
},
4961
jsonlint: {
5062
pkg: {
5163
src: [ "package.json" ]

README.md

+18-20
Original file line numberDiff line numberDiff line change
@@ -29,39 +29,37 @@ if you swing that way. Easy-peasy.
2929
How to build your own jQuery
3030
----------------------------
3131

32-
First, clone a copy of the main jQuery git repo by running:
32+
Clone a copy of the main jQuery git repo by running:
3333

3434
```bash
3535
git clone git://github.com/jquery/jquery.git
3636
```
3737

38-
Install the [grunt-cli](http://gruntjs.com/getting-started#installing-the-cli) and [bower](http://bower.io/) packages if you haven't before. These should be done as global installs:
39-
38+
Enter the jquery directory and run the build script:
4039
```bash
41-
npm install -g grunt-cli bower
40+
cd jquery && npm run-script build
4241
```
42+
The built version of jQuery will be put in the `dist/` subdirectory, along with the minified copy and associated map file.
4343

44-
Make sure you have `grunt` and `bower` installed by testing:
44+
If you want create custom build or help with jQuery development, it would be better to install <a href="https://github.com/gruntjs/grunt-cli">grunt command line interface</a> as a global package:
4545

46-
```bash
47-
grunt -version
48-
bower -version
4946
```
50-
51-
Enter the jquery directory and install the Node and Bower dependencies, this time *without* specifying a global(-g) install:
52-
53-
```bash
54-
cd jquery && npm install
47+
npm install -g grunt-cli
48+
```
49+
Make sure you have `grunt` installed by testing:
50+
```
51+
grunt -v
5552
```
5653

57-
Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of jQuery, type the following:
58-
59-
```bash
54+
Now by running `grunt` command, in the jquery directory, you could build full version of jQuery, just like with `npm run-script build` command:
55+
```
6056
grunt
6157
```
6258

63-
The built version of jQuery will be put in the `dist/` subdirectory, along with the minified copy and associated map file.
64-
59+
There are many other tasks avaliable for jQuery Core:
60+
```
61+
grunt -help
62+
```
6563

6664
### Modules
6765

@@ -137,10 +135,10 @@ Running the Unit Tests
137135
Make sure you have the necessary dependencies:
138136

139137
```bash
140-
bower install
138+
npm install
141139
```
142140

143-
Start `grunt watch` to auto-build jQuery as you work:
141+
Start `grunt watch` or `npm start` to auto-build jQuery as you work:
144142

145143
```bash
146144
cd jquery && grunt watch

bower.json

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
"requirejs": "~2.1.8",
2020
"qunit": "~1.12.0"
2121
},
22+
"exportsOverride": {
23+
"sizzle": {
24+
"sizzle": "."
25+
},
26+
27+
"requirejs": {
28+
"requirejs": "require.js"
29+
},
30+
"qunit": {
31+
"qunit": "qunit"
32+
}
33+
},
2234
"keywords": [
2335
"jquery",
2436
"javascript",

build/bower-install.js

-13
This file was deleted.

build/tasks/build.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module.exports = function( grunt ) {
2626
endFile: "src/outro.js"
2727
},
2828
paths: {
29-
sizzle: "../bower_components/sizzle/dist/sizzle"
29+
sizzle: "../bower_modules/sizzle/dist/sizzle"
3030
},
3131
rawText: {},
3232
onBuildWrite: convert

package.json

+7-1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
"devDependencies": {
3131
"archiver": "~0.4.10",
3232
"grunt": "~0.4.1",
33+
"grunt-bower-task": "~0.3.2",
34+
"grunt-cli": "~0.1.11",
3335
"grunt-compare-size": "~0.4.0",
3436
"grunt-contrib-jshint": "~0.7.0",
3537
"grunt-contrib-uglify": "~0.2.7",
@@ -44,7 +46,11 @@
4446
"which": "~1.0.5"
4547
},
4648
"scripts": {
47-
"install": "node build/bower-install",
49+
"build": "npm install && grunt",
50+
51+
"install": "grunt bower",
52+
53+
"start": "grunt watch",
4854
"test": "grunt"
4955
}
5056
}

test/data/testinit.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -297,8 +297,10 @@ this.loadTests = function() {
297297
if ( dep ) {
298298
require( [ dep ], loadDep );
299299
} else {
300+
301+
300302
// Subproject tests must be last because they replace our test fixture
301-
testSubproject( "Sizzle", "../bower_components/sizzle/test/", /^unit\/.*\.js$/, function() {
303+
testSubproject( "Sizzle", "../bower_modules/sizzle/test/", /^unit\/.*\.js$/, function() {
302304
// Call load to build module filter select element
303305
QUnit.load();
304306

test/index.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
55
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
66
<title>jQuery Test Suite</title>
7-
<link rel="Stylesheet" media="screen" href="../bower_components/qunit/qunit/qunit.css" />
7+
<link rel="Stylesheet" media="screen" href="../bower_modules/qunit/qunit.css" />
88
<link rel="Stylesheet" media="screen" href="data/testsuite.css" />
99
<!-- Includes -->
1010

@@ -14,8 +14,8 @@
1414
-->
1515
<script src="data/jquery-1.9.1.js"></script>
1616

17-
<script src="../bower_components/qunit/qunit/qunit.js"></script>
18-
<script src="../bower_components/requirejs/require.js"></script>
17+
<script src="../bower_modules/qunit/qunit.js"></script>
18+
<script src="../bower_modules/requirejs/require.js"></script>
1919
<!-- See testinit for the list of tests -->
2020
<script src="data/testinit.js"></script>
2121

test/jquery.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
require.config({
2020
baseUrl: path,
2121
paths: {
22-
sizzle: path + "bower_components/sizzle/dist/sizzle"
22+
sizzle: path + "bower_modules/sizzle/dist/sizzle"
2323
}
2424
});
2525
src = "src/jquery";

0 commit comments

Comments
 (0)