mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Add --save-dev also to the uninstall command.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
## 0.8.0
|
||||
- __Add init command similar to `npm init`__ ([#219](https://github.com/twitter/bower/issues/219))
|
||||
- __Add devDependencies__ support ([#251](https://github.com/twitter/bower/issues/251))
|
||||
- __Add `--save-dev` flag to install save dev dependencies__ ([#258](https://github.com/twitter/bower/issues/258))
|
||||
- __Add `--save-dev` flag to install/uninstall commands__ ([#258](https://github.com/twitter/bower/issues/258))
|
||||
- `cache-clean` command now clears links pointing to nonexistent folders ([#182](https://github.com/twitter/bower/issues/182))
|
||||
- Fix issue when downloading assets behind a proxy using `https` ([#230](https://github.com/twitter/bower/issues/230))
|
||||
- Fix --save saving unresolved components ([#240](https://github.com/twitter/bower/issues/240))
|
||||
|
||||
@@ -19,7 +19,7 @@ var config = require('../core/config');
|
||||
var help = require('./help');
|
||||
|
||||
var optionTypes = { help: Boolean, force: Boolean, save: Boolean };
|
||||
var shorthand = { 'h': ['--help'], 'S': ['--save'], 'f': ['--force'] };
|
||||
var shorthand = { 'h': ['--help'], 'S': ['--save'], 'D': ['--save-dev'], 'f': ['--force'] };
|
||||
|
||||
module.exports = function (names, options) {
|
||||
var packages, uninstallables, packagesCount = {};
|
||||
@@ -150,15 +150,17 @@ module.exports = function (names, options) {
|
||||
}).uninstall();
|
||||
}, function () {
|
||||
// Finally save
|
||||
if (options.save) save();
|
||||
if (options.save || options['save-dev']) save(!options.save);
|
||||
emitter.emit('end');
|
||||
});
|
||||
};
|
||||
|
||||
var save = function () {
|
||||
if (manager.json.dependencies) {
|
||||
var save = function (dev) {
|
||||
var key = dev ? 'devDependencies' : 'dependencies';
|
||||
|
||||
if (manager.json[key]) {
|
||||
names.forEach(function (name) {
|
||||
delete manager.json.dependencies[name];
|
||||
delete manager.json[key][name];
|
||||
});
|
||||
|
||||
fs.writeFileSync(path.join(manager.cwd, config.json), JSON.stringify(manager.json, null, 2));
|
||||
|
||||
@@ -6,7 +6,8 @@ Usage:
|
||||
Options:
|
||||
|
||||
|
||||
{{#yellow}}--save{{/yellow}} - Removes dependency entry from the project's {{{json}}}
|
||||
{{#yellow}}--save{{/yellow}} - Removes dependency entry from the project's {{{json}}} dependencies
|
||||
{{#yellow}}--save-dev{{/yellow}} - Removes dependency entry from the project's {{{json}}} devDependencies
|
||||
{{#yellow}}--force{{/yellow}} - Forces removal on conflict
|
||||
{{#yellow}}--no-color{{/yellow}} - Do not print colors
|
||||
|
||||
|
||||
Reference in New Issue
Block a user