Skip to content

Commit be3b62c

Browse files
chore(bower): refactor bower usage
The gulp bower task in the docs app was never actually running since it couldn't find the bower.json file and was silently failing. Updating to a newer bower highlighted this issue. This commit moves the docs app specific bower components into the docs folder. There are only jquery and closure compiler related components in the project folder now. It also improves the gulp bower task to provide better feedback of progress and errors.
1 parent 40308e5 commit be3b62c

8 files changed

+205
-16
lines changed

.bowerrc

-4
This file was deleted.

.gitignore

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ performance/temp*.html
1010
*.swp
1111
angular.js.tmproj
1212
/node_modules/
13-
/components/
14-
/bower_components/
13+
bower_components/
1514
angular.xcodeproj
1615
.idea
1716
.agignore

bower.json

+1-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,7 @@
22
"name": "AngularJS",
33
"devDependencies": {
44
"jquery": "2.1.1",
5-
"lunr.js": "0.4.3",
6-
"open-sans-fontface": "1.0.4",
7-
"google-code-prettify": "1.0.1",
85
"closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
9-
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip",
10-
"bootstrap": "3.1.1"
6+
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip"
117
}
128
}

docs/bower.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"name": "AngularJS-docs-app",
3+
"dependencies": {
4+
"jquery": "2.1.1",
5+
"lunr.js": "0.4.3",
6+
"open-sans-fontface": "1.0.4",
7+
"google-code-prettify": "1.0.1",
8+
"bootstrap": "3.1.1"
9+
}
10+
}

docs/docs.config.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use strict";
2+
13
var path = require('canonical-path');
24
var versionInfo = require('../lib/versions/version-info');
35
var basePath = __dirname;
@@ -9,9 +11,10 @@ module.exports = function(config) {
911
var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + versionInfo.cdnVersion;
1012

1113
var getVersion = function(component, sourceFolder, packageFile) {
12-
sourceFolder = sourceFolder || '../bower_components';
14+
sourceFolder = sourceFolder || './bower_components';
1315
packageFile = packageFile || 'bower.json';
14-
return require(path.join(sourceFolder,component,packageFile)).version;
16+
17+
return require(path.resolve(sourceFolder,component,packageFile)).version;
1518
};
1619

1720

docs/gulpfile.js

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1+
"use strict";
2+
13
var gulp = require('gulp');
4+
var log = require('gulp-util').log;
25
var concat = require('gulp-concat');
36
var jshint = require('gulp-jshint');
47
var bower = require('bower');
@@ -12,7 +15,7 @@ var path = require('canonical-path');
1215
// See clean and bower for async tasks, and see assets and doc-gen for dependent tasks below
1316

1417
var outputFolder = '../build/docs';
15-
var bowerFolder = '../bower_components';
18+
var bowerFolder = 'bower_components';
1619

1720

1821
var copyComponent = function(component, pattern, sourceFolder, packageFile) {
@@ -26,7 +29,14 @@ var copyComponent = function(component, pattern, sourceFolder, packageFile) {
2629
};
2730

2831
gulp.task('bower', function() {
29-
return bower.commands.install();
32+
var bowerTask = bower.commands.install();
33+
bowerTask.on('log', function (result) {
34+
log('bower:', result.id, result.data.endpoint.name);
35+
});
36+
bowerTask.on('error', function(error) {
37+
log(error);
38+
});
39+
return bowerTask;
3040
});
3141

3242
gulp.task('build-app', function() {
@@ -48,7 +58,7 @@ gulp.task('assets', ['bower'], function() {
4858
});
4959

5060

51-
gulp.task('doc-gen', function() {
61+
gulp.task('doc-gen', ['bower'], function() {
5262
var generateDocs = dgeni.generator('docs.config.js');
5363
return generateDocs()
5464
.catch(function(error) {

npm-shrinkwrap.json

+174
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"gulp": "~3.8.0",
3232
"gulp-concat": "~2.1.7",
3333
"gulp-jshint": "~1.4.2",
34+
"gulp-util": "^3.0.1",
3435
"jasmine-node": "~1.11.0",
3536
"jasmine-reporters": "~0.2.1",
3637
"jshint-stylish": "~0.1.5",

0 commit comments

Comments
 (0)