Skip to content

Commit d929adc

Browse files
authored
chore(deps): remove any mentions of bower. (#3640)
Ref #3199.
1 parent c011b04 commit d929adc

19 files changed

+32
-206
lines changed

.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# /node_modules and /bower_components ignored by default
21
dist/
32
.git/
43
tmp/

packages/angular-cli/blueprints/ng2/files/gitignore

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
# dependencies
88
/node_modules
9-
/bower_components
109

1110
# IDEs and editors
1211
/.idea

packages/angular-cli/commands/init.ts

-18
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ const InitCommand: any = Command.extend({
2020
{ name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
2121
{ name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] },
2222
{ name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
23-
{ name: 'skip-bower', type: Boolean, default: true, aliases: ['sb'] },
2423
{ name: 'name', type: String, default: '', aliases: ['n'] },
2524
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },
2625
{ name: 'style', type: String, default: 'css' },
@@ -36,7 +35,6 @@ const InitCommand: any = Command.extend({
3635
run: function (commandOptions: any, rawArgs: string[]) {
3736
if (commandOptions.dryRun) {
3837
commandOptions.skipNpm = true;
39-
commandOptions.skipBower = true;
4038
}
4139

4240
const installBlueprint = new this.tasks.InstallBlueprint({
@@ -73,15 +71,6 @@ const InitCommand: any = Command.extend({
7371
});
7472
}
7573

76-
let bowerInstall: any;
77-
if (!commandOptions.skipBower) {
78-
bowerInstall = new this.tasks.BowerInstall({
79-
ui: this.ui,
80-
analytics: this.analytics,
81-
project: this.project
82-
});
83-
}
84-
8574
const project = this.project;
8675
const packageName = commandOptions.name !== '.' && commandOptions.name || project.name();
8776

@@ -138,13 +127,6 @@ const InitCommand: any = Command.extend({
138127
if (commandOptions.linkCli) {
139128
return linkCli.run();
140129
}
141-
})
142-
.then(function () {
143-
if (!commandOptions.skipBower) {
144-
return bowerInstall.run({
145-
verbose: commandOptions.verbose
146-
});
147-
}
148130
});
149131
}
150132
});

packages/angular-cli/commands/new.ts

-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ const NewCommand = Command.extend({
1818
{ name: 'verbose', type: Boolean, default: false, aliases: ['v'] },
1919
{ name: 'link-cli', type: Boolean, default: false, aliases: ['lc'] },
2020
{ name: 'skip-npm', type: Boolean, default: false, aliases: ['sn'] },
21-
{ name: 'skip-bower', type: Boolean, default: true, aliases: ['sb'] },
2221
{ name: 'skip-git', type: Boolean, default: false, aliases: ['sg'] },
2322
{ name: 'directory', type: String, aliases: ['dir'] },
2423
{ name: 'source-dir', type: String, default: 'src', aliases: ['sd'] },

packages/angular-cli/ember-cli/lib/models/blueprint.js

-78
Original file line numberDiff line numberDiff line change
@@ -986,84 +986,6 @@ Blueprint.prototype.removePackagesFromProject = function(packages) {
986986
});
987987
};
988988

989-
/**
990-
Used to add a package to the projects `bower.json`.
991-
992-
Generally, this would be done from the `afterInstall` hook, to
993-
ensure that a package that is required by a given blueprint is
994-
available.
995-
996-
`localPackageName` and `target` may be thought of as equivalent
997-
to the key-value pairs in the `dependency` or `devDepencency`
998-
objects contained within a bower.json file.
999-
1000-
Examples:
1001-
1002-
addBowerPackageToProject('jquery', '~1.11.1');
1003-
addBowerPackageToProject('old_jquery', 'jquery#~1.9.1');
1004-
addBowerPackageToProject('bootstrap-3', 'http://twitter.github.io/bootstrap/assets/bootstrap');
1005-
1006-
@method addBowerPackageToProject
1007-
@param {String} localPackageName
1008-
@param {String} target
1009-
@param {Object} installOptions
1010-
@return {Promise}
1011-
*/
1012-
Blueprint.prototype.addBowerPackageToProject = function(localPackageName, target, installOptions) {
1013-
// var lpn = localPackageName;
1014-
// var tar = target;
1015-
// if (localPackageName.indexOf('#') >= 0) {
1016-
// if (arguments.length === 1) {
1017-
// var parts = localPackageName.split('#');
1018-
// lpn = parts[0];
1019-
// tar = parts[1];
1020-
// this.ui.writeDeprecateLine('passing ' + localPackageName +
1021-
// ' directly to `addBowerPackageToProject` will soon be unsupported. \n' +
1022-
// 'You may want to replace this with ' +
1023-
// '`addBowerPackageToProject(\'' + lpn + '\', \'' + tar + '\')`');
1024-
// } else {
1025-
// this.ui.writeDeprecateLine('passing ' + localPackageName +
1026-
// ' directly to `addBowerPackageToProject` will soon be unsupported');
1027-
// }
1028-
// }
1029-
// var packageObject = bowEpParser.json2decomposed(lpn, tar);
1030-
// return this.addBowerPackagesToProject([packageObject], installOptions);
1031-
return Promise.resolve();
1032-
};
1033-
1034-
/**
1035-
Used to add an array of packages to the projects `bower.json`.
1036-
1037-
Generally, this would be done from the `afterInstall` hook, to
1038-
ensure that a package that is required by a given blueprint is
1039-
available.
1040-
1041-
Expects each array item to be an object with a `name`. Each object
1042-
may optionally have a `target` to specify a specific version.
1043-
1044-
@method addBowerPackagesToProject
1045-
@param {Array} packages
1046-
@param {Object} installOptions
1047-
@return {Promise}
1048-
*/
1049-
Blueprint.prototype.addBowerPackagesToProject = function(packages, installOptions) {
1050-
var task = this.taskFor('bower-install');
1051-
var installText = (packages.length > 1) ? 'install bower packages' : 'install bower package';
1052-
var packageNames = [];
1053-
var packageNamesAndVersions = packages.map(function (pkg) {
1054-
pkg.source = pkg.source || pkg.name;
1055-
packageNames.push(pkg.name);
1056-
return pkg;
1057-
}).map(bowEpParser.compose);
1058-
1059-
this._writeStatusToUI(chalk.green, installText, packageNames.join(', '));
1060-
1061-
return task.run({
1062-
verbose: true,
1063-
packages: packageNamesAndVersions,
1064-
installOptions: installOptions
1065-
});
1066-
};
1067989

1068990
/**
1069991
Used to retrieve a task with the given name. Passes the new task

packages/angular-cli/ember-cli/lib/models/installation-checker.js

+2-18
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ function InstallationChecker(options) {
1313
}
1414

1515
/**
16-
* Check if npm and bower installation directories are present,
16+
* Check if npm directories are present,
1717
* and raise an error message with instructions on how to proceed.
1818
*
1919
* If some of these package managers aren't being used in the project
2020
* we just ignore them. Their usage is considered by checking the
21-
* presence of your manifest files: package.json for npm and bower.json for bower.
21+
* presence of your manifest files: package.json for npm.
2222
*/
2323
InstallationChecker.prototype.checkInstallations = function() {
2424
var commands = [];
@@ -27,10 +27,6 @@ InstallationChecker.prototype.checkInstallations = function() {
2727
debug('npm dependencies not installed');
2828
commands.push('`npm install`');
2929
}
30-
if (this.usingBower() && this.bowerDependenciesNotPresent()) {
31-
debug('bower dependencies not installed');
32-
commands.push('`bower install`');
33-
}
3430
if (commands.length) {
3531
var commandText = commands.join(' and ');
3632
throw new SilentError('No dependencies installed. Run ' + commandText + ' to install missing dependencies.');
@@ -50,18 +46,6 @@ function readJSON(path) {
5046
}
5147
}
5248

53-
InstallationChecker.prototype.hasBowerDeps = function() {
54-
return hasDependencies(readJSON(path.join(this.project.root, 'bower.json')));
55-
};
56-
57-
InstallationChecker.prototype.usingBower = function() {
58-
return existsSync(path.join(this.project.root, 'bower.json')) && this.hasBowerDeps();
59-
};
60-
61-
InstallationChecker.prototype.bowerDependenciesNotPresent = function() {
62-
return !existsSync(this.project.bowerDirectory);
63-
};
64-
6549
InstallationChecker.prototype.hasNpmDeps = function() {
6650
return hasDependencies(readJSON(path.join(this.project.root, 'package.json')));
6751
};

packages/angular-cli/ember-cli/lib/models/project.js

-57
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ function Project(root, pkg, ui, cli) {
4141
this.addonPackages = {};
4242
this.addons = [];
4343
this.liveReloadFilterPatterns = [];
44-
this.setupBowerDirectory();
4544
this.setupNodeModulesPath();
4645
this.addonDiscovery = new AddonDiscovery(this.ui);
4746
this.addonsFactory = new AddonsFactory(this, this);
@@ -52,46 +51,6 @@ function Project(root, pkg, ui, cli) {
5251
};
5352
}
5453

55-
/**
56-
Set when the `Watcher.detectWatchman` helper method finishes running,
57-
so that other areas of the system can be aware that watchman is being used.
58-
59-
For example, this information is used in the broccoli build pipeline to know
60-
if we can watch additional directories (like bower_components) "cheaply".
61-
62-
Contains `enabled` and `version`.
63-
64-
@private
65-
@property _watchmanInfo
66-
@returns {Object}
67-
@default false
68-
*/
69-
70-
/**
71-
Sets the name of the bower directory for this project
72-
73-
@private
74-
@method setupBowerDirectory
75-
*/
76-
Project.prototype.setupBowerDirectory = function() {
77-
var bowerrcPath = path.join(this.root, '.bowerrc');
78-
79-
debug('bowerrc path: %s', bowerrcPath);
80-
81-
if (existsSync(bowerrcPath)) {
82-
var bowerrcContent = fs.readFileSync(bowerrcPath);
83-
try {
84-
this.bowerDirectory = JSON.parse(bowerrcContent).directory;
85-
} catch (exception) {
86-
debug('failed to parse bowerc: %s', exception);
87-
this.bowerDirectory = null;
88-
}
89-
}
90-
91-
this.bowerDirectory = this.bowerDirectory || 'bower_components';
92-
debug('bowerDirectory: %s', this.bowerDirectory);
93-
};
94-
9554
Project.prototype.hasDependencies = function() {
9655
return !!this.nodeModulesPath;
9756
};
@@ -306,22 +265,6 @@ Project.prototype.dependencies = function(pkg, excludeDevDeps) {
306265
return assign({}, devDependencies, pkg['dependencies']);
307266
};
308267

309-
/**
310-
Returns the bower dependencies for this project.
311-
312-
@private
313-
@method bowerDependencies
314-
@param {String} bower Path to bower.json
315-
@return {Object} Bower dependencies
316-
*/
317-
Project.prototype.bowerDependencies = function(bower) {
318-
if (!bower) {
319-
var bowerPath = path.join(this.root, 'bower.json');
320-
bower = (existsSync(bowerPath)) ? require(bowerPath) : {};
321-
}
322-
return assign({}, bower['devDependencies'], bower['dependencies']);
323-
};
324-
325268
/**
326269
Provides the list of paths to consult for addons that may be provided
327270
internally to this project. Used for middleware addons with built-in support.

packages/angular-cli/utilities/completion.sh

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ build_opts='--aot --base-href --environment --i18n-file --i18n-format --locale -
1212
generate_opts='class component directive enum module pipe route service c cl d e m p r s --help'
1313
github_pages_deploy_opts='--base-href --environment --gh-token --gh-username --message --skip-build --target --user-page -bh -e -t'
1414
help_opts='--json --verbose -v'
15-
init_opts='--dry-run inline-style inline-template --link-cli --mobile --name --prefix --routing --skip-bower --skip-npm --source-dir --style --verbose -d -is -it -lc -n -p -sb -sd -sn -v'
16-
new_opts='--directory --dry-run inline-style inline-template --link-cli --mobile --prefix --routing --skip-bower --skip-git --skip-npm --source-dir --style --verbose -d -dir -is -it -lc -p -sb -sd -sg -sn -v'
15+
init_opts='--dry-run inline-style inline-template --link-cli --mobile --name --prefix --routing --skip-npm --source-dir --style --verbose -d -is -it -lc -n -p -sb -sd -sn -v'
16+
new_opts='--directory --dry-run inline-style inline-template --link-cli --mobile --prefix --routing --skip-git --skip-npm --source-dir --style --verbose -d -dir -is -it -lc -p -sb -sd -sg -sn -v'
1717
serve_opts='--aot --environment --hmr --host --i18n-file --i18n-format --live-reload --live-reload-base-url --live-reload-host --live-reload-live-css --live-reload-port --locale --open --port --proxy-config --sourcemap --ssl --ssl-cert --ssl-key --target --watcher -H -e -lr -lrbu -lrh -lrp -o -p -pc -sm -t -w'
1818
set_opts='--global -g'
1919
test_opts='--browsers --build --code-coverage --colors --lint --log-level --port --reporters --single-run --sourcemap --watch -cc -l -sm -sr -w'

tests/acceptance/destroy.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('Acceptance: ng destroy', function () {
1111
return tmp.setup('./tmp').then(function () {
1212
process.chdir('./tmp');
1313
}).then(function () {
14-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
14+
return ng(['new', 'foo', '--skip-npm']);
1515
});
1616
});
1717

tests/acceptance/generate-class.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('Acceptance: ng generate class', function () {
1616
return tmp.setup('./tmp').then(function () {
1717
process.chdir('./tmp');
1818
}).then(function () {
19-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
19+
return ng(['new', 'foo', '--skip-npm']);
2020
});
2121
});
2222

tests/acceptance/generate-component.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Acceptance: ng generate component', function () {
2020
return tmp.setup('./tmp').then(function () {
2121
process.chdir('./tmp');
2222
}).then(function () {
23-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
23+
return ng(['new', 'foo', '--skip-npm']);
2424
});
2525
});
2626

tests/acceptance/generate-directive.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Acceptance: ng generate directive', function () {
1919
return tmp.setup('./tmp').then(function () {
2020
process.chdir('./tmp');
2121
}).then(function () {
22-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
22+
return ng(['new', 'foo', '--skip-npm']);
2323
});
2424
});
2525

tests/acceptance/generate-module.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ describe('Acceptance: ng generate module', function () {
1515
return tmp.setup('./tmp').then(function () {
1616
process.chdir('./tmp');
1717
}).then(function () {
18-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
18+
return ng(['new', 'foo', '--skip-npm']);
1919
});
2020
});
2121

tests/acceptance/generate-pipe.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ describe('Acceptance: ng generate pipe', function () {
2020
return tmp.setup('./tmp').then(function () {
2121
process.chdir('./tmp');
2222
}).then(function () {
23-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
23+
return ng(['new', 'foo', '--skip-npm']);
2424
});
2525
});
2626

tests/acceptance/generate-route.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ xdescribe('Acceptance: ng generate route', function () {
2121
return tmp.setup('./tmp').then(function () {
2222
process.chdir('./tmp');
2323
}).then(function () {
24-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
24+
return ng(['new', 'foo', '--skip-npm']);
2525
});
2626
});
2727

tests/acceptance/generate-service.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('Acceptance: ng generate service', function () {
1919
return tmp.setup('./tmp').then(function () {
2020
process.chdir('./tmp');
2121
}).then(function () {
22-
return ng(['new', 'foo', '--skip-npm', '--skip-bower']);
22+
return ng(['new', 'foo', '--skip-npm']);
2323
});
2424
});
2525

tests/acceptance/github-pages-deploy.spec.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ describe('Acceptance: ng github-pages:deploy', function() {
3737
this.timeout(10000);
3838
return tmp.setup('./tmp')
3939
.then(() => process.chdir('./tmp'))
40-
.then(() => ng(['new', project, '--skip-npm', '--skip-bower']))
40+
.then(() => ng(['new', project, '--skip-npm']))
4141
.then(() => setupDist())
4242
.finally(() => execStub = new ExecStub());
4343
});

0 commit comments

Comments
 (0)