-
Notifications
You must be signed in to change notification settings - Fork 402
feat: add kebab-case options to cli flags #5395
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
Merged
khendrikse
merged 14 commits into
main
from
feat-55/add-kebab-case-options-to-cli-flags
Jan 18, 2023
Merged
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
c7fae0c
feat: add kebab-case options to cli flags - first example
khendrikse 5c70706
feat: remove option_deprecation functions and just leave old options
khendrikse 0534278
Merge branch 'main' into feat-55/add-kebab-case-options-to-cli-flags
khendrikse 0914de2
Merge branch 'main' into feat-55/add-kebab-case-options-to-cli-flags
khendrikse e1697eb
docs: update docs
khendrikse 221c843
fix: add --http-proxy-certificate-filename and hide --httpProxyCertifβ¦
khendrikse a3f8a62
fix: add --prod-if-unlocked and hide --prodIfUnlocked for deploy
khendrikse e2f7314
fix: add --git-remote-name and hide --gitRemoteName for init and link
khendrikse 5c27054
fix: add --replace-existing and hide --replaceExisting from env-import
khendrikse 4e8e17c
fix: add --target-port and hide --targetPort for dev
khendrikse a35ddf1
fix: add --session-id and hide --sessionId for dev
khendrikse afd849c
fix: add --functions-port and hide --functionsPort for dev and serve
khendrikse 0680919
fix: add --edge-inspect-brk and hide --edgeInspectBrk from dev
khendrikse 15d8ece
fix: add --edge-inspect and hide --edgeInspect to dev
khendrikse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { chalk, log, NETLIFYDEVWARN } from './command-helpers.mjs' | ||
|
||
// This file contains logic for flags in camelcase that will be deprecated in v13 and replaced in kebab-case. | ||
// Flags to be deprecated in v13 | ||
const DEPRECATED_OPTIONS = { | ||
httpProxy: { option: '--httpProxy', newOption: '--http-proxy', deprecatedVersion: 'v13' }, | ||
khendrikse marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
// TODO v13: remove all options that use this function | ||
export const deprecatedArgParser = (value) => ({ | ||
value, | ||
deprecationWarn: true, | ||
}) | ||
|
||
// TODO v13: remove all uses of this function in the code so they can fall back on just using `option` instead of `option.value` | ||
export const returnDeprecatedOptionValue = (option) => (option.value ? option.value : option) | ||
|
||
export const warnForDeprecatedOptions = (options) => { | ||
Object.entries(options).forEach(([option, value]) => { | ||
const deprecatedOption = DEPRECATED_OPTIONS[option] | ||
|
||
if (value.deprecationWarn && deprecatedOption) { | ||
log( | ||
NETLIFYDEVWARN, | ||
chalk.yellowBright( | ||
`The flag ${deprecatedOption.option} is replaced by ${deprecatedOption.newOption} and will be deprecated in ${deprecatedOption.deprecatedVersion}`, | ||
), | ||
) | ||
} | ||
}) | ||
} |
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.
Uh oh!
There was an error while loading. Please reload this page.