-
Notifications
You must be signed in to change notification settings - Fork 263
Add --country flag to store create dev #7947
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
Open
amcaplan
wants to merge
6
commits into
main
Choose a base branch
from
add-country-flag-to-store-create-dev
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+192
−29
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ab8ebaf
Add --country flag to store create dev (validation/scaffolding only)
amcaplan 5e41699
Send country code when creating a dev store
amcaplan f1b89cc
Validate --country in flag parse to share logic across commands
amcaplan 7654e85
Remove decisions files
amcaplan dfaab40
Consolidate --country into a single shared flag constant
amcaplan 2d79e39
Always render Admin row with N/A fallback in dev store success output
amcaplan 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
Some comments aren't visible on the classic Files Changed page.
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
3 changes: 2 additions & 1 deletion
3
...pi/graphql/business-platform-organizations/mutations/create_app_development_store.graphql
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
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 |
|---|---|---|
| @@ -1,24 +1,35 @@ | ||
| import {normalizeStoreFqdn} from '@shopify/cli-kit/node/context/fqdn' | ||
| import {normalizeBulkOperationId} from '@shopify/cli-kit/node/api/bulk-operations' | ||
| import {resolvePath} from '@shopify/cli-kit/node/path' | ||
| import {AbortError} from '@shopify/cli-kit/node/error' | ||
| import {Flags} from '@oclif/core' | ||
|
|
||
| function countryFlag(env: string) { | ||
| return Flags.string({ | ||
| description: 'Two-letter country code for the store, such as US, CA, or GB.', | ||
| env, | ||
| required: false, | ||
| parse: async (value) => value.trim().toUpperCase(), | ||
| }) | ||
| } | ||
| // Error message shown when a `--country` flag value is not a two-letter code. | ||
| const invalidCountryCodeMessage = 'Country must be a two-letter country code, for example: US.' | ||
|
|
||
| export function isCountryCode(value: string): boolean { | ||
| // Matches a two-letter (ISO 3166-1 alpha-2 shaped) country code after normalization. | ||
| function isCountryCode(value: string): boolean { | ||
| return /^[A-Z]{2}$/.test(value) | ||
| } | ||
|
|
||
| export const previewStoreFlags = { | ||
| country: countryFlag('SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY'), | ||
| } | ||
| /** | ||
| * Reusable `--country` flag shared by every store-creation command. The value | ||
| * is normalized to an uppercase, trimmed string and validated during parsing, | ||
| * so invalid codes are rejected with the same error before a command's `run` | ||
| * body executes. | ||
| */ | ||
| export const countryFlag = Flags.string({ | ||
| description: 'Two-letter country code for the store, such as US, CA, or GB.', | ||
| env: 'SHOPIFY_FLAG_STORE_COUNTRY', | ||
| required: false, | ||
|
Comment on lines
+21
to
+24
Contributor
Author
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. No, we should migrate. This probably isn't a significant enough change and create preview store was just introduced, I'm not super worried. |
||
| parse: async (value) => { | ||
| const normalized = value.trim().toUpperCase() | ||
| if (!isCountryCode(normalized)) { | ||
| throw new AbortError(invalidCountryCodeMessage) | ||
| } | ||
| return normalized | ||
| }, | ||
| }) | ||
|
|
||
| export const storeFlags = { | ||
| store: Flags.string({ | ||
|
|
||
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
Oops, something went wrong.
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.