Add --country flag to store create dev#7947
Open
amcaplan wants to merge 5 commits into
Open
Conversation
Extracts and shares the country-code validation already used by store create preview: countryFlag, isCountryCode, and a shared invalidCountryCodeMessage in flags.ts, plus devStoreFlags.country. The flag is validated, plumbed into createDevStore options, and shown in JSON/success output, but is NOT yet sent to the BP createAppDevelopmentStore mutation -- the published schema does not expose a country argument until shop/world#671185 (part of shop/world#22968) merges. GraphQL wiring is a trivial follow-up. Command is hidden; no changeset (not functional end-to-end yet). Assisted-By: devx/bf777827-dc69-4993-9b11-c401dc19c4be
The --country flag was collected and shown in output but never sent to the createAppDevelopmentStore mutation. Wire it through as the 'country' argument now that the backend supports it. Assisted-By: devx/de0d96e7-211c-4a8b-991d-240b9f675823
6d5c228 to
5e41699
Compare
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Assisted-By: devx/7f40dd7e-8ac5-44cb-8a46-99677b33f144
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a normalized/validated --country flag to shopify store create dev (and reuses the same flag in store create preview) and threads the value through to the dev-store creation flow and outputs, aiming to share validation logic between store-creation commands.
Changes:
- Introduces a shared
countryFlagwith normalization + validation, and wires it into bothstore create devandstore create preview. - Extends dev store creation to accept a
countryoption and include it in JSON/success outputs. - Updates the dev-store GraphQL mutation + generated document to include an optional
countryvariable/argument.
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/store/src/cli/services/store/create/dev.ts | Adds optional country to dev-store creation options, sends it in variables, and surfaces it in success/JSON output. |
| packages/store/src/cli/services/store/create/dev.test.ts | Updates expectations for the mutation variables and adds coverage around country behavior. |
| packages/store/src/cli/flags.ts | Adds shared countryFlag with normalization/validation and a single env var binding. |
| packages/store/src/cli/commands/store/create/preview.ts | Switches preview command to use the shared countryFlag and removes inline validation. |
| packages/store/src/cli/commands/store/create/dev.ts | Adds --country flag and passes it through to the dev-store service. |
| packages/store/src/cli/commands/store/create/dev.test.ts | Adds CLI-level coverage for --country normalization and invalid input rejection. |
| packages/store/src/cli/api/graphql/business-platform-organizations/mutations/create_app_development_store.graphql | Adds $country and country: $country to the mutation operation. |
| packages/store/src/cli/api/graphql/business-platform-organizations/generated/create_app_development_store.ts | Updates generated types/document AST to include country. |
| packages/cli/oclif.manifest.json | Regenerates manifest to reflect the new --country flag and env var metadata. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -1,9 +1,10 @@ | |||
| mutation CreateAppDevelopmentStore($shopName: String!, $priceLookupKey: String!, $prepopulateTestData: Boolean, $developerPreviewHandle: String) { | |||
| mutation CreateAppDevelopmentStore($shopName: String!, $priceLookupKey: String!, $prepopulateTestData: Boolean, $developerPreviewHandle: String, $country: String) { | |||
Comment on lines
64
to
+68
| shopName: name, | ||
| priceLookupKey: DEV_STORE_PLANS[plan], | ||
| prepopulateTestData: options.withDemoData ?? false, | ||
| developerPreviewHandle: options.featurePreview, | ||
| country: options.country, |
| } else { | ||
| const rows: InlineToken[][] = [] | ||
| pushRow(rows, 'Domain', shopDomain) | ||
| pushRow(rows, 'Admin', shopAdminUrl ? {link: {label: shopAdminUrl, url: shopAdminUrl}} : undefined) |
Comment on lines
+21
to
+24
| 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
+172
to
+176
| await createDevStore({name: 'test-store', organization: defaultOrg, plan: 'plus', country: 'CA', json: false}) | ||
|
|
||
| expect(businessPlatformOrganizationsRequestDoc).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| variables: expect.objectContaining({country: 'CA'}), |
Contributor
|
| Env Var | Previously Used By |
|---|---|
SHOPIFY_FLAG_PREVIEW_STORE_COUNTRY |
store:create:preview --country |
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.
What
Adds a
--countryflag toshopify store create dev, implementing the country piece of shop/world#22968, and shares the flag — definition, validation, and error message — withshopify store create preview.flags.tsexports a single sharedcountryFlagconstant (envSHOPIFY_FLAG_STORE_COUNTRY). Itsparsenormalizes the value to trimmed uppercase and validates the two-letter shape, throwing a consistentAbortErrorbefore a command'srunbody executes.isCountryCodeand the error message are internal implementation details of the flag.store create devandstore create previewreference this onecountryFlag, so validation and error output are identical and defined in exactly one place — no per-commandif-checks.store create devthreads--countryintocreateDevStore, which sends it to the BPcreateAppDevelopmentStoremutation and surfaces it in JSON and success output.Notes
parse(oclif enforces it), rather than being duplicated in each command.SHOPIFY_FLAG_PREVIEW_STORE_COUNTRYto the sharedSHOPIFY_FLAG_STORE_COUNTRY. The--countryflag is new/unreleased and the command ishidden, so there's no external impact.hidden; no changeset.