-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat(cli): on update process add flag to opt-out from publishing #415
Changes from all commits
5935a6c
e501b2d
e5ad2b7
2d2718a
a5a690e
3a6d8b9
c731282
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ import { Scope } from '../../storyblok/storyblok-client' | |
export type DeployArgs = { | ||
skipPrompts: boolean | ||
dir: string | ||
publish: boolean | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BibiSebi is this value coming from the flag There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah its rather weird and unintuitive but when defining it will automatically translate it into There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, next level of a smart tool 🤯 Love it! |
||
name: undefined | string | ||
token: undefined | string | ||
output: undefined | string | ||
|
@@ -25,7 +26,8 @@ export type DeployArgs = { | |
type DeployFunc = (args: DeployArgs) => Promise<void> | ||
|
||
export const deploy: DeployFunc = async (params) => { | ||
const { skipPrompts, token, name, dir, output, dotEnvPath, scope } = params | ||
const { skipPrompts, token, name, dir, output, publish, dotEnvPath, scope } = | ||
params | ||
|
||
console.log(bold(cyan('\nWelcome!'))) | ||
console.log("Let's deploy a field-plugin.\n") | ||
|
@@ -106,6 +108,7 @@ export const deploy: DeployFunc = async (params) => { | |
token: personalAccessTokenResult.token, | ||
output: outputFile, | ||
scope: apiScope, | ||
publish, | ||
}) | ||
|
||
console.log( | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -60,6 +60,10 @@ export const createCLI = () => { | |
'--name <value>', | ||
'name of plugin (Lowercase alphanumeric and dash)', | ||
) | ||
.option( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried out this approach as described in commander.js --> https://www.npmjs.com/package/commander#other-option-types-negatable-boolean-and-booleanvalue However I might rewrite it depending on your feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The approach looks good to me, Bibi. 🤔 I wonder though, what if we have just the The combinations would be something like:
I didn't think deeply about it, so I may be missing some pieces 🤣 🤣 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This might also work. Let's see what @eunjae-lee and @Dawntraoz think as well :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be a slight breaking change. Let's imagine someone was using deploy command with all the options except for --skipPrompts, but since all the options were given, they didn't encounter any prompt, and they used it for their CI. Now we're changing the default behavior to prompt about publishing. Then their CI will break. So I think we can keep publishing by default, and just provide There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok so you would also suggest removing --publish? Works for me :) I will adjust it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @demetriusfeijoo @eunjae-lee here are the updates |
||
'--no-publish', | ||
'This flag is only applied when a plugin is being updated! Uploads field plugin but does not publish a new version.', | ||
) | ||
.addOption( | ||
new Option( | ||
'--output <value>', | ||
|
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 am not 100% happy about this as it is a piece of code that might easily get overlooked, but I think keeping it to publish:true makes sense here, as it kind of mimics the creation process. So I would suggest keeping it to not confuse our users.