Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(core): yargs array-like prompts initial field is number #21349

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions packages/create-nx-workspace/bin/create-nx-workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ async function determineNoneOptions(
name: 'No',
},
],
initial: 'Yes' as any,
initial: 0,
},
]);
js = reply.ts === 'No';
Expand Down Expand Up @@ -584,7 +584,7 @@ async function determineReactOptions(
{
name: 'style',
message: `Default stylesheet format`,
initial: 'css' as any,
initial: 0,
type: 'autocomplete',
choices: [
{
Expand Down Expand Up @@ -680,7 +680,7 @@ async function determineVueOptions(
{
name: 'style',
message: `Default stylesheet format`,
initial: 'css' as any,
initial: 0,
type: 'autocomplete',
choices: [
{
Expand Down Expand Up @@ -759,7 +759,7 @@ async function determineAngularOptions(
message: 'Webpack [ https://webpack.js.org/ ]',
},
],
initial: 'esbuild' as any,
initial: 0,
},
]);
bundler = reply.bundler;
Expand All @@ -772,7 +772,7 @@ async function determineAngularOptions(
{
name: 'style',
message: `Default stylesheet format`,
initial: 'css' as any,
initial: 0,
type: 'autocomplete',
choices: [
{
Expand Down Expand Up @@ -803,7 +803,7 @@ async function determineAngularOptions(
'Do you want to enable Server-Side Rendering (SSR) and Static Site Generation (SSG/Prerendering)?',
type: 'autocomplete',
choices: [{ name: 'Yes' }, { name: 'No' }],
initial: 'No' as any,
initial: 1,
},
]);
ssr = reply.ssr === 'Yes';
Expand Down Expand Up @@ -880,7 +880,7 @@ async function determineNodeOptions(
name: 'No',
},
],
initial: 'No' as any,
initial: 1,
},
]);
docker = reply.docker === 'Yes';
Expand All @@ -904,7 +904,7 @@ async function determinePackageBasedOrIntegratedOrStandalone(): Promise<
type: 'autocomplete',
name: 'workspaceType',
message: `Package-based monorepo, integrated monorepo, or standalone project?`,
initial: 'package-based' as any,
initial: 0,
choices: [
{
name: 'package-based',
Expand Down Expand Up @@ -945,7 +945,7 @@ async function determineStandaloneOrMonorepo(): Promise<
type: 'autocomplete',
name: 'workspaceType',
message: `Integrated monorepo, or standalone project?`,
initial: 'standalone' as any,
initial: 1,
choices: [
{
name: 'integrated',
Expand Down Expand Up @@ -1022,7 +1022,7 @@ async function determineReactFramework(
message: 'React Native [ https://reactnative.dev/ ]',
},
],
initial: 'none' as any,
initial: 0,
},
]);
return reply.framework;
Expand Down Expand Up @@ -1075,7 +1075,7 @@ async function determineNextAppDir(
name: 'No',
},
],
initial: 'Yes' as any,
initial: 0,
},
]);
return reply.nextAppDir === 'Yes';
Expand All @@ -1098,7 +1098,7 @@ async function determineNextSrcDir(
name: 'No',
},
],
initial: 'Yes' as any,
initial: 0,
},
]);
return reply.nextSrcDir === 'Yes';
Expand Down Expand Up @@ -1126,7 +1126,7 @@ async function determineVueFramework(
message: 'Nuxt [ https://nuxt.com/ ]',
},
],
initial: 'none' as any,
initial: 0,
},
]);
return reply.framework;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export async function determinePackageManager(
{
name: 'packageManager',
message: `Which package manager to use`,
initial: 'npm' as any,
initial: 0,
type: 'autocomplete',
choices: [
{ name: 'npm', message: 'NPM' },
Expand Down
6 changes: 3 additions & 3 deletions packages/create-nx-workspace/src/utils/nx/ab-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const messageOptions = {
{
code: 'enable-nx-cloud',
message: `Do you want Nx Cloud to make your CI fast?`,
initial: 'github',
initial: 1,
choices: [
{ value: 'yes', name: 'Yes, enable Nx Cloud' },
{ value: 'github', name: 'Yes, configure Nx Cloud for GitHub Actions' },
Expand All @@ -22,7 +22,7 @@ const messageOptions = {
{
code: 'set-up-ci',
message: `Set up CI with caching, distribution and test deflaking`,
initial: 'github',
initial: 0,
choices: [
{ value: 'github', name: 'Yes, for GitHub Actions with Nx Cloud' },
{ value: 'circleci', name: 'Yes, for CircleCI with Nx Cloud' },
Expand All @@ -38,7 +38,7 @@ const messageOptions = {
{
code: 'enable-caching',
message: `Would you like remote caching to make your build faster?`,
initial: 'yes',
initial: 0,
choices: [
{ value: 'yes', name: 'Yes' },
{ value: 'skip', name: 'Skip for now' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ async function determineFormat(
name: derivedSelectedValue,
},
],
initial: 'as-provided' as any,
initial: 0,
}).then(({ format }) =>
format === asProvidedSelectedValue ? 'as-provided' : 'derived'
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ async function determineFormat(
name: derivedSelectedValue,
},
],
initial: 'as-provided' as any,
initial: 0,
}).then(({ format }) =>
format === asProvidedSelectedValue ? 'as-provided' : 'derived'
);
Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/init/init-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ async function detectPlugins(): Promise<
name: 'No',
},
],
initial: 'Yes' as any,
initial: 0,
},
]).then((r) => r.updatePackageScripts === 'Yes');

Expand Down
2 changes: 1 addition & 1 deletion packages/nx/src/command-line/release/utils/github.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ export async function createOrUpdateGithubRelease(
name: 'No',
},
],
initial: 'Yes' as any,
initial: 0,
},
]).catch(() => {
return { open: 'No' };
Expand Down
4 changes: 2 additions & 2 deletions packages/nx/src/utils/ab-testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const messageOptions = {
{
code: 'enable-caching',
message: `Would you like remote caching to make your build faster?`,
initial: 'yes',
initial: 0,
choices: [
{ value: 'yes', name: 'Yes' },
{ value: 'skip', name: 'Skip for now' },
Expand All @@ -21,7 +21,7 @@ const messageOptions = {
{
code: 'connect-to-view-logs',
message: `To view the logs, Nx needs to connect your workspace to Nx Cloud and upload the most recent run details`,
initial: 'yes',
initial: 0,
choices: [
{
value: 'yes',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ async function determineFormat(
name: derivedSelectedValue,
},
],
initial: 'as-provided' as any,
initial: 0,
}).then(({ format }) =>
format === asProvidedSelectedValue ? 'as-provided' : 'derived'
);
Expand Down