Skip to content
Permalink
Browse files

Use grunt and bower packages as local dependencies. Close gh-1433.

  • Loading branch information...
timmywil committed Nov 14, 2013
1 parent 1a13e0b commit ac7ff97f8b9cc2cf29e1ed14d931dbb5b690e3af
Showing with 59 additions and 44 deletions.
  1. +1 −1 .gitignore
  2. +1 −1 .jshintignore
  3. +0 −2 .travis.yml
  4. +12 −0 Gruntfile.js
  5. +18 −20 README.md
  6. +12 −0 bower.json
  7. +0 −13 build/bower-install.js
  8. +1 −1 build/tasks/build.js
  9. +7 −1 package.json
  10. +3 −1 test/data/testinit.js
  11. +3 −3 test/index.html
  12. +1 −1 test/jquery.js
@@ -9,5 +9,5 @@ dist
dist/.destination.json
dist/.sizecache.json
build/.sizecache.json
bower_modules
node_modules
bower_components

This comment has been minimized.

Copy link
@mgol

mgol Nov 15, 2013

Member

@markelog I've just noticed this is wrong. You get a lot of untracked files just because of calling grunt. Why did you remove it?

This comment has been minimized.

Copy link
@timmywil

timmywil via email Nov 15, 2013

Author Member

This comment has been minimized.

Copy link
@mgol

mgol Nov 15, 2013

Member

@timmywil True. I had this directory leftover when the jshint task failed for me.

Since we don't keep anything from this directory in the repository, why not just keep it in .gitignore anwyay? We wouldn't be getting this untracked files mess if a task fails.

This comment has been minimized.

Copy link
@timmywil

timmywil via email Nov 15, 2013

Author Member

This comment has been minimized.

Copy link
@mgol

mgol Nov 15, 2013

Member

A script failure is a clue as well and it's much probable that people will notice that than dangling files in the repository.

This comment has been minimized.

Copy link
@timmywil

timmywil Nov 15, 2013

Author Member

Ok, I'm fine with keeping it.

@@ -1,7 +1,7 @@
src/intro.js
src/outro.js
test/qunit/**
test/data/jquery-1.9.1.js
bower_modules
test/data/badcall.js
test/data/badjson.js
test/data/json_obj.js
@@ -1,5 +1,3 @@
language: node_js
node_js:
- '0.10'
before_install:
- npm install grunt-cli bower -g
@@ -10,6 +10,7 @@ module.exports = function( grunt ) {
}

var gzip = require( "gzip-js" ),
path = require( "path" ),
srcHintOptions = readOptionalJSON( "src/.jshintrc" );

// The concatenated file won't pass onevar
@@ -46,6 +47,17 @@ module.exports = function( grunt ) {
}
}
},
bower: {
install: {
options: {
targetDir: "bower_modules",
cleanup: true,
layout: function( type ) {
return path.join( type );
}
}
}
},
jsonlint: {
pkg: {
src: [ "package.json" ]
@@ -29,39 +29,37 @@ if you swing that way. Easy-peasy.
How to build your own jQuery
----------------------------

First, clone a copy of the main jQuery git repo by running:
Clone a copy of the main jQuery git repo by running:

```bash
git clone git://github.com/jquery/jquery.git
```

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:

Enter the jquery directory and run the build script:
```bash
npm install -g grunt-cli bower
cd jquery && npm run-script build
```
The built version of jQuery will be put in the `dist/` subdirectory, along with the minified copy and associated map file.

Make sure you have `grunt` and `bower` installed by testing:
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:

```bash
grunt -version
bower -version
```

Enter the jquery directory and install the Node and Bower dependencies, this time *without* specifying a global(-g) install:

```bash
cd jquery && npm install
npm install -g grunt-cli
```
Make sure you have `grunt` installed by testing:
```
grunt -v
```

Then, to get a complete, minified (w/ Uglify.js), linted (w/ JSHint) version of jQuery, type the following:

```bash
Now by running `grunt` command, in the jquery directory, you could build full version of jQuery, just like with `npm run-script build` command:
```
grunt
```

The built version of jQuery will be put in the `dist/` subdirectory, along with the minified copy and associated map file.

There are many other tasks avaliable for jQuery Core:
```
grunt -help
```

### Modules

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

```bash
bower install
npm install
```

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

```bash
cd jquery && grunt watch
@@ -19,6 +19,18 @@
"requirejs": "~2.1.8",
"qunit": "~1.12.0"
},
"exportsOverride": {
"sizzle": {
"sizzle": "."
},

"requirejs": {
"requirejs": "require.js"
},
"qunit": {
"qunit": "qunit"
}
},
"keywords": [
"jquery",
"javascript",

This file was deleted.

@@ -26,7 +26,7 @@ module.exports = function( grunt ) {
endFile: "src/outro.js"
},
paths: {
sizzle: "../bower_components/sizzle/dist/sizzle"
sizzle: "../bower_modules/sizzle/dist/sizzle"
},
rawText: {},
onBuildWrite: convert
@@ -30,6 +30,8 @@
"devDependencies": {
"archiver": "~0.4.10",
"grunt": "~0.4.1",
"grunt-bower-task": "~0.3.2",
"grunt-cli": "~0.1.11",
"grunt-compare-size": "~0.4.0",
"grunt-contrib-jshint": "~0.7.0",
"grunt-contrib-uglify": "~0.2.7",
@@ -44,7 +46,11 @@
"which": "~1.0.5"
},
"scripts": {
"install": "node build/bower-install",
"build": "npm install && grunt",

"install": "grunt bower",

"start": "grunt watch",
"test": "grunt"
}
}
@@ -297,8 +297,10 @@ this.loadTests = function() {
if ( dep ) {
require( [ dep ], loadDep );
} else {


// Subproject tests must be last because they replace our test fixture
testSubproject( "Sizzle", "../bower_components/sizzle/test/", /^unit\/.*\.js$/, function() {
testSubproject( "Sizzle", "../bower_modules/sizzle/test/", /^unit\/.*\.js$/, function() {
// Call load to build module filter select element
QUnit.load();

@@ -4,7 +4,7 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>jQuery Test Suite</title>
<link rel="Stylesheet" media="screen" href="../bower_components/qunit/qunit/qunit.css" />
<link rel="Stylesheet" media="screen" href="../bower_modules/qunit/qunit.css" />
<link rel="Stylesheet" media="screen" href="data/testsuite.css" />
<!-- Includes -->

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

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

@@ -19,7 +19,7 @@
require.config({
baseUrl: path,
paths: {
sizzle: path + "bower_components/sizzle/dist/sizzle"
sizzle: path + "bower_modules/sizzle/dist/sizzle"
}
});
src = "src/jquery";

0 comments on commit ac7ff97

Please sign in to comment.
You can’t perform that action at this time.