Skip to content

Commit

Permalink
feat(nx-plugin): enable createPackageName prompt (nrwl#17646)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiongemi authored and meeroslav committed Jun 23, 2023
1 parent 0544b89 commit a543851
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

0 comments on commit a543851

Please sign in to comment.