Skip to content

Commit 8aea542

Browse files
Add basic list commands and prpepare create and delete
1 parent 59bbf90 commit 8aea542

28 files changed

+1423
-8
lines changed

graphql.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,5 +86,6 @@ export default {
8686
// Store package projects
8787
storeAdmin: projectFactory('admin', 'admin_schema.graphql', 'store'),
8888
storeBusinessPlatformDestinations: projectFactory('business-platform-destinations', 'destinations_schema.graphql', 'store'),
89+
storeBusinessPlatformOrganizations: projectFactory('business-platform-organizations', 'organizations_schema.graphql', 'store'),
8990
},
9091
}

packages/cli-kit/src/private/node/session/scopes.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ function defaultApiScopes(api: API): string[] {
5252
case 'partners':
5353
return ['cli']
5454
case 'business-platform':
55-
return ['destinations', 'store-management', 'on-demand-user-access']
55+
return ['destinations', 'store-management', 'on-demand-user-access', 'shop-create']
5656
case 'app-management':
5757
return ['app-management']
5858
default:
@@ -80,6 +80,8 @@ function scopeTransform(scope: string): string {
8080
return 'https://api.shopify.com/auth/organization.on-demand-user-access'
8181
case 'app-management':
8282
return 'https://api.shopify.com/auth/organization.apps.manage'
83+
case 'shop-create':
84+
return 'https://api.shopify.com/auth/shop.create'
8385
default:
8486
return scope
8587
}

packages/cli/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
* [`shopify plugins unlink [PLUGIN]`](#shopify-plugins-unlink-plugin)
6565
* [`shopify plugins update`](#shopify-plugins-update)
6666
* [`shopify search [query]`](#shopify-search-query)
67+
* [`shopify store create`](#shopify-store-create)
68+
* [`shopify store list`](#shopify-store-list)
6769
* [`shopify theme check`](#shopify-theme-check)
6870
* [`shopify theme console`](#shopify-theme-console)
6971
* [`shopify theme delete`](#shopify-theme-delete)
@@ -1698,6 +1700,34 @@ EXAMPLES
16981700
shopify search "<a search query separated by spaces>"
16991701
```
17001702

1703+
## `shopify store create`
1704+
1705+
List your development stores.
1706+
1707+
```
1708+
USAGE
1709+
$ shopify store create
1710+
1711+
DESCRIPTION
1712+
List your development stores.
1713+
1714+
Display a list of development stores in your organization.
1715+
```
1716+
1717+
## `shopify store list`
1718+
1719+
List your development stores.
1720+
1721+
```
1722+
USAGE
1723+
$ shopify store list
1724+
1725+
DESCRIPTION
1726+
List your development stores.
1727+
1728+
Display a list of development stores in your organization.
1729+
```
1730+
17011731
## `shopify theme check`
17021732

17031733
Validate the theme.

packages/cli/oclif.manifest.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4988,6 +4988,44 @@
49884988
"strict": true,
49894989
"summary": "Copy, export, or import store data"
49904990
},
4991+
"store:create": {
4992+
"aliases": [
4993+
],
4994+
"args": {
4995+
},
4996+
"customPluginName": "@shopify/store",
4997+
"description": "Display a list of development stores in your organization.",
4998+
"flags": {
4999+
},
5000+
"hasDynamicHelp": false,
5001+
"hiddenAliases": [
5002+
],
5003+
"id": "store:create",
5004+
"pluginAlias": "@shopify/cli",
5005+
"pluginName": "@shopify/cli",
5006+
"pluginType": "core",
5007+
"strict": true,
5008+
"summary": "List your development stores."
5009+
},
5010+
"store:list": {
5011+
"aliases": [
5012+
],
5013+
"args": {
5014+
},
5015+
"customPluginName": "@shopify/store",
5016+
"description": "Display a list of development stores in your organization.",
5017+
"flags": {
5018+
},
5019+
"hasDynamicHelp": false,
5020+
"hiddenAliases": [
5021+
],
5022+
"id": "store:list",
5023+
"pluginAlias": "@shopify/cli",
5024+
"pluginName": "@shopify/cli",
5025+
"pluginType": "core",
5026+
"strict": true,
5027+
"summary": "List your development stores."
5028+
},
49915029
"theme:check": {
49925030
"aliases": [
49935031
],

packages/store/project.json

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,14 @@
7575
"inputs": [{ "dependentTasksOutputFiles": "**/*.ts" }],
7676
"outputs": [
7777
"{projectRoot}/src/cli/api/graphql/admin/generated/**/*.ts",
78-
"{projectRoot}/src/cli/api/graphql/business-platform-destinations/generated/**/*.ts"
78+
"{projectRoot}/src/cli/api/graphql/business-platform-destinations/generated/**/*.ts",
79+
"{projectRoot}/src/cli/api/graphql/business-platform-organizations/generated/**/*.ts"
7980
],
8081
"options": {
8182
"commands": [
8283
"pnpm eslint 'src/cli/api/graphql/admin/generated/**/*.ts' --fix --rule '@typescript-eslint/ban-ts-comment: off' --rule 'eslint-comments/no-unused-disable: off'",
83-
"pnpm eslint 'src/cli/api/graphql/business-platform-destinations/generated/**/*.ts' --fix --rule '@typescript-eslint/ban-ts-comment: off' --rule 'eslint-comments/no-unused-disable: off'"
84-
],
84+
"pnpm eslint 'src/cli/api/graphql/business-platform-destinations/generated/**/*.ts' --fix --rule '@typescript-eslint/ban-ts-comment: off' --rule 'eslint-comments/no-unused-disable: off'",
85+
"pnpm eslint 'src/cli/api/graphql/business-platform-organizations/generated/**/*.{ts,tsx}' --fix --rule '@typescript-eslint/ban-ts-comment: off' --rule 'eslint-comments/no-unused-disable: off'"],
8586
"cwd": "packages/store"
8687
}
8788
},
@@ -107,21 +108,35 @@
107108
"cwd": "{workspaceRoot}"
108109
}
109110
},
111+
"graphql-codegen:generate:business-platform-organizations": {
112+
"executor": "nx:run-commands",
113+
"inputs": ["{workspaceRoot}/graphql.config.ts", "{projectRoot}/src/cli/api/graphql/business-platform-organizations/**/*.graphql"],
114+
"outputs": ["{projectRoot}/src/cli/api/graphql/business-platform-organizations/generated/**/*.ts"],
115+
"options": {
116+
"commands": [
117+
"pnpm exec graphql-codegen --project=storeBusinessPlatformOrganizations"
118+
],
119+
"cwd": "{workspaceRoot}"
120+
}
121+
},
110122
"graphql-codegen:postfix": {
111123
"executor": "nx:run-commands",
112124
"dependsOn": [
113125
"graphql-codegen:generate:admin",
114-
"graphql-codegen:generate:business-platform-destinations"
126+
"graphql-codegen:generate:business-platform-destinations",
127+
"graphql-codegen:generate:business-platform-organizations"
115128
],
116129
"inputs": [{ "dependentTasksOutputFiles": "**/*.ts" }],
117130
"outputs": [
118131
"{projectRoot}/src/cli/api/graphql/admin/generated/**/*.ts",
119-
"{projectRoot}/src/cli/api/graphql/business-platform-destinations/generated/**/*.ts"
132+
"{projectRoot}/src/cli/api/graphql/business-platform-destinations/generated/**/*.ts",
133+
"{projectRoot}/src/cli/api/graphql/business-platform-organizations/generated/**/*.ts"
120134
],
121135
"options": {
122136
"commands": [
123137
"find ./packages/store/src/cli/api/graphql/admin/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
124-
"find ./packages/store/src/cli/api/graphql/business-platform-destinations/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;"
138+
"find ./packages/store/src/cli/api/graphql/business-platform-destinations/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;",
139+
"find ./packages/store/src/cli/api/graphql/business-platform-organizations/generated/ -type f -name '*.ts' -exec sh -c 'sed -i \"\" \"s|import \\* as Types from '\\''./types'\\'';|import \\* as Types from '\\''./types.js'\\'';|g; s|export const \\([A-Za-z0-9_]*\\)Document =|export const \\1 =|g\" \"$0\"' {} \\;"
125140
],
126141
"cwd": "{workspaceRoot}"
127142
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/ban-types, @typescript-eslint/no-duplicate-type-constituents, @typescript-eslint/no-redundant-type-constituents, @nx/enforce-module-boundaries */
2+
import * as Types from './types.js'
3+
4+
import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core'
5+
6+
export type ListOrganizationsQueryVariables = Types.Exact<{[key: string]: never}>
7+
8+
export type ListOrganizationsQuery = {
9+
currentUserAccount?: {
10+
uuid: string
11+
organizationsWithAccessToDestination: {nodes: {id: string; name: string}[]}
12+
} | null
13+
}
14+
15+
export const ListOrganizations = {
16+
kind: 'Document',
17+
definitions: [
18+
{
19+
kind: 'OperationDefinition',
20+
operation: 'query',
21+
name: {kind: 'Name', value: 'ListOrganizations'},
22+
selectionSet: {
23+
kind: 'SelectionSet',
24+
selections: [
25+
{
26+
kind: 'Field',
27+
name: {kind: 'Name', value: 'currentUserAccount'},
28+
selectionSet: {
29+
kind: 'SelectionSet',
30+
selections: [
31+
{kind: 'Field', name: {kind: 'Name', value: 'uuid'}},
32+
{
33+
kind: 'Field',
34+
name: {kind: 'Name', value: 'organizationsWithAccessToDestination'},
35+
arguments: [
36+
{
37+
kind: 'Argument',
38+
name: {kind: 'Name', value: 'destination'},
39+
value: {kind: 'EnumValue', value: 'APPS_CLI'},
40+
},
41+
],
42+
selectionSet: {
43+
kind: 'SelectionSet',
44+
selections: [
45+
{
46+
kind: 'Field',
47+
name: {kind: 'Name', value: 'nodes'},
48+
selectionSet: {
49+
kind: 'SelectionSet',
50+
selections: [
51+
{kind: 'Field', name: {kind: 'Name', value: 'id'}},
52+
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
53+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
54+
],
55+
},
56+
},
57+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
58+
],
59+
},
60+
},
61+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
62+
],
63+
},
64+
},
65+
],
66+
},
67+
},
68+
],
69+
} as unknown as DocumentNode<ListOrganizationsQuery, ListOrganizationsQueryVariables>
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
/* eslint-disable @typescript-eslint/consistent-type-definitions, @typescript-eslint/naming-convention, @typescript-eslint/ban-types, @typescript-eslint/no-duplicate-type-constituents, @typescript-eslint/no-redundant-type-constituents, @nx/enforce-module-boundaries */
2+
import * as Types from './types.js'
3+
4+
import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core'
5+
6+
export type UserInfoQueryVariables = Types.Exact<{[key: string]: never}>
7+
8+
export type UserInfoQuery = {
9+
currentUserAccount?: {uuid: string; email: string; organizations: {nodes: {name: string}[]}} | null
10+
}
11+
12+
export const UserInfo = {
13+
kind: 'Document',
14+
definitions: [
15+
{
16+
kind: 'OperationDefinition',
17+
operation: 'query',
18+
name: {kind: 'Name', value: 'UserInfo'},
19+
selectionSet: {
20+
kind: 'SelectionSet',
21+
selections: [
22+
{
23+
kind: 'Field',
24+
name: {kind: 'Name', value: 'currentUserAccount'},
25+
selectionSet: {
26+
kind: 'SelectionSet',
27+
selections: [
28+
{kind: 'Field', name: {kind: 'Name', value: 'uuid'}},
29+
{kind: 'Field', name: {kind: 'Name', value: 'email'}},
30+
{
31+
kind: 'Field',
32+
name: {kind: 'Name', value: 'organizations'},
33+
arguments: [
34+
{kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '2'}},
35+
],
36+
selectionSet: {
37+
kind: 'SelectionSet',
38+
selections: [
39+
{
40+
kind: 'Field',
41+
name: {kind: 'Name', value: 'nodes'},
42+
selectionSet: {
43+
kind: 'SelectionSet',
44+
selections: [
45+
{kind: 'Field', name: {kind: 'Name', value: 'name'}},
46+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
47+
],
48+
},
49+
},
50+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
51+
],
52+
},
53+
},
54+
{kind: 'Field', name: {kind: 'Name', value: '__typename'}},
55+
],
56+
},
57+
},
58+
],
59+
},
60+
},
61+
],
62+
} as unknown as DocumentNode<UserInfoQuery, UserInfoQueryVariables>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
query ListOrganizations {
2+
currentUserAccount {
3+
uuid
4+
organizationsWithAccessToDestination(destination: APPS_CLI) {
5+
nodes {
6+
id
7+
name
8+
}
9+
}
10+
}
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
query UserInfo {
2+
currentUserAccount {
3+
uuid
4+
email
5+
organizations(first: 2){
6+
nodes {
7+
name
8+
}
9+
}
10+
}
11+
}

0 commit comments

Comments
 (0)