-
Notifications
You must be signed in to change notification settings - Fork 230
[Phase 0] Deprecate --force on app deploy and app release #6993
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
alfonso-noriega
wants to merge
6
commits into
main
Choose a base branch
from
03-12-deprecate_force_flag_on_deploy_and_release
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
90db70b
[Phase 0] Deprecate --force on app deploy and app release
alfonso-noriega 71e03ac
Remove version-specific references from --force deprecation warning
alfonso-noriega b3f577a
Use 'the next major release' in --force deprecation warning
alfonso-noriega 558c4ff
Fix test names, add missing --allow-deletes test, fix Organization ty…
alfonso-noriega 6fc8229
Add missing specifications field to linkedAppContext mock
alfonso-noriega 0f7035f
Add missing specifications field to linkedAppContext mock
alfonso-noriega File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| '@shopify/app': patch | ||
| --- | ||
|
|
||
| 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| import Deploy from './deploy.js' | ||
| import {testAppLinked, testDeveloperPlatformClient, testOrganizationApp} from '../../models/app/app.test-data.js' | ||
| import {OrganizationSource} from '../../models/organization.js' | ||
| import {describe, expect, test, vi, beforeEach} from 'vitest' | ||
| import {renderWarning} from '@shopify/cli-kit/node/ui' | ||
|
|
||
| vi.mock('../../services/deploy.js') | ||
| vi.mock('../../services/app-context.js') | ||
| vi.mock('../../metadata.js', () => ({default: {addPublicMetadata: vi.fn()}})) | ||
| vi.mock('@shopify/cli-kit/node/metadata', () => ({addPublicMetadata: vi.fn()})) | ||
| vi.mock('../../validations/version-name.js', () => ({validateVersion: vi.fn()})) | ||
| vi.mock('../../validations/message.js', () => ({validateMessage: vi.fn()})) | ||
| vi.mock('@shopify/cli-kit/node/ui', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('@shopify/cli-kit/node/ui')>() | ||
| return {...actual, renderWarning: vi.fn()} | ||
| }) | ||
|
|
||
| describe('app deploy --force deprecation warning', () => { | ||
| beforeEach(async () => { | ||
| const {linkedAppContext} = await import('../../services/app-context.js') | ||
| const {deploy} = await import('../../services/deploy.js') | ||
| vi.mocked(linkedAppContext).mockResolvedValue({ | ||
| app: testAppLinked(), | ||
| remoteApp: testOrganizationApp(), | ||
| developerPlatformClient: testDeveloperPlatformClient(), | ||
| organization: { | ||
| id: '1', | ||
| businessName: 'test', | ||
| source: OrganizationSource.Partners, | ||
| }, | ||
| specifications: [], | ||
| }) | ||
| vi.mocked(deploy).mockResolvedValue({app: testAppLinked()}) | ||
| }) | ||
|
|
||
| test('shows deprecation warning when --force is passed', async () => { | ||
| await Deploy.run(['--force']) | ||
|
|
||
| expect(renderWarning).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| headline: expect.arrayContaining(['The']), | ||
| body: expect.arrayContaining(['Use']), | ||
| }), | ||
| ) | ||
| const call = vi.mocked(renderWarning).mock.calls[0]![0] | ||
| expect(JSON.stringify(call)).toContain('--force') | ||
| expect(JSON.stringify(call)).toContain('next major release') | ||
| }) | ||
|
|
||
| test('shows deprecation warning when SHOPIFY_FLAG_FORCE env var is set', async () => { | ||
| vi.stubEnv('SHOPIFY_FLAG_FORCE', '1') | ||
|
|
||
| await Deploy.run([]) | ||
|
|
||
| expect(renderWarning).toHaveBeenCalled() | ||
| const call = vi.mocked(renderWarning).mock.calls[0]![0] | ||
| expect(JSON.stringify(call)).toContain('--force') | ||
|
|
||
| vi.unstubAllEnvs() | ||
| }) | ||
|
|
||
| test('does not show deprecation warning when only --allow-updates is passed', async () => { | ||
| await Deploy.run(['--allow-updates']) | ||
|
|
||
| expect(renderWarning).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| test('does not show deprecation warning when --allow-updates and --allow-deletes are passed', async () => { | ||
| await Deploy.run(['--allow-updates', '--allow-deletes']) | ||
|
|
||
| expect(renderWarning).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| test('does not show deprecation warning when only --allow-deletes is passed', async () => { | ||
| await Deploy.run(['--allow-deletes']) | ||
|
|
||
| expect(renderWarning).not.toHaveBeenCalled() | ||
| }) | ||
| }) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,73 @@ | ||
| import Release from './release.js' | ||
| import {testAppLinked, testDeveloperPlatformClient, testOrganizationApp} from '../../models/app/app.test-data.js' | ||
| import {OrganizationSource} from '../../models/organization.js' | ||
| import {describe, expect, test, vi, beforeEach} from 'vitest' | ||
| import {renderWarning} from '@shopify/cli-kit/node/ui' | ||
|
|
||
| vi.mock('../../services/release.js') | ||
| vi.mock('../../services/app-context.js') | ||
| vi.mock('@shopify/cli-kit/node/metadata', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('@shopify/cli-kit/node/metadata')>() | ||
| return {...actual, addPublicMetadata: vi.fn()} | ||
| }) | ||
| vi.mock('@shopify/cli-kit/node/ui', async (importOriginal) => { | ||
| const actual = await importOriginal<typeof import('@shopify/cli-kit/node/ui')>() | ||
| return {...actual, renderWarning: vi.fn()} | ||
| }) | ||
|
|
||
| describe('app release --force deprecation warning', () => { | ||
| beforeEach(async () => { | ||
| const {linkedAppContext} = await import('../../services/app-context.js') | ||
| const {release} = await import('../../services/release.js') | ||
| vi.mocked(linkedAppContext).mockResolvedValue({ | ||
| app: testAppLinked(), | ||
| remoteApp: testOrganizationApp(), | ||
| developerPlatformClient: testDeveloperPlatformClient(), | ||
| organization: { | ||
| id: '1', | ||
| businessName: 'test', | ||
| source: OrganizationSource.Partners, | ||
| }, | ||
| specifications: [], | ||
| }) | ||
| vi.mocked(release).mockResolvedValue(undefined) | ||
| }) | ||
|
|
||
| test('shows deprecation warning when --force is passed', async () => { | ||
| await Release.run(['--version', 'v1.0.0', '--force']) | ||
|
|
||
| expect(renderWarning).toHaveBeenCalledWith( | ||
| expect.objectContaining({ | ||
| headline: expect.arrayContaining(['The']), | ||
| body: expect.arrayContaining(['Use']), | ||
| }), | ||
| ) | ||
| const call = vi.mocked(renderWarning).mock.calls[0]![0] | ||
| expect(JSON.stringify(call)).toContain('--force') | ||
| expect(JSON.stringify(call)).toContain('next major release') | ||
| }) | ||
|
|
||
| test('shows deprecation warning when SHOPIFY_FLAG_FORCE env var is set', async () => { | ||
| vi.stubEnv('SHOPIFY_FLAG_FORCE', '1') | ||
|
|
||
| await Release.run(['--version', 'v1.0.0']) | ||
|
|
||
| expect(renderWarning).toHaveBeenCalled() | ||
| const call = vi.mocked(renderWarning).mock.calls[0]![0] | ||
| expect(JSON.stringify(call)).toContain('--force') | ||
|
|
||
| vi.unstubAllEnvs() | ||
| }) | ||
|
|
||
| test('does not show deprecation warning when only --allow-updates is passed', async () => { | ||
| await Release.run(['--version', 'v1.0.0', '--allow-updates']) | ||
|
|
||
| expect(renderWarning).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| test('does not show deprecation warning when --allow-updates and --allow-deletes are passed', async () => { | ||
| await Release.run(['--version', 'v1.0.0', '--allow-updates', '--allow-deletes']) | ||
|
|
||
| expect(renderWarning).not.toHaveBeenCalled() | ||
| }) | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.