Skip to content

Commit

Permalink
feat(nx-plugin): enable createPackageName prompt (#17646)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi authored Jun 21, 2023
1 parent b7d05a0 commit e440b44
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/create-nx-plugin/bin/create-nx-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,23 @@ async function determinePluginName(
return results.pluginName;
}

async function determineCreatePackageName(
parsedArgs: CreateNxPluginArguments
): Promise<string> {
if (parsedArgs.createPackageName) {
return parsedArgs.createPackageName;
}

const results = await enquirer.prompt<{ createPackageName: string }>([
{
name: 'createPackageName',
message: `Create a package which can be used by npx to create a new workspace (Leave blank to not create this package)`,
type: 'input',
},
]);
return results.createPackageName;
}

interface CreateNxPluginArguments {
pluginName: string;
createPackageName?: string;
Expand Down Expand Up @@ -163,13 +180,15 @@ async function normalizeArgsMiddleware(
): Promise<void> {
try {
const pluginName = await determinePluginName(argv);
const createPackageName = await determineCreatePackageName(argv);
const packageManager = await determinePackageManager(argv);
const defaultBase = await determineDefaultBase(argv);
const nxCloud = await determineNxCloud(argv);
const ci = await determineCI(argv, nxCloud);

Object.assign(argv, {
pluginName,
createPackageName,
nxCloud,
packageManager,
defaultBase,
Expand Down

1 comment on commit e440b44

@vercel
Copy link

@vercel vercel bot commented on e440b44 Jun 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-dev-nrwl.vercel.app
nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx.dev

Please sign in to comment.