Skip to content

Commit 8a69ae0

Browse files
authored
fix(integrations): Move ng add @ionic/cordova-builders after package installs (#4853)
1 parent 24e22a6 commit 8a69ae0

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

packages/@ionic/cli/src/commands/start.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,9 +646,20 @@ Use the ${input('--type')} option to start projects using older versions of Ioni
646646

647647
const [installer, ...installerArgs] = await pkgManagerArgs(this.env.config.get('npmClient'), { command: 'install' });
648648
await this.env.shell.run(installer, installerArgs, shellOptions);
649+
650+
if (options['cordova']) {
651+
try {
652+
await this.env.shell.run('ng', ['add', '@ionic/cordova-builders', '--skip-confirmation'], { cwd: this.project.rootDirectory });
653+
} catch (e) {
654+
debug('Error while adding @ionic/cordova-builders: %O', e);
655+
}
656+
}
649657
} else {
650658
// --no-deps flag was used so skip installing dependencies, this also results in the package.json being out sync with the package.json so warn the user
651659
this.env.log.warn('Using the --no-deps flag results in an out of date package lock file. The lock file can be updated by performing an `install` with your package manager.');
660+
if (options['cordova']) {
661+
this.env.log.warn('@ionic/cordova-builders couldn\'t be added, make sure you run `ng add @ionic/cordova-builders` after performing an `install` with your package manager.');
662+
}
652663
}
653664

654665
if (!this.schema.cloned) {

packages/@ionic/cli/src/lib/integrations/cordova/index.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,6 @@ export class Integration extends BaseIntegration<ProjectIntegration> {
120120
},
121121
});
122122
await super.add(details);
123-
if (this.e.project.type === 'angular') {
124-
try {
125-
const integration = this.e.project.requireIntegration(this.name);
126-
await this.e.shell.run('ng', ['add', '@ionic/cordova-builders', '--skip-confirmation'], { cwd: integration.root });
127-
} catch (e) {
128-
debug('Error while adding @ionic/cordova-builders: %O', e);
129-
}
130-
}
131123
}
132124

133125
async getCordovaConfig(): Promise<configlib.CordovaConfig | undefined> {

0 commit comments

Comments
 (0)