-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
yarn <command> ls
command cleanup
#4045
Conversation
src/cli/commands/team.js
Outdated
function warnDeprecation(reporter: Reporter) { | ||
reporter.warn(`\`yarn team rm\` is deprecated. Please use \`yarn team remove\`.`); | ||
function warnDeprecation(reporter: Reporter, deprecationWarning: DeprecationWarning) { | ||
reporter.warn(`\`yarn team ${deprecationWarning.deprecatedCommand}\` is deprecated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be using reporter.lang
and add a language key for these so they can be translated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok not a problem!
src/cli/commands/team.js
Outdated
function wrapRequired( | ||
callback: CLIFunctionWithParts, | ||
requireTeam: boolean, | ||
subCommandDeprecated?: DeprecationWarning, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rename this to deprecationMessage
or deprecationInfo
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do
flags: Object, | ||
args: Array<string>, | ||
): CLIFunctionReturn { | ||
if (args.length === 1) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return args.length === 1 && callback(...);
Also would be nice to explain why we do this only when argument count is exactly 1.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yarn team list
only takes one arg which is either: <scope>
or <scope:team>
more than one arg and the command should fail.
@tpina thanks a lot! This looks good to me. Would you like to address my changes or just merge it as it is? |
@BYK I'll address your changes/comments. Let me take another look at it. |
@BYK a really annoying thing with the Is there any way around this without messing around with the regex in the base reporter? Worst case scenario I'll use dedicated messages. |
meh... workaround added. See if you agree once checks have completed. |
src/reporters/lang/en.js
Outdated
@@ -324,6 +324,8 @@ const messages = { | |||
'Installing Yarn via Yarn will result in you having two separate versions of Yarn installed at the same time, which is not recommended. To update Yarn please follow https://yarnpkg.com/en/docs/install .', | |||
|
|||
scopeNotValid: 'The specified scope is not valid.', | |||
|
|||
yarnDeprecatedCommand: '`yarn $0 $1` is deprecated.\n Please use `yarn $0 $2`.', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would repeat the yarn
part in the message :(
I'll fix it and then merge.
@BYK you're right. Apologies for that. |
I think the current doc does not reflect the |
@Lucas-C thanks for the heads up! Filed yarnpkg/website#660 |
Summary
From #3898 (comment)
This PR is to clean up the remaining undeprecated
yarn <command> ls
command and update the usage template.Test plan
Some rounds of functional manual testing to assert that the correct messages are displayed and previous commands work as per expected. Touched files do not have any associated tests.