Skip to content

Commit bca8766

Browse files
Merge remote-tracking branch 'origin/main' into 03-10-create_abstract_client_steps_infrastracture_to_externalize_the_ap_modules_client_configurations
2 parents 51493a2 + aae6d16 commit bca8766

10 files changed

Lines changed: 206 additions & 16 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@shopify/app': patch
3+
---
4+
5+
Deprecation warning for `--force` flag on `app deploy` and `app release`. The flag will be removed in the next major release. Use `--allow-updates` for CI/CD environments, or `--allow-updates --allow-deletes` if you also want to allow removals. The `SHOPIFY_FLAG_FORCE` environment variable is also deprecated.

docs-shopify.dev/commands/interfaces/app-deploy.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface appdeploy {
2525
'-c, --config <value>'?: string
2626

2727
/**
28-
* Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.
28+
* [Deprecated] Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.
2929
* @environment SHOPIFY_FLAG_FORCE
3030
*/
3131
'-f, --force'?: ''

docs-shopify.dev/commands/interfaces/app-release.interface.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export interface apprelease {
2525
'-c, --config <value>'?: string
2626

2727
/**
28-
* Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.
28+
* [Deprecated] Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.
2929
* @environment SHOPIFY_FLAG_FORCE
3030
*/
3131
'-f, --force'?: ''

docs-shopify.dev/generated/generated_docs_data.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -901,12 +901,12 @@
901901
"syntaxKind": "PropertySignature",
902902
"name": "-f, --force",
903903
"value": "\"\"",
904-
"description": "Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.",
904+
"description": "[Deprecated] Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.",
905905
"isOptional": true,
906906
"environmentValue": "SHOPIFY_FLAG_FORCE"
907907
}
908908
],
909-
"value": "export interface appdeploy {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Optional message that will be associated with this version. This is for internal use only and won't be available externally.\n * @environment SHOPIFY_FLAG_MESSAGE\n */\n '--message <value>'?: string\n\n /**\n * Use with caution: Skips building any elements of the app that require building. You should ensure your app has been prepared in advance, such as by running `shopify app build` or by caching build artifacts.\n * @environment SHOPIFY_FLAG_NO_BUILD\n */\n '--no-build'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.\n * @environment SHOPIFY_FLAG_NO_RELEASE\n */\n '--no-release'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * URL associated with the new app version.\n * @environment SHOPIFY_FLAG_SOURCE_CONTROL_URL\n */\n '--source-control-url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * Optional version tag that will be associated with this app version. If not provided, an auto-generated identifier will be generated for this app version.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>'?: string\n}"
909+
"value": "export interface appdeploy {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * [Deprecated] Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Optional message that will be associated with this version. This is for internal use only and won't be available externally.\n * @environment SHOPIFY_FLAG_MESSAGE\n */\n '--message <value>'?: string\n\n /**\n * Use with caution: Skips building any elements of the app that require building. You should ensure your app has been prepared in advance, such as by running `shopify app build` or by caching build artifacts.\n * @environment SHOPIFY_FLAG_NO_BUILD\n */\n '--no-build'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * Creates a version but doesn't release it - it's not made available to merchants. With this flag, a user confirmation is not required.\n * @environment SHOPIFY_FLAG_NO_RELEASE\n */\n '--no-release'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * URL associated with the new app version.\n * @environment SHOPIFY_FLAG_SOURCE_CONTROL_URL\n */\n '--source-control-url <value>'?: string\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * Optional version tag that will be associated with this app version. If not provided, an auto-generated identifier will be generated for this app version.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>'?: string\n}"
910910
}
911911
}
912912
}
@@ -3071,12 +3071,12 @@
30713071
"syntaxKind": "PropertySignature",
30723072
"name": "-f, --force",
30733073
"value": "\"\"",
3074-
"description": "Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.",
3074+
"description": "[Deprecated] Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.",
30753075
"isOptional": true,
30763076
"environmentValue": "SHOPIFY_FLAG_FORCE"
30773077
}
30783078
],
3079-
"value": "export interface apprelease {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * The name of the app version to release.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>': string\n}"
3079+
"value": "export interface apprelease {\n /**\n * Allows removing extensions and configuration without requiring user confirmation. For CI/CD environments, the recommended flag is --allow-updates.\n * @environment SHOPIFY_FLAG_ALLOW_DELETES\n */\n '--allow-deletes'?: ''\n\n /**\n * Allows adding and updating extensions and configuration without requiring user confirmation. Recommended option for CI/CD environments.\n * @environment SHOPIFY_FLAG_ALLOW_UPDATES\n */\n '--allow-updates'?: ''\n\n /**\n * The Client ID of your app.\n * @environment SHOPIFY_FLAG_CLIENT_ID\n */\n '--client-id <value>'?: string\n\n /**\n * The name of the app configuration.\n * @environment SHOPIFY_FLAG_APP_CONFIG\n */\n '-c, --config <value>'?: string\n\n /**\n * [Deprecated] Release without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.\n * @environment SHOPIFY_FLAG_FORCE\n */\n '-f, --force'?: ''\n\n /**\n * Disable color output.\n * @environment SHOPIFY_FLAG_NO_COLOR\n */\n '--no-color'?: ''\n\n /**\n * The path to your app directory.\n * @environment SHOPIFY_FLAG_PATH\n */\n '--path <value>'?: string\n\n /**\n * Reset all your settings.\n * @environment SHOPIFY_FLAG_RESET\n */\n '--reset'?: ''\n\n /**\n * Increase the verbosity of the output.\n * @environment SHOPIFY_FLAG_VERBOSE\n */\n '--verbose'?: ''\n\n /**\n * The name of the app version to release.\n * @environment SHOPIFY_FLAG_VERSION\n */\n '--version <value>': string\n}"
30803080
}
30813081
}
30823082
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import Deploy from './deploy.js'
2+
import {testAppLinked, testDeveloperPlatformClient, testOrganizationApp} from '../../models/app/app.test-data.js'
3+
import {OrganizationSource} from '../../models/organization.js'
4+
import {describe, expect, test, vi, beforeEach} from 'vitest'
5+
import {renderWarning} from '@shopify/cli-kit/node/ui'
6+
7+
vi.mock('../../services/deploy.js')
8+
vi.mock('../../services/app-context.js')
9+
vi.mock('../../metadata.js', () => ({default: {addPublicMetadata: vi.fn()}}))
10+
vi.mock('@shopify/cli-kit/node/metadata', () => ({addPublicMetadata: vi.fn()}))
11+
vi.mock('../../validations/version-name.js', () => ({validateVersion: vi.fn()}))
12+
vi.mock('../../validations/message.js', () => ({validateMessage: vi.fn()}))
13+
vi.mock('@shopify/cli-kit/node/ui', async (importOriginal) => {
14+
const actual = await importOriginal<typeof import('@shopify/cli-kit/node/ui')>()
15+
return {...actual, renderWarning: vi.fn()}
16+
})
17+
18+
describe('app deploy --force deprecation warning', () => {
19+
beforeEach(async () => {
20+
const {linkedAppContext} = await import('../../services/app-context.js')
21+
const {deploy} = await import('../../services/deploy.js')
22+
vi.mocked(linkedAppContext).mockResolvedValue({
23+
app: testAppLinked(),
24+
remoteApp: testOrganizationApp(),
25+
developerPlatformClient: testDeveloperPlatformClient(),
26+
organization: {
27+
id: '1',
28+
businessName: 'test',
29+
source: OrganizationSource.Partners,
30+
},
31+
specifications: [],
32+
})
33+
vi.mocked(deploy).mockResolvedValue({app: testAppLinked()})
34+
})
35+
36+
test('shows deprecation warning when --force is passed', async () => {
37+
await Deploy.run(['--force'])
38+
39+
expect(renderWarning).toHaveBeenCalledWith(
40+
expect.objectContaining({
41+
headline: expect.arrayContaining(['The']),
42+
body: expect.arrayContaining(['Use']),
43+
}),
44+
)
45+
const call = vi.mocked(renderWarning).mock.calls[0]![0]
46+
expect(JSON.stringify(call)).toContain('--force')
47+
expect(JSON.stringify(call)).toContain('next major release')
48+
})
49+
50+
test('shows deprecation warning when SHOPIFY_FLAG_FORCE env var is set', async () => {
51+
vi.stubEnv('SHOPIFY_FLAG_FORCE', '1')
52+
53+
await Deploy.run([])
54+
55+
expect(renderWarning).toHaveBeenCalled()
56+
const call = vi.mocked(renderWarning).mock.calls[0]![0]
57+
expect(JSON.stringify(call)).toContain('--force')
58+
59+
vi.unstubAllEnvs()
60+
})
61+
62+
test('does not show deprecation warning when only --allow-updates is passed', async () => {
63+
await Deploy.run(['--allow-updates'])
64+
65+
expect(renderWarning).not.toHaveBeenCalled()
66+
})
67+
68+
test('does not show deprecation warning when --allow-updates and --allow-deletes are passed', async () => {
69+
await Deploy.run(['--allow-updates', '--allow-deletes'])
70+
71+
expect(renderWarning).not.toHaveBeenCalled()
72+
})
73+
74+
test('does not show deprecation warning when only --allow-deletes is passed', async () => {
75+
await Deploy.run(['--allow-deletes'])
76+
77+
expect(renderWarning).not.toHaveBeenCalled()
78+
})
79+
})

