Skip to content

Commit

Permalink
fix(core): nx add should show errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jaysoo committed Sep 24, 2024
1 parent 8290969 commit b7a0a03
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/add/add.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ async function initializePlugin(
} catch (e) {
spinner.fail();
output.addNewline();
logger.error(e.message);
logger.error(e);
output.error({
title: `Failed to initialize ${pkgName}. Please check the error above for more details.`,
});
Expand Down
8 changes: 4 additions & 4 deletions packages/nx/src/utils/child-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export function runNxSync(
export async function runNxAsync(
cmd: string,
options?: ExecOptions & { cwd?: string; silent?: boolean }
) {
): Promise<void> {
let baseCmd: string;
if (existsSync(join(workspaceRoot, 'package.json'))) {
baseCmd = `${getPackageManagerCommand().exec} nx`;
Expand All @@ -57,15 +57,15 @@ export async function runNxAsync(
if (options?.silent) {
delete options.silent;
}
await new Promise((resolve, reject) => {
return new Promise<void>((resolve, reject) => {
const child = exec(
`${baseCmd} ${cmd}`,
options,
(error, stdout, stderr) => {
if (error) {
reject(error);
reject(stderr || stdout || error.message);
} else {
resolve(stdout);
resolve();
}
}
);
Expand Down

0 comments on commit b7a0a03

Please sign in to comment.