Skip to content

Commit

Permalink
chore(bower): refactor bower usage
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
petebacondarwin committed Sep 8, 2014
1 parent 40308e5 commit be3b62c
Show file tree
Hide file tree
Showing 8 changed files with 205 additions and 16 deletions.
4 changes: 0 additions & 4 deletions .bowerrc

This file was deleted.

3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ performance/temp*.html
*.swp
angular.js.tmproj
/node_modules/
/components/
/bower_components/
bower_components/
angular.xcodeproj
.idea
.agignore
Expand Down
6 changes: 1 addition & 5 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@
"name": "AngularJS",
"devDependencies": {
"jquery": "2.1.1",
"lunr.js": "0.4.3",
"open-sans-fontface": "1.0.4",
"google-code-prettify": "1.0.1",
"closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip",
"bootstrap": "3.1.1"
"ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.3/assets/ng-closure-runner.zip"
}
}
10 changes: 10 additions & 0 deletions docs/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "AngularJS-docs-app",
"dependencies": {
"jquery": "2.1.1",
"lunr.js": "0.4.3",
"open-sans-fontface": "1.0.4",
"google-code-prettify": "1.0.1",
"bootstrap": "3.1.1"
}
}
7 changes: 5 additions & 2 deletions docs/docs.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

var path = require('canonical-path');
var versionInfo = require('../lib/versions/version-info');
var basePath = __dirname;
Expand All @@ -9,9 +11,10 @@ module.exports = function(config) {
var cdnUrl = "//ajax.googleapis.com/ajax/libs/angularjs/" + versionInfo.cdnVersion;

var getVersion = function(component, sourceFolder, packageFile) {
sourceFolder = sourceFolder || '../bower_components';
sourceFolder = sourceFolder || './bower_components';
packageFile = packageFile || 'bower.json';
return require(path.join(sourceFolder,component,packageFile)).version;

return require(path.resolve(sourceFolder,component,packageFile)).version;
};


Expand Down
16 changes: 13 additions & 3 deletions docs/gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
"use strict";

var gulp = require('gulp');
var log = require('gulp-util').log;
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var bower = require('bower');
Expand All @@ -12,7 +15,7 @@ var path = require('canonical-path');
// See clean and bower for async tasks, and see assets and doc-gen for dependent tasks below

var outputFolder = '../build/docs';
var bowerFolder = '../bower_components';
var bowerFolder = 'bower_components';


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

gulp.task('bower', function() {
return bower.commands.install();
var bowerTask = bower.commands.install();
bowerTask.on('log', function (result) {
log('bower:', result.id, result.data.endpoint.name);
});
bowerTask.on('error', function(error) {
log(error);
});
return bowerTask;
});

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


gulp.task('doc-gen', function() {
gulp.task('doc-gen', ['bower'], function() {
var generateDocs = dgeni.generator('docs.config.js');
return generateDocs()
.catch(function(error) {
Expand Down
174 changes: 174 additions & 0 deletions npm-shrinkwrap.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"gulp": "~3.8.0",
"gulp-concat": "~2.1.7",
"gulp-jshint": "~1.4.2",
"gulp-util": "^3.0.1",
"jasmine-node": "~1.11.0",
"jasmine-reporters": "~0.2.1",
"jshint-stylish": "~0.1.5",
Expand Down

0 comments on commit be3b62c

Please sign in to comment.