Add basic list commands and prpepare create and delete
[Feature] Add store list command to display development stores
WHY are these changes introduced?
To provide CLI users with the ability to view their development stores directly from the command line, making it easier to manage and work with their development environments.
WHAT is this pull request doing?
- Adds a new
shopify store listcommand that displays development stores in the user's organization - Implements the service logic to fetch and display stores from the Business Platform API
- Updates the CLI documentation to include the new command
- Sets up the necessary file structure for future store management commands
How to test your changes?
Set up:
- make sure you have the branch in the world prototype checked out locally
- generate the GraphQL schemas in world:
dev dump-graphql - in the CLI, get the graphql schemas:
SHOPIFY_SERVICE_ENV=local pnpm graphql-codegen:get-graphql-schemas - in the CLI, generate types from those schemas:
pnpm graphql-codegen - just in case, in the CLI, clean the cache:
pnpm clean
Test a dev store creation:
- Add the
shop:createscope in identity (shopify-cli-development) - Run
shopify store listfrom the command line - You should be prompted to select an organization if you have access to multiple
- The command should display a table of development stores with their names, domains, and IDs
- Verify that the output is correctly formatted and contains the expected information
Other commands:
SHOPIFY_CLI_NEVER_USE_PARTNERS_API=1 SHOPIFY_SERVICE_ENV=local pnpm shopify store createSHOPIFY_CLI_NEVER_USE_PARTNERS_API=1 SHOPIFY_SERVICE_ENV=local pnpm shopify store delete
Measuring impact
How do we know this change was effective? Please choose one:
- [ ] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
- [x] Existing analytics will cater for this addition
- [ ] PR includes analytics changes to measure impact
Checklist
- [x] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
- #6408
π (View in Graphite) main
This stack of pull requests is managed by Graphite. Learn more about stacking.
Unused dependencies (1)
| Filename | dependencies |
|---|---|
| packages/store/package.json | @oclif/core |
Unused exports (3)
| Filename | exports |
|---|---|
| packages/store/src/cli/utilities/app-dev-store-client.ts | encodedGidFromOrganizationIdForBPencodedGidFromShopIdgidFromShopIdForShopify |
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 78.1% (-0.52% π») |
13514/17303 |
| π‘ | Branches | 72.13% (-0.5% π») |
6562/9098 |
| π‘ | Functions | 78.37% (-0.5% π») |
3510/4479 |
| π‘ | Lines | 78.45% (-0.51% π») |
12774/16284 |
Show new covered files π£
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / flow-template.ts |
100% | 100% | 100% | 100% |
| π΄ | ... / organizations.ts |
0% | 100% | 100% | 0% |
| π΄ | ... / user-info.ts |
0% | 100% | 100% | 0% |
| π΄ | ... / create_app_development_store.ts |
0% | 100% | 100% | 0% |
| π΄ | ... / fetch_dev_store_by_domain.ts |
0% | 100% | 100% | 0% |
| π΄ | ... / list_app_dev_stores.ts |
0% | 100% | 100% | 0% |
| π΄ | ... / app-dev-store-client.ts |
0% | 0% | 0% | 0% |
| π΄ | ... / create.ts |
0% | 100% | 0% | 0% |
| π΄ | ... / list.ts |
0% | 100% | 0% | 0% |
| π΄ | ... / create.ts |
0% | 0% | 0% | 0% |
| π΄ | ... / list.ts |
0% | 0% | 0% | 0% |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π’ | ... / app.ts |
86.49% (-0.07% π») |
68.57% | 93.44% (-0.11% π») |
88.2% (-0.07% π») |
| π’ | ... / extension-instance.ts |
82.68% (-0.38% π») |
77.6% (-1.14% π») |
92.73% | 82.42% (-0.42% π») |
| π’ | ... / write-app-logs.ts |
90% (-0.48% π») |
100% | 100% | 90% (-0.48% π») |
| π΄ | ... / extension.ts |
57.38% (-2.97% π») |
60% | 44.44% (-5.56% π») |
58.33% (-3.07% π») |
| π’ | ... / app-event-watcher.ts |
97.62% (-0.11% π») |
91.43% | 95.45% | 100% |
| π’ | ... / bundle.ts |
82.35% (-10.87% π») |
66.67% | 73.33% (-14.9% π») |
83.67% (-12.62% π») |
| π΄ | ... / app-management-client.ts |
53.45% (-0.32% π») |
47.06% (-0.62% π») |
49.09% (-0.45% π») |
52.26% (-0.17% π») |
| π’ | ... / session.ts |
89.6% (-1.51% π») |
77.53% (-1.47% π») |
91.67% (-0.64% π») |
88.98% (-1.57% π») |
| π’ | ... / headers.ts |
100% | 87.5% (-2.5% π») |
100% | 100% |
| π΄ | ... / schema.ts |
44.44% (-25.56% π») |
0% (-50% π») |
0% (-50% π») |
50% (-16.67% π») |
| π΄ | ... / store.ts |
50% (-43.55% π») |
25% (-68.75% π») |
100% | 50% (-42.59% π») |
| π’ | ... / Tasks.tsx |
94% (-6% π») |
93.1% (-6.9% π») |
88.89% (-11.11% π») |
93.62% (-6.38% π») |
| π’ | ... / environments.ts |
100% | 91.67% (-8.33% π») |
100% | 100% |
| π’ | ... / session.ts |
97.96% (+3.73% πΌ) |
100% (+4.88% πΌ) |
85.71% (-1.79% π») |
97.96% (+3.73% πΌ) |
| π΄ | ... / ui.tsx |
49.15% (-2.46% π») |
42.86% (-5.53% π») |
51.61% (-1.51% π») |
48.28% (-2.54% π») |
| π‘ | ... / flags.ts |
71.43% (-19.48% π») |
100% | 50% (-25% π») |
66.67% (-23.33% π») |
| π’ | ... / theme-command.ts |
85.71% (-0.24% π») |
68.25% (-1.9% π») |
83.33% | 87.04% (-0.24% π») |
| π’ | ... / theme-uploader.ts |
93.22% (-0.04% π») |
79.63% (-0.73% π») |
92.19% | 94.3% (-0.04% π») |
Test suite run success
3241 tests passing in 1360 suites.
Report generated by π§ͺjest coverage report action from ec611a33494db1462f450293d17c7c61a411694e
Differences in type declarations
We detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
- Some seemingly private modules might be re-exported through public modules.
- If the branch is behind
mainyou might see odd diffs, rebasemaininto this branch.
New type declarations
packages/cli-kit/dist/public/node/api/dev-store.d.ts
import { CacheOptions, GraphQLResponse, UnauthorizedHandler } from './graphql.js';
import { RequestModeInput } from '../http.js';
import { TypedDocumentNode } from '@graphql-typed-document-node/core';
import { Variables } from 'graphql-request';
export declare const devStoresHeaders: (token: string) => {
[key: string]: string;
};
export interface RequestOptions {
requestMode: RequestModeInput;
}
/**
* @param organizationId - The organization ID.
* @param query - GraphQL query to execute.
* @param token - Partners token.
* @param variables - GraphQL variables to pass to the query.
* @param cacheOptions - Cache options for the request. If not present, the request will not be cached.
* @param requestOptions - Preferred behaviour for the request.
* @param unauthorizedHandler - Optional handler for unauthorized requests.
*/
export interface DevStoresRequestOptions<TResult, TVariables extends Variables> {
query: TypedDocumentNode<TResult, TVariables>;
shopFqdn: string;
token: string;
variables?: TVariables;
cacheOptions?: CacheOptions;
requestOptions?: RequestOptions;
unauthorizedHandler: UnauthorizedHandler;
}
/**
* Executes an org-scoped GraphQL query against the App Management API. Uses typed documents.
*
* @param options - The options for the request.
* @returns The response of the query of generic type <T>.
*/
export declare function devStoresRequestDoc<TResult, TVariables extends Variables>(options: DevStoresRequestOptions<TResult, TVariables>): Promise<TResult>;
/**
* Sets the next deprecation date from [GraphQL response extensions](https://www.apollographql.com/docs/resources/graphql-glossary/#extensions)
* if `response.extensions.deprecations` objects contain a `supportedUntilDate` (ISO 8601-formatted string).
*
* @param response - The response of the query.
*/
export declare function handleDeprecations<T>(response: GraphQLResponse<T>): void;
Existing type declarations
packages/cli-kit/dist/public/node/context/fqdn.d.ts
@@ -18,6 +18,12 @@ export declare function adminFqdn(): Promise<string>;
* @returns Fully-qualified domain of the App Management service we should interact with.
*/
export declare function appManagementFqdn(): Promise<string>;
+/**
+ * It returns the Dev Store API service we should interact with.
+ *
+ * @returns Fully-qualified domain of the Dev Store service we should interact with.
+ */
+export declare function devStoreFqdn(): Promise<string>;
/**
* It returns the App Dev API service we should interact with.
*
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. β If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.