Add deprecated flag warning to build#609
Merged
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
df040ed to
822fbf4
Compare
Contributor
Author
|
This solution forces the banners to render individually, if we wanted a different experience, we might want to add a const DEPRECATED_FLAGS = [...]
async catch(error: Error & {args?: string[]}) {
if (error?.args?.some((flag) => DEPRECATED_FLAGS.includes(flag))) {
renderInfo({
headline: `The ${colors.bold(
error.args.join(' '),
)} flags are deprecated and will be removed in a future version of Shopify CLI.`,
});
throw error;
}My feeling is that 90% of the time users will hit this error when moving from H1 to H2 and not updating the |
frandiox
approved these changes
Mar 2, 2023
Contributor
Author
|
@pepicrft @matteodepalo maybe something like this should make it's way into the cli-kit 🤔 I could see this being a common pattern. |
Merged
|
Interesting! Definitely something that we could add to cli-kit. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

WHY are these changes introduced?
This PR adds a helper that we can add to the commands whose flags have changed from going from v1 to v2. Currently the CLI will fail if an unsupported flag is passed without much indication of why. For example:
I saw the above example come up in Discord.
WHAT is this pull request doing?
There are a few ways we can address this, but I chose to create a small helper we can add to the Command's flag object. In this PR I've added it to some of the deprecated
buildflags.HOW to test your changes?
Run the CLI locally with a flag from H1 (ie: --entry).
Post-merge steps
Checklist