Skip to content

Commit 7196ca1

Browse files
committed
chore(*): get rid of Bower in favor of Yarn aliases & checked-in packages
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 was switched to the google-closure-compiler package and the latter was checked in to the repository. Fixes angular#16268 Fixes angular#14961 Ref yarnpkg/yarn#1483
1 parent 9a521cb commit 7196ca1

File tree

24 files changed

+156
-874
lines changed

24 files changed

+156
-874
lines changed

.eslintignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
bower_components/**
21
build/**
32
docs/app/assets/js/angular-bootstrap/**
43
docs/config/templates/**
@@ -8,3 +7,4 @@ src/angular.bind.js
87
src/ngParseExt/ucd.js
98
i18n/closure/**
109
tmp/**
10+
vendor/**

.gitignore

+1-3
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ performance/temp*.html
1010
*.swp
1111
angular.js.tmproj
1212
node_modules/
13-
bower_components/
1413
angular.xcodeproj
1514
.idea
1615
*.iml
@@ -19,7 +18,6 @@ angular.xcodeproj
1918
libpeerconnection.log
2019
npm-debug.log
2120
/tmp/
22-
/scripts/bower/bower-*
2321
.vscode
2422
*.log
25-
*.stackdump
23+
*.stackdump

.travis.yml

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ node_js:
55

66
cache:
77
yarn: true
8-
directories:
9-
- bower_components
108

119
branches:
1210
except:
@@ -32,7 +30,7 @@ before_install:
3230
- export PATH="$HOME/.yarn/bin:$PATH"
3331

3432
before_script:
35-
- du -sh ./node_modules ./bower_components/ || true
33+
- du -sh ./node_modules || true
3634
- "./scripts/travis/before_build.sh"
3735
script:
3836
- "./scripts/travis/build.sh"

DEVELOPERS.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
## <a name="setup"> Development Setup
99

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

1313
### Installing Dependencies
1414

@@ -63,10 +63,10 @@ cd angular.js
6363
# Add the main AngularJS repository as an upstream remote to your repository:
6464
git remote add upstream "https://github.com/angular/angular.js.git"
6565

66-
# Install node.js dependencies:
66+
# Install JavaScript dependencies:
6767
yarn install
6868

69-
# Build AngularJS (which will install `bower` dependencies automatically):
69+
# Build AngularJS:
7070
yarn grunt package
7171
```
7272

@@ -483,4 +483,4 @@ You can see an example of a well-defined example [in the `ngRepeat` documentatio
483483
[karma-browserstack]: https://github.com/karma-runner/karma-browserstack-launcher
484484
[karma-saucelabs]: https://github.com/karma-runner/karma-sauce-launcher
485485
[unit-testing]: https://docs.angularjs.org/guide/unit-testing
486-
[yarn-install]: https://yarnpkg.com/en/docs/install
486+
[yarn-install]: https://yarnpkg.com/en/docs/install

Gruntfile.js

-2
Original file line numberDiff line numberDiff line change
@@ -426,14 +426,12 @@ module.exports = function(grunt) {
426426
'shell:promises-aplus-tests'
427427
]);
428428
grunt.registerTask('minify', [
429-
'bower',
430429
'clean',
431430
'build',
432431
'minall'
433432
]);
434433
grunt.registerTask('webserver', ['connect:devserver']);
435434
grunt.registerTask('package', [
436-
'bower',
437435
'validate-angular-files',
438436
'clean',
439437
'buildall',

TRIAGING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ You can mention him in the relevant thread like this: `@btford`.
9595

9696
> Thanks for submitting this issue!
9797
> Unfortunately, we don't think this functionality belongs in core.
98-
> 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.
98+
> The good news is that you could easily implement this as a third-party module and publish it to the npm registry.
9999
100100

101101
## Assigning Work

angularFiles.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ var angularFiles = {
171171
],
172172

173173
'karma': [
174-
'bower_components/jquery/dist/jquery.js',
174+
'node_modules/jquery/dist/jquery.js',
175175
'test/jquery_remove.js',
176176
'@angularSrc',
177177
'@angularSrcModules',
@@ -202,7 +202,7 @@ var angularFiles = {
202202
],
203203

204204
'karmaJquery': [
205-
'bower_components/jquery/dist/jquery.js',
205+
'node_modules/jquery/dist/jquery.js',
206206
'test/jquery_alias.js',
207207
'@angularSrc',
208208
'@angularSrcModules',
@@ -220,8 +220,8 @@ var angularFiles = {
220220
angularFiles['karmaJquery' + jQueryVersion] = []
221221
.concat(angularFiles.karmaJquery)
222222
.map(function(path) {
223-
if (path.startsWith('bower_components/jquery')) {
224-
return path.replace(/^bower_components\/jquery/, 'bower_components/jquery-' + jQueryVersion);
223+
if (path.startsWith('node_modules/jquery')) {
224+
return path.replace(/^node_modules\/jquery/, 'node_modules/jquery-' + jQueryVersion);
225225
}
226226
return path;
227227
});
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
1+
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
1+
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js

benchmarks/orderby-bp/jquery-noop.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
1+
// Override me with ?jquery=/node_modules/jquery/dist/jquery.js

bower.json

-11
This file was deleted.

docs/config/services/getVersion.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ var path = require('canonical-path');
44
/**
55
* dgService getVersion
66
* @description
7-
* Find the current version of the bower component (or node module)
7+
* Find the current version of the node module
88
*/
99
module.exports = function getVersion(readFilesProcessor) {
1010
var basePath = readFilesProcessor.basePath;

docs/gulpfile.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ var rename = require('gulp-rename');
1313

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

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

lib/grunt/plugins.js

-12
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

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

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

@@ -63,15 +62,4 @@ module.exports = function(grunt) {
6362
grunt.registerTask('collect-errors', 'Combine stripped error files', function() {
6463
util.collectErrors();
6564
});
66-
67-
grunt.registerTask('bower', 'Install Bower packages.', function() {
68-
var done = this.async();
69-
70-
bower.commands.install()
71-
.on('log', function(result) {
72-
grunt.log.ok('bower: ' + result.id + ' ' + result.data.endpoint.name);
73-
})
74-
.on('error', grunt.fail.warn.bind(grunt.fail))
75-
.on('end', done);
76-
});
7765
};

lib/grunt/utils.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -187,8 +187,8 @@ module.exports = {
187187
'java ' +
188188
this.java32flags() + ' ' +
189189
this.memoryRequirement() + ' ' +
190-
'-cp bower_components/closure-compiler/compiler.jar' + classPathSep +
191-
'bower_components/ng-closure-runner/ngcompiler.jar ' +
190+
'-cp node_modules/closure-compiler/compiler.jar' + classPathSep +
191+
'vendor/ng-closure-runner/ngcompiler.jar ' +
192192
'org.angularjs.closurerunner.NgClosureRunner ' +
193193
'--compilation_level ' + compilationLevel + ' ' +
194194
'--language_in ECMASCRIPT5_STRICT ' +

package.json

+5-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"angular-benchpress": "0.x.x",
2424
"benchmark": "1.x.x",
2525
"bootstrap": "3.1.1",
26-
"bower": "~1.3.9",
2726
"browserstacktunnel-wrapper": "2.0.0",
2827
"canonical-path": "0.0.2",
2928
"changez": "^2.1.1",
@@ -37,6 +36,7 @@
3736
"dgeni-packages": "^0.16.4",
3837
"event-stream": "~3.1.0",
3938
"glob": "^6.0.1",
39+
"google-closure-compiler": "20171203.0.0",
4040
"google-code-prettify": "1.0.1",
4141
"grunt": "^1.0.1",
4242
"grunt-bump": "^0.8.0",
@@ -60,7 +60,9 @@
6060
"jasmine-core": "2.5.2",
6161
"jasmine-node": "^2.0.0",
6262
"jasmine-reporters": "^2.2.0",
63-
"jquery": "^3.2.1",
63+
"jquery": "3.2.1",
64+
"jquery-2.1": "npm:[email protected]",
65+
"jquery-2.2": "npm:[email protected]",
6466
"karma": "^1.7.0",
6567
"karma-browserstack-launcher": "^1.2.0",
6668
"karma-chrome-launcher": "^2.1.1",
@@ -75,6 +77,7 @@
7577
"log4js": "^0.6.27",
7678
"lunr": "^0.7.2",
7779
"marked": "~0.3.0",
80+
"ng-closure-runner": "angular/ng-closure-runner#v0.2.4",
7881
"node-html-encoder": "0.0.2",
7982
"npm-run": "^4.1.0",
8083
"open-sans-fontface": "^1.4.0",

scripts/travis/before_build.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ fi
1818

1919
# unit runs the docs tests too which need a built version of the code
2020
if [[ "$JOB" = unit-* ]]; then
21-
grunt bower
2221
grunt validate-angular-files
2322
grunt build
2423
fi
@@ -28,4 +27,4 @@ fi
2827
if [ "$JOB" != "ci-checks" ]; then
2928
echo "wait_for_browser_provider"
3029
./scripts/travis/wait_for_browser_provider.sh
31-
fi
30+
fi

test/e2e/fixtures/ng-jq-jquery/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<script>
88
var jQuery_2_1_0 = jQuery.noConflict();
99
</script>
10-
<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
10+
<script src="../../../../node_modules/jquery/dist/jquery.js"></script>
1111
<script src="angular.js"></script>
1212
<script src="script.js"></script>
1313
</body>

test/e2e/fixtures/ng-jq/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<body>
44
<span>{{jqueryVersion}}</span>
55

6-
<script src="../../../../bower_components/jquery/dist/jquery.js"></script>
6+
<script src="../../../../node_modules/jquery/dist/jquery.js"></script>
77
<script type="text/javascript">
88
// Verify that empty ng-jq is not accessing `window['']`.
99
// (See https://github.com/angular/angular.js/issues/12741 for more details)

test/e2e/tools/fixture.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ function generateFixture(test, query) {
6565
}
6666
}
6767
if (!/^\d+\.\d+.*$/.test(query.jquery)) {
68-
$(jquery).attr('src', '/bower_components/jquery/dist/jquery.js');
68+
$(jquery).attr('src', '/node_modules/jquery/dist/jquery.js');
6969
} else {
7070
$(jquery).attr('src', '//ajax.googleapis.com/ajax/libs/jquery/' + query.jquery + '/jquery.js');
7171
}

vendor/ng-closure-runner/LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License
2+
3+
Copyright (c) 2013 Google, Inc. http://angularjs.org
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.
22+

vendor/ng-closure-runner/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ng-closure-runner [![Build Status](https://travis-ci.org/angular/ng-closure-runner.png)](https://travis-ci.org/angular/ng-closure-runner)
2+
3+
Wraps Google Closure Compiler for AngularJS-specific compile passes
4+
5+
## Hacking
6+
7+
ng-closure-runner is a lightweight runner around the
8+
[Google Closure Compiler](https://developers.google.com/closure/compiler/). For
9+
a complete description of how Closure Compiler works, refer to the
10+
[source code](https://code.google.com/p/closure-compiler/source/browse/) and
11+
[javadoc](http://javadoc.closure-compiler.googlecode.com/git/index.html). Refer
12+
to `src/org/angularjs/closurerunner/MinerrPass.java` as an example of how to
13+
write a custom compiler pass.
14+
15+
We use [Gradle](http://www.gradle.org) to build. You'll need a current JDK
16+
(version 1.6 or higher). To compile and run the tests:
17+
18+
```
19+
$ gradle check
20+
```
21+
22+
Submissions should include corresponding tests.
23+
24+
## Releases
25+
26+
Releases should be handled by the core Angular team.
27+
28+
To create a new release:
29+
30+
1. Run `gradle distZip`.
31+
2. Commit the updated file in `assets/ng-closure-runner.zip`
32+
3. Create a tag pointing to the commit.
33+
4. In Angular, update the reference in `bower.json` to use the new tag.
34+
5. That's it! You're done.
8.09 KB
Binary file not shown.

0 commit comments

Comments
 (0)