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(devkit): show example in deprecation message #18823

Merged
merged 1 commit into from
Aug 24, 2023
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
readJson,
readNxJson,
updateNxJson,
stripIndents,
} = requireNx();

export type ProjectNameAndRootFormat = 'as-provided' | 'derived';
Expand Down Expand Up @@ -154,8 +155,9 @@ async function determineFormat(
format === asProvidedSelectedValue ? 'as-provided' : 'derived'
);

const deprecationWarning =
'In Nx 18, generating projects will no longer derive the name and root. Please provide the exact project name and root in the future.';
const deprecationWarning = stripIndents`
In Nx 18, generating projects will no longer derive the name and root.
Please provide the exact project name and root in the future.`;

if (result === 'as-provided' && callingGenerator) {
const { saveDefault } = await prompt<{ saveDefault: boolean }>({
Expand All @@ -174,7 +176,8 @@ async function determineFormat(
logger.warn(deprecationWarning);
}
} else {
logger.warn(deprecationWarning);
const example = `Example: nx g ${callingGenerator} ${formats[result].projectName} --directory ${formats[result].projectRoot}`;
logger.warn(deprecationWarning + '\n' + example);
}

return result;
Expand Down