Skip to content

Commit 795168f

Browse files
authored
Merge pull request #6027 from Shopify/copy-command
Init Store Copy Command
2 parents 2377bfa + 337f8f2 commit 795168f

File tree

76 files changed

+6177
-3
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+6177
-3
lines changed

.changeset/config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
"@shopify/theme",
1212
"@shopify/ui-extensions-dev-console-app",
1313
"@shopify/plugin-cloudflare",
14-
"@shopify/plugin-did-you-mean"
14+
"@shopify/plugin-did-you-mean",
15+
"@shopify/store"
1516
]],
1617
"access": "public",
1718
"baseBranch": "main",

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ packages/cli-kit/src/private/themes/* @shopify/developer-tools @shopify/app-inne
66
packages/cli-kit/src/public/**/themes/* @shopify/developer-tools @shopify/app-inner-loop
77
packages/theme/** @shopify/developer-tools @shopify/app-inner-loop
88

9+
# Bulk Data Management and CLI owners should review changes to the store package
10+
packages/store/** @shopify/bulk-data-management-eng @shopify/app-inner-loop
11+
912
# These are metafiles that can be reviewed by anyone
1013
.changeset/* @shopify/developer-tools @shopify/app-inner-loop
1114
.github/CODEOWNERS @shopify/developer-tools @shopify/app-inner-loop

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,5 +196,10 @@ packages/ui-extensions-dev-console/.eslintrc.js
196196
packages/ui-extensions-dev-console/css-transform.js
197197
packages/ui-extensions-dev-console/dist
198198
packages/cli-kit/src/cli/api/graphql/*/*_schema.graphql
199+
packages/store/src/cli/api/graphql/*/*_schema.graphql
200+
# bulk data management/store copy
201+
*-shm
202+
*-wal
203+
*.sqlite
199204

200205
.claude

bin/get-graphql-schemas.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,26 @@ const schemas = [
7171
pathToFile: 'areas/core/shopify/db/graphql/functions_cli_api_schema_unstable_public.graphql',
7272
localPath: './packages/app/src/cli/api/graphql/functions/functions_cli_schema.graphql',
7373
},
74+
// Store package schemas
75+
{
76+
owner: 'shop',
77+
repo: 'world',
78+
pathToFile: 'areas/core/shopify/db/graphql/admin_schema_unstable_public.graphql',
79+
localPath: './packages/store/src/cli/api/graphql/admin/admin_schema.graphql',
80+
usesLfs: true,
81+
},
82+
{
83+
owner: 'Shopify',
84+
repo: 'business-platform',
85+
pathToFile: 'areas/platforms/organizations/db/graphql/destinations_schema.graphql',
86+
localPath: './packages/store/src/cli/api/graphql/business-platform-destinations/destinations_schema.graphql',
87+
},
88+
{
89+
owner: 'Shopify',
90+
repo: 'business-platform',
91+
pathToFile: 'areas/platforms/organizations/db/graphql/organizations_schema.graphql',
92+
localPath: './packages/store/src/cli/api/graphql/business-platform-organizations/organizations_schema.graphql',
93+
},
7494
]
7595

7696
/**

graphql.config.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,8 @@ export default {
8383
admin: projectFactory('admin', 'admin_schema.graphql', 'cli-kit'),
8484
webhooks: projectFactory('webhooks', 'webhooks_schema.graphql'),
8585
functions: projectFactory('functions', 'functions_cli_schema.graphql', 'app'),
86+
// Store package projects
87+
storeAdmin: projectFactory('admin', 'admin_schema.graphql', 'store'),
88+
storeBusinessPlatformDestinations: projectFactory('business-platform-destinations', 'destinations_schema.graphql', 'store'),
8689
},
8790
}

package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,21 @@
246246
]
247247
}
248248
},
249+
"packages/store": {
250+
"project": "**/*.ts!",
251+
"entry": [
252+
"**/{commands,hooks}/**/*.ts!",
253+
"**/index.ts!"
254+
],
255+
"ignore": [
256+
"**/graphql/**/generated/*.ts"
257+
],
258+
"vite": {
259+
"config": [
260+
"vite.config.ts"
261+
]
262+
}
263+
},
249264
"packages/theme": {
250265
"project": "**/*.ts!",
251266
"entry": [

packages/cli-kit/src/cli/api/graphql/admin/generated/types.d.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,6 @@ export type MetafieldOwnerType =
150150
| 'DRAFTORDER'
151151
/** The Fulfillment Constraint Rule metafield owner type. */
152152
| 'FULFILLMENT_CONSTRAINT_RULE'
153-
/** The Gate Configuration metafield owner type. */
154-
| 'GATE_CONFIGURATION'
155153
/** The GiftCardTransaction metafield owner type. */
156154
| 'GIFT_CARD_TRANSACTION'
157155
/** The Location metafield owner type. */

packages/cli/oclif.manifest.json

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4872,6 +4872,109 @@
48724872
"strict": true,
48734873
"usage": "search [query]"
48744874
},
4875+
"store:copy": {
4876+
"aliases": [
4877+
],
4878+
"args": {
4879+
},
4880+
"customPluginName": "@shopify/store",
4881+
"description": "Copy data between stores, export store data to SQLite, or import data from SQLite to a store",
4882+
"flags": {
4883+
"fromFile": {
4884+
"description": "The SQLite file to import data from.",
4885+
"env": "SHOPIFY_FLAG_FROM_FILE",
4886+
"hasDynamicHelp": false,
4887+
"multiple": false,
4888+
"name": "fromFile",
4889+
"required": false,
4890+
"type": "option"
4891+
},
4892+
"fromStore": {
4893+
"description": "The source store domain to copy/export data from (e.g., source.myshopify.com).",
4894+
"env": "SHOPIFY_FLAG_FROM_STORE",
4895+
"hasDynamicHelp": false,
4896+
"multiple": false,
4897+
"name": "fromStore",
4898+
"required": false,
4899+
"type": "option"
4900+
},
4901+
"key": {
4902+
"default": [
4903+
"products:handle"
4904+
],
4905+
"description": "The identity key to use to match resources",
4906+
"env": "SHOPIFY_FLAG_IDENTITY_KEY",
4907+
"hasDynamicHelp": false,
4908+
"multiple": true,
4909+
"name": "key",
4910+
"required": false,
4911+
"type": "option"
4912+
},
4913+
"mock": {
4914+
"allowNo": false,
4915+
"char": "m",
4916+
"description": "Use mock data instead of real API calls (for development).",
4917+
"env": "SHOPIFY_FLAG_MOCK",
4918+
"hidden": true,
4919+
"name": "mock",
4920+
"required": false,
4921+
"type": "boolean"
4922+
},
4923+
"no-color": {
4924+
"allowNo": false,
4925+
"description": "Disable color output.",
4926+
"env": "SHOPIFY_FLAG_NO_COLOR",
4927+
"hidden": false,
4928+
"name": "no-color",
4929+
"type": "boolean"
4930+
},
4931+
"no-prompt": {
4932+
"allowNo": false,
4933+
"char": "y",
4934+
"description": "Skip confirmation prompts.",
4935+
"env": "SHOPIFY_FLAG_YES",
4936+
"name": "no-prompt",
4937+
"required": false,
4938+
"type": "boolean"
4939+
},
4940+
"toFile": {
4941+
"description": "The SQLite file path to export data to. Omit to auto-generate filename.",
4942+
"env": "SHOPIFY_FLAG_TO_FILE",
4943+
"hasDynamicHelp": false,
4944+
"multiple": false,
4945+
"name": "toFile",
4946+
"required": false,
4947+
"type": "option"
4948+
},
4949+
"toStore": {
4950+
"description": "The target store domain to copy/import data to (e.g., target.myshopify.com).",
4951+
"env": "SHOPIFY_FLAG_TO_STORE",
4952+
"hasDynamicHelp": false,
4953+
"multiple": false,
4954+
"name": "toStore",
4955+
"required": false,
4956+
"type": "option"
4957+
},
4958+
"verbose": {
4959+
"allowNo": false,
4960+
"description": "Increase the verbosity of the output.",
4961+
"env": "SHOPIFY_FLAG_VERBOSE",
4962+
"hidden": false,
4963+
"name": "verbose",
4964+
"type": "boolean"
4965+
}
4966+
},
4967+
"hasDynamicHelp": false,
4968+
"hidden": true,
4969+
"hiddenAliases": [
4970+
],
4971+
"id": "store:copy",
4972+
"pluginAlias": "@shopify/cli",
4973+
"pluginName": "@shopify/cli",
4974+
"pluginType": "core",
4975+
"strict": true,
4976+
"summary": "Copy, export, or import store data"
4977+
},
48754978
"theme:check": {
48764979
"aliases": [
48774980
],

packages/cli/package.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@
116116
"@shopify/plugin-cloudflare": "3.82.0",
117117
"@shopify/plugin-did-you-mean": "3.82.0",
118118
"@shopify/theme": "3.82.0",
119+
"@shopify/store": "3.82.0",
119120
"@shopify/cli-hydrogen": "10.0.1",
120121
"@types/global-agent": "3.0.0",
121122
"@typescript-eslint/eslint-plugin": "7.13.1",
@@ -152,6 +153,9 @@
152153
"theme": {
153154
"description": "Build Liquid themes."
154155
},
156+
"store": {
157+
"description": "Manage stores and store data."
158+
},
155159
"app": {
156160
"description": "Build Shopify apps."
157161
},

packages/cli/src/index.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import Generate from './cli/commands/notifications/generate.js'
1515
import ClearCache from './cli/commands/cache/clear.js'
1616
import {createGlobalProxyAgent} from 'global-agent'
1717
import ThemeCommands from '@shopify/theme'
18+
import StoreCommands from '@shopify/store'
1819
import {COMMANDS as HydrogenCommands, HOOKS as HydrogenHooks} from '@shopify/cli-hydrogen'
1920
import {commands as AppCommands} from '@shopify/app'
2021
import {commands as PluginCommandsCommands} from '@oclif/plugin-commands'
@@ -98,6 +99,12 @@ themeCommands.forEach((command) => {
9899
;(ThemeCommands[command] as any).customPluginName = '@shopify/theme'
99100
})
100101

102+
const storeCommands = Object.keys(StoreCommands) as (keyof typeof StoreCommands)[]
103+
storeCommands.forEach((command) => {
104+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
105+
;(StoreCommands[command] as any).customPluginName = '@shopify/store'
106+
})
107+
101108
const hydrogenCommands = Object.keys(HydrogenCommands) as (keyof typeof HydrogenCommands)[]
102109
hydrogenCommands.forEach((command) => {
103110
// eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -126,6 +133,7 @@ pluginPluginsCommands.forEach((command) => {
126133
export const COMMANDS: any = {
127134
...AppCommands,
128135
...ThemeCommands,
136+
...StoreCommands,
129137
...PluginPluginsCommands,
130138
...DidYouMeanCommands,
131139
...PluginCommandsCommands,

0 commit comments

Comments
 (0)