Skip to content

Commit b023d52

Browse files
Merge pull request #6065 from Shopify/fix-flag-case
change camelCase flag names to kebab-case
2 parents d4a5376 + 797a9d3 commit b023d52

File tree

5 files changed

+27
-27
lines changed

5 files changed

+27
-27
lines changed

packages/cli/oclif.manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4880,21 +4880,21 @@
48804880
"customPluginName": "@shopify/store",
48814881
"description": "Copy data between stores, export store data to SQLite, or import data from SQLite to a store",
48824882
"flags": {
4883-
"fromFile": {
4883+
"from-file": {
48844884
"description": "The SQLite file to import data from.",
48854885
"env": "SHOPIFY_FLAG_FROM_FILE",
48864886
"hasDynamicHelp": false,
48874887
"multiple": false,
4888-
"name": "fromFile",
4888+
"name": "from-file",
48894889
"required": false,
48904890
"type": "option"
48914891
},
4892-
"fromStore": {
4892+
"from-store": {
48934893
"description": "The source store domain to copy/export data from (e.g., source.myshopify.com).",
48944894
"env": "SHOPIFY_FLAG_FROM_STORE",
48954895
"hasDynamicHelp": false,
48964896
"multiple": false,
4897-
"name": "fromStore",
4897+
"name": "from-store",
48984898
"required": false,
48994899
"type": "option"
49004900
},
@@ -4937,21 +4937,21 @@
49374937
"required": false,
49384938
"type": "boolean"
49394939
},
4940-
"toFile": {
4940+
"to-file": {
49414941
"description": "The SQLite file path to export data to. Omit to auto-generate filename.",
49424942
"env": "SHOPIFY_FLAG_TO_FILE",
49434943
"hasDynamicHelp": false,
49444944
"multiple": false,
4945-
"name": "toFile",
4945+
"name": "to-file",
49464946
"required": false,
49474947
"type": "option"
49484948
},
4949-
"toStore": {
4949+
"to-store": {
49504950
"description": "The target store domain to copy/import data to (e.g., target.myshopify.com).",
49514951
"env": "SHOPIFY_FLAG_TO_STORE",
49524952
"hasDynamicHelp": false,
49534953
"multiple": false,
4954-
"name": "toStore",
4954+
"name": "to-store",
49554955
"required": false,
49564956
"type": "option"
49574957
},

packages/features/steps/store.steps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ When(
7373
{timeout: 60 * 1000},
7474
async function (source: string, destination: string) {
7575
try {
76-
const args = ['store', 'copy', '--fromStore', source, '--toStore', destination, '--mock', '--no-prompt']
76+
const args = ['store', 'copy', '--from-store', source, '--to-store', destination, '--mock', '--no-prompt']
7777
const result = await this.execCLI(args)
7878
const context = storeContext
7979
context.operationResult = result

packages/store/src/commands/store/copy.test.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,24 +108,24 @@ describe('Copy', () => {
108108
}
109109

110110
test('should instantiate StoreCopyOperation for store-to-store copy', async () => {
111-
await run(['--fromStore=source.myshopify.com', '--toStore=target.myshopify.com'])
111+
await run(['--from-store=source.myshopify.com', '--to-store=target.myshopify.com'])
112112

113113
expect(StoreCopyOperation).toHaveBeenCalledTimes(1)
114114
expect(mockExecute).toHaveBeenCalledWith('source.myshopify.com', 'target.myshopify.com', expect.any(Object))
115115
})
116116

117117
test('should instantiate StoreExportOperation for store-to-file export', async () => {
118-
await run(['--fromStore=source.myshopify.com', '--toFile=output.sqlite'])
118+
await run(['--from-store=source.myshopify.com', '--to-file=output.sqlite'])
119119

120120
expect(StoreExportOperation).toHaveBeenCalledTimes(1)
121121
expect(mockExecute).toHaveBeenCalledWith('source.myshopify.com', 'output.sqlite', expect.any(Object))
122122
})
123123

124-
test('should auto-generate toFile path when exporting without toFile parameter', async () => {
124+
test('should auto-generate to-file path when exporting without to-file parameter', async () => {
125125
const mockDate = new Date('2024-01-01T12:00:00Z')
126126
vi.spyOn(Date, 'now').mockReturnValue(mockDate.getTime())
127127

128-
await run(['--fromStore=source.myshopify.com'])
128+
await run(['--from-store=source.myshopify.com'])
129129

130130
expect(StoreExportOperation).toHaveBeenCalledTimes(1)
131131
expect(mockExecute).toHaveBeenCalledWith(
@@ -135,11 +135,11 @@ describe('Copy', () => {
135135
)
136136
})
137137

138-
test('should sanitize domain name when auto-generating toFile path', async () => {
138+
test('should sanitize domain name when auto-generating to-file path', async () => {
139139
const mockDate = new Date('2024-01-01T12:00:00Z')
140140
vi.spyOn(Date, 'now').mockReturnValue(mockDate.getTime())
141141

142-
await run(['--fromStore=test@store!.myshopify.com'])
142+
await run(['--from-store=test@store!.myshopify.com'])
143143

144144
expect(StoreExportOperation).toHaveBeenCalledTimes(1)
145145
expect(mockExecute).toHaveBeenCalledWith(
@@ -150,14 +150,14 @@ describe('Copy', () => {
150150
})
151151

152152
test('should instantiate StoreImportOperation for file-to-store import', async () => {
153-
await run(['--fromFile=input.sqlite', '--toStore=target.myshopify.com'])
153+
await run(['--from-file=input.sqlite', '--to-store=target.myshopify.com'])
154154

155155
expect(StoreImportOperation).toHaveBeenCalledTimes(1)
156156
expect(mockExecute).toHaveBeenCalledWith('input.sqlite', 'target.myshopify.com', expect.any(Object))
157157
})
158158

159-
test('should auto-generate toFile for export when only fromStore is provided', async () => {
160-
await run(['--fromStore=source.myshopify.com'])
159+
test('should auto-generate to-file for export when only from-store is provided', async () => {
160+
await run(['--from-store=source.myshopify.com'])
161161

162162
expect(StoreExportOperation).toHaveBeenCalledTimes(1)
163163
expect(mockExecute).toHaveBeenCalledWith(
@@ -168,7 +168,7 @@ describe('Copy', () => {
168168
})
169169

170170
test('should show help when invalid flag combination', async () => {
171-
await run(['--toFile=output.sqlite'])
171+
await run(['--to-file=output.sqlite'])
172172

173173
expect(loadHelpClass).toHaveBeenCalledWith(expect.any(Object))
174174
expect(mockShowHelp).toHaveBeenCalledWith(['store:copy'])
@@ -188,7 +188,7 @@ describe('Copy', () => {
188188
})
189189

190190
test('should show help when mixing store and file flags', async () => {
191-
await run(['--fromStore=source.myshopify.com', '--fromFile=input.sqlite', '--toStore=target.myshopify.com'])
191+
await run(['--from-store=source.myshopify.com', '--from-file=input.sqlite', '--to-store=target.myshopify.com'])
192192

193193
expect(loadHelpClass).toHaveBeenCalledWith(expect.any(Object))
194194
expect(mockShowHelp).toHaveBeenCalledWith(['store:copy'])
@@ -198,7 +198,7 @@ describe('Copy', () => {
198198
})
199199

200200
test('should pass flags to the operation', async () => {
201-
await run(['--fromStore=source.myshopify.com', '--toStore=target.myshopify.com', '--no-prompt', '--mock'])
201+
await run(['--from-store=source.myshopify.com', '--to-store=target.myshopify.com', '--no-prompt', '--mock'])
202202

203203
expect(mockExecute).toHaveBeenCalledWith(
204204
'source.myshopify.com',

packages/store/src/commands/store/copy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ export default class Copy extends BaseBDCommand {
3232
const bpSession = await apiClient.ensureAuthenticatedBusinessPlatform()
3333
const allOrgs = await apiClient.fetchOrganizations(bpSession)
3434

35-
const {fromStore, toStore, fromFile, _} = this.flags
36-
let {toFile} = this.flags
35+
const {'from-store': fromStore, 'to-store': toStore, 'from-file': fromFile} = this.flags
36+
let {'to-file': toFile} = this.flags
3737
const operationMode = this.determineOperationMode(fromStore, toStore, fromFile, toFile)
3838

3939
if (!operationMode) {

packages/store/src/lib/flags.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
11
import {Flags} from '@oclif/core'
22

33
export const storeFlags = {
4-
fromStore: Flags.string({
4+
'from-store': Flags.string({
55
description: 'The source store domain to copy/export data from (e.g., source.myshopify.com).',
66
required: false,
77
env: 'SHOPIFY_FLAG_FROM_STORE',
88
}),
9-
toStore: Flags.string({
9+
'to-store': Flags.string({
1010
description: 'The target store domain to copy/import data to (e.g., target.myshopify.com).',
1111
required: false,
1212
env: 'SHOPIFY_FLAG_TO_STORE',
1313
}),
1414
}
1515

1616
export const fileFlags = {
17-
fromFile: Flags.string({
17+
'from-file': Flags.string({
1818
description: 'The SQLite file to import data from.',
1919
required: false,
2020
env: 'SHOPIFY_FLAG_FROM_FILE',
2121
}),
22-
toFile: Flags.string({
22+
'to-file': Flags.string({
2323
description: 'The SQLite file path to export data to. Omit to auto-generate filename.',
2424
required: false,
2525
env: 'SHOPIFY_FLAG_TO_FILE',

0 commit comments

Comments
 (0)