fix(core): standardize useGitHub param (#30173)
<!-- Please make sure you have read the submission guidelines before posting an PR --> <!-- https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr --> <!-- Please make sure that your commit message follows our format --> <!-- Example: `fix(nx): must begin with lowercase` --> <!-- If this is a particularly complex change or feature addition, you can request a dedicated Nx release for this pull request branch. Mention someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they will confirm if the PR warrants its own release for testing purposes, and generate it for you if appropriate. --> ## Current Behavior <!-- This is the behavior we have today --> Currently, when `--useGitHub` is passed the option is ignored so the user is asked if they would like to use GitHub. ## Expected Behavior <!-- This is the behavior we should expect with the changes in this PR --> With this change if the `--useGitHub` flag is passed it will be respected. ## Related Issue(s) <!-- Please link the issue being fixed so it gets closed when this is merged. --> Fixes #29722
This commit is contained in:
parent
7de6a7b0d7
commit
f156ea932d
@ -310,7 +310,7 @@ async function normalizeArgsMiddleware(
|
|||||||
const useGitHub =
|
const useGitHub =
|
||||||
nxCloud === 'skip'
|
nxCloud === 'skip'
|
||||||
? undefined
|
? undefined
|
||||||
: nxCloud === 'github' || (await determineIfGitHubWillBeUsed(nxCloud));
|
: nxCloud === 'github' || (await determineIfGitHubWillBeUsed(argv));
|
||||||
Object.assign(argv, {
|
Object.assign(argv, {
|
||||||
nxCloud,
|
nxCloud,
|
||||||
useGitHub,
|
useGitHub,
|
||||||
|
|||||||
@ -27,9 +27,10 @@ export async function determineNxCloud(
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function determineIfGitHubWillBeUsed(
|
export async function determineIfGitHubWillBeUsed(
|
||||||
nxCloud: NxCloud
|
parsedArgs: yargs.Arguments<{ nxCloud: NxCloud; useGitHub?: boolean }>
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
if (nxCloud === 'yes' || nxCloud === 'circleci') {
|
if (parsedArgs.nxCloud === 'yes' || parsedArgs.nxCloud === 'circleci') {
|
||||||
|
if (parsedArgs?.useGitHub) return true;
|
||||||
const reply = await enquirer.prompt<{ github: 'Yes' | 'No' }>([
|
const reply = await enquirer.prompt<{ github: 'Yes' | 'No' }>([
|
||||||
{
|
{
|
||||||
name: 'github',
|
name: 'github',
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export async function getOnboardingInfo(
|
|||||||
nxCloud: NxCloud,
|
nxCloud: NxCloud,
|
||||||
token: string,
|
token: string,
|
||||||
directory: string,
|
directory: string,
|
||||||
useGithub?: boolean
|
useGitHub?: boolean
|
||||||
) {
|
) {
|
||||||
// nx-ignore-next-line
|
// nx-ignore-next-line
|
||||||
const { createNxCloudOnboardingURL } = require(require.resolve(
|
const { createNxCloudOnboardingURL } = require(require.resolve(
|
||||||
@ -50,7 +50,7 @@ export async function getOnboardingInfo(
|
|||||||
const connectCloudUrl = await createNxCloudOnboardingURL(
|
const connectCloudUrl = await createNxCloudOnboardingURL(
|
||||||
source,
|
source,
|
||||||
token,
|
token,
|
||||||
useGithub ??
|
useGitHub ??
|
||||||
(nxCloud === 'yes' || nxCloud === 'github' || nxCloud === 'circleci'),
|
(nxCloud === 'yes' || nxCloud === 'github' || nxCloud === 'circleci'),
|
||||||
code
|
code
|
||||||
);
|
);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user