Skip to content

Commit 84a7b10

Browse files
committed
Remove deprecated positional arguments from theme delete command
Previously, `theme delete` command could accept theme as a positional argument. This behaviour has been deprecated since the transition to flags three years ago. The use of positional arguments and the deprecation warning are now being removed.
1 parent 455946c commit 84a7b10

File tree

4 files changed

+10
-46
lines changed

4 files changed

+10
-46
lines changed

.changeset/early-cobras-worry.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/theme': minor
3+
---
4+
5+
Remove deprecated positional arguments from theme delete command

packages/theme/src/cli/commands/theme/delete.ts

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {ensureThemeStore} from '../../utilities/theme-store.js'
22
import ThemeCommand from '../../utilities/theme-command.js'
33
import {themeFlags} from '../../flags.js'
4-
import {themesDelete, renderDeprecatedArgsWarning} from '../../services/delete.js'
4+
import {themesDelete} from '../../services/delete.js'
55
import {Flags} from '@oclif/core'
66
import {globalFlags} from '@shopify/cli-kit/node/cli'
77
import {ensureAuthenticatedThemes} from '@shopify/cli-kit/node/session'
@@ -17,9 +17,6 @@ export default class Delete extends ThemeCommand {
1717

1818
static description = this.descriptionWithoutMarkdown()
1919

20-
// Accept any number of args without naming them
21-
static strict = false
22-
2320
static flags = {
2421
...globalFlags,
2522
...themeFlags,
@@ -47,18 +44,13 @@ export default class Delete extends ThemeCommand {
4744
}
4845

4946
async run(): Promise<void> {
50-
const {flags, argv} = await this.parse(Delete)
47+
const {flags} = await this.parse(Delete)
5148
const {development, force, password, theme} = flags
52-
const themes = [...argv, ...(theme ?? [])]
49+
const themes = [...(theme ?? [])]
5350

5451
const store = ensureThemeStore(flags)
5552
const adminSession = await ensureAuthenticatedThemes(store, password)
5653

57-
const hasDeprecatedArgs = argv.length > 0
58-
if (hasDeprecatedArgs) {
59-
renderDeprecatedArgsWarning(argv)
60-
}
61-
6254
await themesDelete(adminSession, {
6355
selectTheme: flags['show-all'],
6456
development,

packages/theme/src/cli/services/delete.test.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import {themesDelete, renderDeprecatedArgsWarning} from './delete.js'
1+
import {themesDelete} from './delete.js'
22
import {findOrSelectTheme, findThemes} from '../utilities/theme-selector.js'
33
import {themeDelete} from '@shopify/cli-kit/node/themes/api'
44
import {Theme} from '@shopify/cli-kit/node/themes/types'
55
import {test, describe, expect, vi} from 'vitest'
6-
import {renderConfirmationPrompt, renderSuccess, renderWarning} from '@shopify/cli-kit/node/ui'
6+
import {renderConfirmationPrompt, renderSuccess} from '@shopify/cli-kit/node/ui'
77

88
vi.mock('@shopify/cli-kit/node/ui')
99
vi.mock('@shopify/cli-kit/node/themes/api')
@@ -142,21 +142,3 @@ describe('themesDelete', () => {
142142
expect(renderSuccess).not.toBeCalled()
143143
})
144144
})
145-
146-
describe('renderDeprecatedArgsWarning', () => {
147-
test('renders the the deprecated-args warning message', async () => {
148-
// Given/When
149-
renderDeprecatedArgsWarning(['1', '2'])
150-
151-
// Then
152-
expect(renderWarning).toBeCalledWith({
153-
body: [
154-
'Positional arguments are deprecated. Use the',
155-
{command: '--theme'},
156-
'flag instead:\n\n',
157-
{command: `$ shopify theme delete --theme 1 2`},
158-
{char: '.'},
159-
],
160-
})
161-
})
162-
})

packages/theme/src/cli/services/delete.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
renderConfirmationPrompt,
99
RenderConfirmationPromptOptions,
1010
renderSuccess,
11-
renderWarning,
1211
InlineToken,
1312
LinkToken,
1413
} from '@shopify/cli-kit/node/ui'
@@ -88,17 +87,3 @@ async function isConfirmed(themes: Theme[], store: string) {
8887

8988
return renderConfirmationPrompt(options)
9089
}
91-
92-
export function renderDeprecatedArgsWarning(argv: string[]) {
93-
const ids = argv.join(' ')
94-
95-
renderWarning({
96-
body: [
97-
'Positional arguments are deprecated. Use the',
98-
{command: '--theme'},
99-
'flag instead:\n\n',
100-
{command: `$ shopify theme delete --theme ${ids}`},
101-
{char: '.'},
102-
],
103-
})
104-
}

0 commit comments

Comments
 (0)