Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@angular/cli): Use appropriate packageManager for linking #5524

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions packages/@angular/cli/tasks/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ export default Task.extend({
});
}

const packageManager = CliConfig.fromGlobal().get('packageManager');

let npmInstall: any;
if (!commandOptions.skipInstall) {
const packageManager = CliConfig.fromGlobal().get('packageManager');
npmInstall = new NpmInstall({
ui: this.ui,
project: this.project,
Expand All @@ -47,7 +48,8 @@ export default Task.extend({
if (commandOptions.linkCli) {
linkCli = new LinkCli({
ui: this.ui,
project: this.project
project: this.project,
packageManager
});
}

Expand Down Expand Up @@ -105,4 +107,3 @@ export default Task.extend({
});
}
});

9 changes: 7 additions & 2 deletions packages/@angular/cli/tasks/link-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ export default Task.extend({
run: function() {
const ui = this.ui;

let packageManager = this.packageManager;
if (packageManager === 'default') {
packageManager = 'npm';
}

return new Promise(function(resolve, reject) {
exec('npm link @angular/cli', (err) => {
exec(`${packageManager} link @angular/cli`, (err) => {
if (err) {
ui.writeLine(chalk.red('Couldn\'t do \'npm link @angular/cli\'.'));
ui.writeLine(chalk.red(`Couldn't do '${packageManager} link @angular/cli'.`));
reject();
} else {
ui.writeLine(chalk.green('Successfully linked to @angular/cli.'));
Expand Down