fix(misc): nx view-logs should open the nx-cloud link when connected … (#17808)

This commit is contained in:
Jason Jean 2023-09-06 17:10:02 -04:00 committed by GitHub
parent 712bcb2256
commit 4940b2b0b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,9 +5,17 @@ import { output } from '../../utils/output';
import { runNxSync } from '../../utils/child-process'; import { runNxSync } from '../../utils/child-process';
export async function viewLogs(): Promise<number> { export async function viewLogs(): Promise<number> {
const pmc = getPackageManagerCommand(); const cloudUsed = isNxCloudUsed();
const cloudUsed = isNxCloudUsed() && false; if (cloudUsed) {
if (!cloudUsed) { output.error({
title: 'Your workspace is already connected to Nx Cloud',
bodyLines: [
`Refer to the output of the last command to find the Nx Cloud link to view the run details.`,
],
});
return 1;
}
const installCloud = await ( const installCloud = await (
await import('enquirer') await import('enquirer')
) )
@ -32,6 +40,7 @@ export async function viewLogs(): Promise<number> {
if (!installCloud) return; if (!installCloud) return;
const pmc = getPackageManagerCommand();
try { try {
output.log({ output.log({
title: 'Installing nx-cloud', title: 'Installing nx-cloud',
@ -59,7 +68,6 @@ export async function viewLogs(): Promise<number> {
console.log(e); console.log(e);
return 1; return 1;
} }
}
execSync(`${pmc.exec} nx-cloud upload-and-show-run-details`, { execSync(`${pmc.exec} nx-cloud upload-and-show-run-details`, {
stdio: [0, 1, 2], stdio: [0, 1, 2],