Skip to content

Commit 0356d00

Browse files
jcesarmobileimhoffd
authored andcommitted
fix(cordova): don't append --save to platform/plugin management commands (#4028)
Passing `--save` is no longer required in newer Cordova CLI versions, platforms and plugins are saved automatically. This is causing a peculiar bug that results in Cordova saving an exact version to `package.json`. ref: #4027
1 parent 77fa904 commit 0356d00

File tree

2 files changed

+0
-19
lines changed

2 files changed

+0
-19
lines changed

packages/ionic/src/commands/cordova/platform.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { contains, validate, validators } from '@ionic/cli-framework';
2-
import * as lodash from 'lodash';
32

43
import { CommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandPreRun } from '../../definitions';
54
import { input } from '../../lib/color';
@@ -92,14 +91,6 @@ Like running ${input('cordova platform')} directly, but adds default Ionic icons
9291
const metadata = await this.getMetadata();
9392
const cordovaArgs = filterArgumentsForCordova(metadata, options);
9493

95-
if (
96-
(action === 'add' || action === 'remove') &&
97-
(options['save'] !== false && !options['nosave']) &&
98-
lodash.intersection(options['--'] || [], ['--save', '--nosave', '--no-save']).length === 0
99-
) {
100-
cordovaArgs.push('--save');
101-
}
102-
10394
await this.runCordova(cordovaArgs, {});
10495

10596
if (action === 'add' && options['resources'] && SUPPORTED_PLATFORMS.includes(platformName)) {

packages/ionic/src/commands/cordova/plugin.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { MetadataGroup, contains, validate, validators } from '@ionic/cli-framework';
2-
import * as lodash from 'lodash';
32

43
import { CommandInstanceInfo, CommandLineInputs, CommandLineOptions, CommandMetadata, CommandPreRun } from '../../definitions';
54
import { input } from '../../lib/color';
@@ -74,18 +73,9 @@ Like running ${input('cordova plugin')} directly, but provides friendly checks.
7473
}
7574

7675
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
77-
const [ action ] = inputs;
7876
const metadata = await this.getMetadata();
7977
const cordovaArgs = filterArgumentsForCordova(metadata, options);
8078

81-
if (
82-
(action === 'add' || action === 'remove') &&
83-
(options['save'] !== false && !options['nosave']) &&
84-
lodash.intersection(options['--'] || [], ['--save', '--nosave', '--no-save']).length === 0
85-
) {
86-
cordovaArgs.push('--save');
87-
}
88-
8979
await this.runCordova(cordovaArgs, {});
9080
}
9181
}

0 commit comments

Comments
 (0)