Tasos Bekos 8676c1a68b fix(core): default to NPM package manager
* Simplify the determination & detection of the desired package manager.
* Add the `package-manager` option on plugin creation.
* Nx Cloud installation uses the appropriate package manager.
2020-11-11 10:02:47 -05:00

24 lines
773 B
TypeScript

import * as path from 'path';
import { execSync } from 'child_process';
import { output } from '@nrwl/workspace/src/utils/output';
export function showNxWarning(workspaceName: string) {
try {
const pathToRunNxCommand = path.resolve(process.cwd(), workspaceName);
execSync('nx --version', {
cwd: pathToRunNxCommand,
stdio: ['ignore', 'ignore', 'ignore'],
});
} catch (e) {
// no nx found
output.addVerticalSeparator();
output.note({
title: `Nx CLI is not installed globally.`,
bodyLines: [
`This means that you might have to use "yarn nx" or "npm nx" to execute commands in the workspace.`,
`Run "yarn global add nx" or "npm install -g nx" to be able to execute command directly.`,
],
});
}
}