mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-20 13:32:43 +08:00
When creating a new project using the --link-cli option, the linking command was hard-coded to use npm link @angular/cli. This commit replicates the behaviour of npm-install where the package manager is obtained from the global config and is then used for linking. Close #5524
27 lines
711 B
TypeScript
27 lines
711 B
TypeScript
const Task = require('../ember-cli/lib/models/task');
|
|
import * as chalk from 'chalk';
|
|
import {exec} from 'child_process';
|
|
|
|
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(`${packageManager} link @angular/cli`, (err) => {
|
|
if (err) {
|
|
ui.writeLine(chalk.red(`Couldn't do '${packageManager} link @angular/cli'.`));
|
|
reject();
|
|
} else {
|
|
ui.writeLine(chalk.green('Successfully linked to @angular/cli.'));
|
|
resolve();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
});
|