Skip to content

Commit

Permalink
chore(*): get rid of Bower in favor of Yarn aliases & checked-in pack…
Browse files Browse the repository at this point in the history
…ages

Bower was used to install multiple versions of jQuery which is now handled
using Yarn aliases. The remaining two packages, closure-compiler and
ng-closure-compiler were installed from zip files which is not supported by Yarn
(see yarnpkg/yarn#1483); the first of them exists
on npm as the google-closure-compiler but only versions newer than we used are
published and they don't work with ng-closure-compiler so - instead - both were
checked in to the repository.

Fixes angular#16268
Fixes angular#14961
Ref yarnpkg/yarn#1483
  • Loading branch information
mgol authored and Narretz committed Jan 8, 2018
1 parent 8da3aef commit ff2ce9d
Show file tree
Hide file tree
Showing 27 changed files with 884 additions and 885 deletions.
2 changes: 1 addition & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
bower_components/**
build/**
docs/app/assets/js/angular-bootstrap/**
docs/config/templates/**
Expand All @@ -8,3 +7,4 @@ src/angular.bind.js
src/ngParseExt/ucd.js
i18n/closure/**
tmp/**
vendor/**
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ performance/temp*.html
*.swp
angular.js.tmproj
node_modules/
bower_components/
angular.xcodeproj
.idea
*.iml
Expand All @@ -19,7 +18,6 @@ angular.xcodeproj
libpeerconnection.log
npm-debug.log
/tmp/
/scripts/bower/bower-*
.vscode
*.log
*.stackdump
*.stackdump
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ node_js:

cache:
yarn: true
directories:
- bower_components

branches:
except:
Expand All @@ -32,7 +30,7 @@ before_install:
- export PATH="$HOME/.yarn/bin:$PATH"

before_script:
- du -sh ./node_modules ./bower_components/ || true
- du -sh ./node_modules || true
- "./scripts/travis/before_build.sh"
script:
- "./scripts/travis/build.sh"
Expand Down
6 changes: 3 additions & 3 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## <a name="setup"> Development Setup

This document describes how to set up your development environment to build and test AngularJS, and
explains the basic mechanics of using `git`, `node`, `yarn`, `grunt`, and `bower`.
explains the basic mechanics of using `git`, `node`, `yarn` and `grunt`.

### Installing Dependencies

Expand Down Expand Up @@ -64,10 +64,10 @@ cd angular.js
# Add the main AngularJS repository as an upstream remote to your repository:
git remote add upstream "https://github.com/angular/angular.js.git"

# Install node.js dependencies:
# Install JavaScript dependencies:
yarn install

# Build AngularJS (which will install `bower` dependencies automatically):
# Build AngularJS:
yarn grunt package
```

Expand Down
2 changes: 0 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -426,14 +426,12 @@ module.exports = function(grunt) {
'shell:promises-aplus-tests'
]);
grunt.registerTask('minify', [
'bower',
'clean',
'build',
'minall'
]);
grunt.registerTask('webserver', ['connect:devserver']);
grunt.registerTask('package', [
'bower',
'validate-angular-files',
'clean',
'buildall',
Expand Down
2 changes: 1 addition & 1 deletion TRIAGING.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ You can mention him in the relevant thread like this: `@btford`.

> Thanks for submitting this issue!
> Unfortunately, we don't think this functionality belongs in core.
> The good news is that you could easily implement this as a third-party module and publish it on Bower and/or to the npm repository.
> The good news is that you could easily implement this as a third-party module and publish it to the npm registry.

## Assigning Work
Expand Down
8 changes: 4 additions & 4 deletions angularFiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ var angularFiles = {
],

'karma': [
'bower_components/jquery/dist/jquery.js',
'node_modules/jquery/dist/jquery.js',
'test/jquery_remove.js',
'@angularSrc',
'@angularSrcModules',
Expand Down Expand Up @@ -202,7 +202,7 @@ var angularFiles = {
],

'karmaJquery': [
'bower_components/jquery/dist/jquery.js',
'node_modules/jquery/dist/jquery.js',
'test/jquery_alias.js',
'@angularSrc',
'@angularSrcModules',
Expand All @@ -220,8 +220,8 @@ var angularFiles = {
angularFiles['karmaJquery' + jQueryVersion] = []
.concat(angularFiles.karmaJquery)
.map(function(path) {
if (path.startsWith('bower_components/jquery')) {
return path.replace(/^bower_components\/jquery/, 'bower_components/jquery-' + jQueryVersion);
if (path.startsWith('node_modules/jquery')) {
return path.replace(/^node_modules\/jquery/, 'node_modules/jquery-' + jQueryVersion);
}
return path;
});
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/animation-bp/jquery-noop.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
2 changes: 1 addition & 1 deletion benchmarks/largetable-bp/jquery-noop.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
2 changes: 1 addition & 1 deletion benchmarks/orderby-bp/jquery-noop.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
11 changes: 0 additions & 11 deletions bower.json

This file was deleted.

2 changes: 1 addition & 1 deletion docs/config/services/getVersion.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var path = require('canonical-path');
/**
* dgService getVersion
* @description
* Find the current version of the bower component (or node module)
* Find the current version of the node module
*/
module.exports = function getVersion(readFilesProcessor) {
var basePath = readFilesProcessor.basePath;
Expand Down
2 changes: 1 addition & 1 deletion docs/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var rename = require('gulp-rename');

// We indicate to gulp that tasks are async by returning the stream.
// Gulp can then wait for the stream to close before starting dependent tasks.
// See clean and bower for async tasks, and see assets and doc-gen for dependent tasks below
// See clean for an async task, and see assets and doc-gen for dependent tasks below.

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

Expand Down
12 changes: 0 additions & 12 deletions lib/grunt/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

/* eslint-disable no-invalid-this */

var bower = require('bower');
var util = require('./utils.js');
var npmRun = require('npm-run');

Expand Down Expand Up @@ -63,15 +62,4 @@ module.exports = function(grunt) {
grunt.registerTask('collect-errors', 'Combine stripped error files', function() {
util.collectErrors();
});

grunt.registerTask('bower', 'Install Bower packages.', function() {
var done = this.async();

bower.commands.install()
.on('log', function(result) {
grunt.log.ok('bower: ' + result.id + ' ' + result.data.endpoint.name);
})
.on('error', grunt.fail.warn.bind(grunt.fail))
.on('end', done);
});
};
4 changes: 2 additions & 2 deletions lib/grunt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ module.exports = {
'java ' +
this.java32flags() + ' ' +
this.memoryRequirement() + ' ' +
'-cp bower_components/closure-compiler/compiler.jar' + classPathSep +
'bower_components/ng-closure-runner/ngcompiler.jar ' +
'-cp vendor/closure-compiler/compiler.jar' + classPathSep +
'vendor/ng-closure-runner/ngcompiler.jar ' +
'org.angularjs.closurerunner.NgClosureRunner ' +
'--compilation_level ' + compilationLevel + ' ' +
'--language_in ECMASCRIPT5_STRICT ' +
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"angular-benchpress": "0.x.x",
"benchmark": "1.x.x",
"bootstrap": "3.1.1",
"bower": "~1.3.9",
"browserstacktunnel-wrapper": "2.0.0",
"canonical-path": "0.0.2",
"changez": "^2.1.1",
Expand Down Expand Up @@ -60,7 +59,9 @@
"jasmine-core": "^2.8.0",
"jasmine-node": "^2.0.0",
"jasmine-reporters": "^2.2.0",
"jquery": "^3.2.1",
"jquery": "3.2.1",
"jquery-2.1": "npm:[email protected]",
"jquery-2.2": "npm:[email protected]",
"karma": "^2.0.0",
"karma-browserstack-launcher": "^1.2.0",
"karma-chrome-launcher": "^2.1.1",
Expand Down
3 changes: 1 addition & 2 deletions scripts/travis/before_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ fi

# unit runs the docs tests too which need a built version of the code
if [[ "$JOB" = unit-* ]]; then
grunt bower
grunt validate-angular-files
grunt build
fi
Expand All @@ -28,4 +27,4 @@ fi
if [ "$JOB" != "ci-checks" ]; then
echo "wait_for_browser_provider"
./scripts/travis/wait_for_browser_provider.sh
fi
fi
2 changes: 1 addition & 1 deletion test/e2e/fixtures/ng-jq-jquery/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<script>
var jQuery_2_1_0 = jQuery.noConflict();
</script>
<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
<script src="../../../../node_modules/jquery/dist/jquery.js"></script>
<script src="angular.js"></script>
<script src="script.js"></script>
</body>
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/fixtures/ng-jq/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<body>
<span>{{jqueryVersion}}</span>

<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
<script src="../../../../node_modules/jquery/dist/jquery.js"></script>
<script type="text/javascript">
// Verify that empty ng-jq is not accessing `window['']`.
// (See https://github.com/angular/angular.js/issues/12741 for more details)
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/tools/fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function generateFixture(test, query) {
}
}
if (!/^\d+\.\d+.*$/.test(query.jquery)) {
$(jquery).attr('src', '/bower_components/jquery/dist/jquery.js');
$(jquery).attr('src', '/node_modules/jquery/dist/jquery.js');
} else {
$(jquery).attr('src', '//ajax.googleapis.com/ajax/libs/jquery/' + query.jquery + '/jquery.js');
}
Expand Down
Loading

0 comments on commit ff2ce9d

Please sign in to comment.