From ff2ce9dddec73601db727361812429180798205b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Micha=C5=82=20Go=C5=82e=CC=A8biowski-Owczarek?=
Date: Wed, 27 Dec 2017 19:16:46 +0100
Subject: [PATCH] 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 https://github.com/yarnpkg/yarn/issues/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 #16268
Fixes #14961
Ref yarnpkg/yarn#1483
---
.eslintignore | 2 +-
.gitignore | 4 +-
.travis.yml | 4 +-
DEVELOPERS.md | 6 +-
Gruntfile.js | 2 -
TRIAGING.md | 2 +-
angularFiles.js | 8 +-
benchmarks/animation-bp/jquery-noop.js | 2 +-
benchmarks/largetable-bp/jquery-noop.js | 2 +-
benchmarks/orderby-bp/jquery-noop.js | 2 +-
bower.json | 11 -
docs/config/services/getVersion.js | 2 +-
docs/gulpfile.js | 2 +-
lib/grunt/plugins.js | 12 -
lib/grunt/utils.js | 4 +-
package.json | 5 +-
scripts/travis/before_build.sh | 3 +-
test/e2e/fixtures/ng-jq-jquery/index.html | 2 +-
test/e2e/fixtures/ng-jq/index.html | 2 +-
test/e2e/tools/fixture.js | 2 +-
vendor/closure-compiler/COPYING | 202 +++++
vendor/closure-compiler/README.md | 530 +++++++++++++
vendor/closure-compiler/compiler.jar | Bin 0 -> 6007184 bytes
vendor/ng-closure-runner/LICENSE | 22 +
vendor/ng-closure-runner/README.md | 34 +
vendor/ng-closure-runner/ngcompiler.jar | Bin 0 -> 8287 bytes
yarn.lock | 902 ++--------------------
27 files changed, 884 insertions(+), 885 deletions(-)
delete mode 100644 bower.json
create mode 100644 vendor/closure-compiler/COPYING
create mode 100644 vendor/closure-compiler/README.md
create mode 100644 vendor/closure-compiler/compiler.jar
create mode 100644 vendor/ng-closure-runner/LICENSE
create mode 100644 vendor/ng-closure-runner/README.md
create mode 100644 vendor/ng-closure-runner/ngcompiler.jar
diff --git a/.eslintignore b/.eslintignore
index dc7259927e1c..6d8222eb45db 100644
--- a/.eslintignore
+++ b/.eslintignore
@@ -1,4 +1,3 @@
-bower_components/**
build/**
docs/app/assets/js/angular-bootstrap/**
docs/config/templates/**
@@ -8,3 +7,4 @@ src/angular.bind.js
src/ngParseExt/ucd.js
i18n/closure/**
tmp/**
+vendor/**
diff --git a/.gitignore b/.gitignore
index 42c5e13b4421..2da934151e89 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,7 +10,6 @@ performance/temp*.html
*.swp
angular.js.tmproj
node_modules/
-bower_components/
angular.xcodeproj
.idea
*.iml
@@ -19,7 +18,6 @@ angular.xcodeproj
libpeerconnection.log
npm-debug.log
/tmp/
-/scripts/bower/bower-*
.vscode
*.log
-*.stackdump
\ No newline at end of file
+*.stackdump
diff --git a/.travis.yml b/.travis.yml
index 9748e1317f30..e425d58ec8b7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -5,8 +5,6 @@ node_js:
cache:
yarn: true
- directories:
- - bower_components
branches:
except:
@@ -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"
diff --git a/DEVELOPERS.md b/DEVELOPERS.md
index 9155a5597f71..4d5e9ccd58eb 100644
--- a/DEVELOPERS.md
+++ b/DEVELOPERS.md
@@ -9,7 +9,7 @@
## 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
@@ -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
```
diff --git a/Gruntfile.js b/Gruntfile.js
index c9c32ca8d71a..0b2423e8c9e5 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -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',
diff --git a/TRIAGING.md b/TRIAGING.md
index 0dc6ee357232..f1819e3588f5 100644
--- a/TRIAGING.md
+++ b/TRIAGING.md
@@ -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
diff --git a/angularFiles.js b/angularFiles.js
index 7c4062d41ad4..01bb6422b1b2 100644
--- a/angularFiles.js
+++ b/angularFiles.js
@@ -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',
@@ -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',
@@ -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;
});
diff --git a/benchmarks/animation-bp/jquery-noop.js b/benchmarks/animation-bp/jquery-noop.js
index 8cac7fe4a149..de6781358dc1 100644
--- a/benchmarks/animation-bp/jquery-noop.js
+++ b/benchmarks/animation-bp/jquery-noop.js
@@ -1 +1 @@
-// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
diff --git a/benchmarks/largetable-bp/jquery-noop.js b/benchmarks/largetable-bp/jquery-noop.js
index 8cac7fe4a149..de6781358dc1 100644
--- a/benchmarks/largetable-bp/jquery-noop.js
+++ b/benchmarks/largetable-bp/jquery-noop.js
@@ -1 +1 @@
-// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
diff --git a/benchmarks/orderby-bp/jquery-noop.js b/benchmarks/orderby-bp/jquery-noop.js
index 8cac7fe4a149..de6781358dc1 100644
--- a/benchmarks/orderby-bp/jquery-noop.js
+++ b/benchmarks/orderby-bp/jquery-noop.js
@@ -1 +1 @@
-// Override me with ?jquery=/bower_components/jquery/dist/jquery.js
+// Override me with ?jquery=/node_modules/jquery/dist/jquery.js
diff --git a/bower.json b/bower.json
deleted file mode 100644
index 099d5b1ed3e6..000000000000
--- a/bower.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "name": "angularjs",
- "license": "MIT",
- "devDependencies": {
- "jquery": "3.2.1",
- "jquery-2.2": "jquery#2.2.4",
- "jquery-2.1": "jquery#2.1.4",
- "closure-compiler": "https://dl.google.com/closure-compiler/compiler-20140814.zip",
- "ng-closure-runner": "https://raw.github.com/angular/ng-closure-runner/v0.2.4/assets/ng-closure-runner.zip"
- }
-}
diff --git a/docs/config/services/getVersion.js b/docs/config/services/getVersion.js
index 7de01030b6ec..cc88b395e228 100644
--- a/docs/config/services/getVersion.js
+++ b/docs/config/services/getVersion.js
@@ -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;
diff --git a/docs/gulpfile.js b/docs/gulpfile.js
index e45c504b6537..19a47be57eed 100644
--- a/docs/gulpfile.js
+++ b/docs/gulpfile.js
@@ -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';
diff --git a/lib/grunt/plugins.js b/lib/grunt/plugins.js
index acce4b797ae7..2d71b85501eb 100644
--- a/lib/grunt/plugins.js
+++ b/lib/grunt/plugins.js
@@ -2,7 +2,6 @@
/* eslint-disable no-invalid-this */
-var bower = require('bower');
var util = require('./utils.js');
var npmRun = require('npm-run');
@@ -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);
- });
};
diff --git a/lib/grunt/utils.js b/lib/grunt/utils.js
index 952768da7239..52dbcde8fa5e 100644
--- a/lib/grunt/utils.js
+++ b/lib/grunt/utils.js
@@ -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 ' +
diff --git a/package.json b/package.json
index fe7ab23e569e..77fa93a6f005 100644
--- a/package.json
+++ b/package.json
@@ -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",
@@ -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:jquery@2.1.4",
+ "jquery-2.2": "npm:jquery@2.2.4",
"karma": "^2.0.0",
"karma-browserstack-launcher": "^1.2.0",
"karma-chrome-launcher": "^2.1.1",
diff --git a/scripts/travis/before_build.sh b/scripts/travis/before_build.sh
index e1d83d7977ad..ca44cb37d7dd 100755
--- a/scripts/travis/before_build.sh
+++ b/scripts/travis/before_build.sh
@@ -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
@@ -28,4 +27,4 @@ fi
if [ "$JOB" != "ci-checks" ]; then
echo "wait_for_browser_provider"
./scripts/travis/wait_for_browser_provider.sh
-fi
\ No newline at end of file
+fi
diff --git a/test/e2e/fixtures/ng-jq-jquery/index.html b/test/e2e/fixtures/ng-jq-jquery/index.html
index 15c4a6c0cf30..535ff3fdca26 100644
--- a/test/e2e/fixtures/ng-jq-jquery/index.html
+++ b/test/e2e/fixtures/ng-jq-jquery/index.html
@@ -7,7 +7,7 @@
-
+
{{jqueryVersion}}
-
+