packages/app/src/cli/commands/app/deploy.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {linkedAppContext} from '../../services/app-context.js'
88
import {Flags} from '@oclif/core'
99
import {globalFlags} from '@shopify/cli-kit/node/cli'
1010
import {addPublicMetadata} from '@shopify/cli-kit/node/metadata'
11+
import {renderWarning} from '@shopify/cli-kit/node/ui'
1112

1213
export default class Deploy extends AppLinkedCommand {
1314
static summary = 'Deploy your Shopify app.'
@@ -27,7 +28,7 @@ export default class Deploy extends AppLinkedCommand {
2728
force: Flags.boolean({
2829
hidden: false,
2930
description:
30-
'Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. For CI/CD environments, the recommended flag is --allow-updates.',
31+
'[Deprecated] Deploy without asking for confirmation. Equivalent to --allow-updates --allow-deletes. Use --allow-updates for CI/CD environments instead.',
3132
env: 'SHOPIFY_FLAG_FORCE',
3233
char: 'f',
3334
}),
@@ -79,6 +80,19 @@ export default class Deploy extends AppLinkedCommand {
7980
async run(): Promise<AppLinkedCommandOutput> {
8081
const {flags} = await this.parse(Deploy)
8182

83+
if (flags.force) {
84+
renderWarning({
85+
headline: ['The', {command: '--force'}, 'flag is deprecated and will be removed in the next major release.'],
86+
body: [
87+
'Use',
88+
{command: '--allow-updates'},
89+
'for CI/CD environments, or',
90+
{command: '--allow-updates --allow-deletes'},
91+
'if you also want to allow removals.',
92+
],
93+
})
94+
}
95+
8296
await metadata.addPublicMetadata(() => ({
8397
cmd_deploy_flag_message_used: Boolean(flags.message),
8498
cmd_deploy_flag_version_used: Boolean(flags.version),
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import Release from './release.js'
2+
import {testAppLinked, testDeveloperPlatformClient, testOrganizationApp} from '../../models/app/app.test-data.js'
3+
import {OrganizationSource} from '../../models/organization.js'
4+
import {describe, expect, test, vi, beforeEach} from 'vitest'
5+
import {renderWarning} from '@shopify/cli-kit/node/ui'
6+
7+
vi.mock('../../services/release.js')
8+
vi.mock('../../services/app-context.js')
9+
vi.mock('@shopify/cli-kit/node/metadata', async (importOriginal) => {
10+
const actual = await importOriginal<typeof import('@shopify/cli-kit/node/metadata')>()
11+
return {...actual, addPublicMetadata: vi.fn()}
12+
})
13+
vi.mock('@shopify/cli-kit/node/ui', async (importOriginal) => {
14+
const actual = await importOriginal<typeof import('@shopify/cli-kit/node/ui')>()
15+
return {...actual, renderWarning: vi.fn()}
16+
})
17+
18+
describe('app release --force deprecation warning', () => {
19+
beforeEach(async () => {
20+
const {linkedAppContext} = await import('../../services/app-context.js')
21+
const {release} = await import('../../services/release.js')
22+
vi.mocked(linkedAppContext).mockResolvedValue({
23+
app: testAppLinked(),
24+
remoteApp: testOrganizationApp(),
25+
developerPlatformClient: testDeveloperPlatformClient(),
26+
organization: {
27+
id: '1',
28+
businessName: 'test',
29+
source: OrganizationSource.Partners,
30+
},
31+
specifications: [],
32+
})
33+
vi.mocked(release).mockResolvedValue(undefined)
34+
})
35+
36+
test('shows deprecation warning when --force is passed', async () => {
37+
await Release.run(['--version', 'v1.0.0', '--force'])
38+
39+
expect(renderWarning).toHaveBeenCalledWith(
40+
expect.objectContaining({
41+
headline: expect.arrayContaining(['The']),
42+
body: expect.arrayContaining(['Use']),
43+
}),
44+
)
45+
const call = vi.mocked(renderWarning).mock.calls[0]![0]
46+
expect(JSON.stringify(call)).toContain('--force')
47+
expect(JSON.stringify(call)).toContain('next major release')
48+
})
49+
50+
test('shows deprecation warning when SHOPIFY_FLAG_FORCE env var is set', async () => {
51+
vi.stubEnv('SHOPIFY_FLAG_FORCE', '1')
52+
53+
await Release.run(['--version', 'v1.0.0'])
54+
55+
expect(renderWarning).toHaveBeenCalled()
56+
const call = vi.mocked(renderWarning).mock.calls[0]![0]
57+
expect(JSON.stringify(call)).toContain('--force')
58+
59+
vi.unstubAllEnvs()
60+
})
61+
62+
test('does not show deprecation warning when only --allow-updates is passed', async () => {
63+
await Release.run(['--version', 'v1.0.0', '--allow-updates'])
64+
65+
expect(renderWarning).not.toHaveBeenCalled()
66+
})
67+
68+
test('does not show deprecation warning when --allow-updates and --allow-deletes are passed', async () => {
69+
await Release.run(['--version', 'v1.0.0', '--allow-updates', '--allow-deletes'])
70+
71+
expect(renderWarning).not.toHaveBeenCalled()
72+
})
73+
74+
test('does not show deprecation warning when only --allow-deletes is passed', async () => {
75+
await Release.run(['--version', 'v1.0.0', '--allow-deletes'])
76+
77+
expect(renderWarning).not.toHaveBeenCalled()
78+
})
79+
})

0 commit comments

Comments
 (0)