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 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
  • Loading branch information
mgol committed Dec 27, 2017
1 parent 9a521cb commit 7196ca1
Show file tree
Hide file tree
Showing 24 changed files with 156 additions and 874 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
8 changes: 4 additions & 4 deletions DEVELOPERS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,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 @@ -63,10 +63,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 Expand Up @@ -483,4 +483,4 @@ You can see an example of a well-defined example [in the `ngRepeat` documentatio
[karma-browserstack]: https://github.com/karma-runner/karma-browserstack-launcher
[karma-saucelabs]: https://github.com/karma-runner/karma-sauce-launcher
[unit-testing]: https://docs.angularjs.org/guide/unit-testing
[yarn-install]: https://yarnpkg.com/en/docs/install
[yarn-install]: https://yarnpkg.com/en/docs/install
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 node_modules/closure-compiler/compiler.jar' + classPathSep +
'vendor/ng-closure-runner/ngcompiler.jar ' +
'org.angularjs.closurerunner.NgClosureRunner ' +
'--compilation_level ' + compilationLevel + ' ' +
'--language_in ECMASCRIPT5_STRICT ' +
Expand Down
7 changes: 5 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 All @@ -37,6 +36,7 @@
"dgeni-packages": "^0.16.4",
"event-stream": "~3.1.0",
"glob": "^6.0.1",
"google-closure-compiler": "20171203.0.0",
"google-code-prettify": "1.0.1",
"grunt": "^1.0.1",
"grunt-bump": "^0.8.0",
Expand All @@ -60,7 +60,9 @@
"jasmine-core": "2.5.2",
"jasmine-node": "^2.0.0",
"jasmine-reporters": "^2.2.0",
"jquery": "^3.2.1",
"jquery": "3.2.1",
"jquery-2.1": "npm:jquery@2.1.4",
"jquery-2.2": "npm:jquery@2.2.4",
"karma": "^1.7.0",
"karma-browserstack-launcher": "^1.2.0",
"karma-chrome-launcher": "^2.1.1",
Expand All @@ -75,6 +77,7 @@
"log4js": "^0.6.27",
"lunr": "^0.7.2",
"marked": "~0.3.0",
"ng-closure-runner": "angular/ng-closure-runner#v0.2.4",
"node-html-encoder": "0.0.2",
"npm-run": "^4.1.0",
"open-sans-fontface": "^1.4.0",
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
22 changes: 22 additions & 0 deletions vendor/ng-closure-runner/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
The MIT License

Copyright (c) 2013 Google, Inc. http://angularjs.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

34 changes: 34 additions & 0 deletions vendor/ng-closure-runner/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# ng-closure-runner [![Build Status](https://travis-ci.org/angular/ng-closure-runner.png)](https://travis-ci.org/angular/ng-closure-runner)

Wraps Google Closure Compiler for AngularJS-specific compile passes

## Hacking

ng-closure-runner is a lightweight runner around the
[Google Closure Compiler](https://developers.google.com/closure/compiler/). For
a complete description of how Closure Compiler works, refer to the
[source code](https://code.google.com/p/closure-compiler/source/browse/) and
[javadoc](http://javadoc.closure-compiler.googlecode.com/git/index.html). Refer
to `src/org/angularjs/closurerunner/MinerrPass.java` as an example of how to
write a custom compiler pass.

We use [Gradle](http://www.gradle.org) to build. You'll need a current JDK
(version 1.6 or higher). To compile and run the tests:

```
$ gradle check
```

Submissions should include corresponding tests.

## Releases

Releases should be handled by the core Angular team.

To create a new release:

1. Run `gradle distZip`.
2. Commit the updated file in `assets/ng-closure-runner.zip`
3. Create a tag pointing to the commit.
4. In Angular, update the reference in `bower.json` to use the new tag.
5. That's it! You're done.
Binary file added vendor/ng-closure-runner/ngcompiler.jar
Binary file not shown.
Loading

0 comments on commit 7196ca1

Please sign in to comment.