Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/keep-config-in-dev-previews.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@shopify/app': minor
---

Keep app configuration in `app dev` previews after extension changes when the TOML still has the deprecated `include_config_on_deploy = false`
4 changes: 2 additions & 2 deletions packages/app/src/cli/models/app/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ describe('allExtensions', () => {
expect(app.allExtensions).toContain(configExtension)
})

test('does not include configuration extensions when include_config_on_deploy is disabled', async () => {
test('includes configuration extensions when the deprecated include_config_on_deploy is disabled', async () => {
const configuration = {
...CORRECT_CURRENT_APP_SCHEMA,
build: {
Expand All @@ -636,7 +636,7 @@ describe('allExtensions', () => {
allExtensions: [configExtension],
})

expect(app.allExtensions).toHaveLength(0)
expect(app.allExtensions).toContain(configExtension)
})
})

Expand Down
6 changes: 0 additions & 6 deletions packages/app/src/cli/models/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ export interface AppInterface<
nonConfigExtensions: ExtensionInstance[]
errors: AppErrors
hiddenConfig: AppHiddenConfig
includeConfigOnDeploy: boolean | undefined
readonly devApplicationURLs?: ApplicationURLs
extensionsForType: (spec: {identifier: string; externalIdentifier: string}) => ExtensionInstance[]
updateExtensionUUIDS: (uuids: {[key: string]: string}) => void
Expand Down Expand Up @@ -324,7 +323,6 @@ export class App<
}

get allExtensions() {
if (this.includeConfigOnDeploy === false) return this.nonConfigExtensions
return this.realExtensions
}

Expand Down Expand Up @@ -470,10 +468,6 @@ export class App<
})
}

get includeConfigOnDeploy() {
return this.configuration.build?.include_config_on_deploy
}

private patchAppConfiguration(devApplicationURLs: ApplicationURLs) {
this.devApplicationURLs = devApplicationURLs
this.configuration.application_url = devApplicationURLs.applicationUrl
Expand Down
16 changes: 0 additions & 16 deletions packages/app/src/cli/models/app/loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2692,22 +2692,6 @@ Learn more: https://shopify.dev/docs/apps/build/authentication-authorization/app
await expect(app.preDeployValidation()).resolves.toBeUndefined()
})

test('does not validate Events subscriptions excluded from deployment', async () => {
await writeConfig(
buildAppConfiguration({
build: {include_config_on_deploy: false},
extra: `[access_scopes]\nuse_legacy_install_flow = true\n${eventsConfiguration}`,
}),
)

const app = await loadTestingApp()

expect(app.errors.getErrors()).toEqual([])
expect(app.realExtensions.filter((extension) => extension.type === 'events')).toHaveLength(2)
expect(app.allExtensions).toEqual([])
await expect(app.preDeployValidation()).resolves.toBeUndefined()
})

test('creates no events modules for an empty subscription list', async () => {
await writeConfig(buildAppConfiguration({extra: '[events]\napi_version = "2024-01"\nsubscription = []'}))

Expand Down
43 changes: 0 additions & 43 deletions packages/app/src/cli/services/deploy.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -470,49 +470,6 @@ describe('deploy', () => {
expect(bundleAndBuildExtensions).toHaveBeenCalledOnce()
})

test('doesnt push the configuration extension if include config on deploy is disabled', async () => {
// Given
const extensionNonUuidManaged = await testAppConfigExtensions()
const localApp = {
allExtensions: [extensionNonUuidManaged],
configuration: {...DEFAULT_CONFIG, build: {include_config_on_deploy: false}},
}
const app = testAppLinked(localApp)
const commitReference = 'https://github.com/deploytest/repo/commit/d4e5ce7999242b200acde378654d62c14b211bcc'

// When
await testDeployBundle({app, remoteApp, released: false, commitReference, developerPlatformClient})

// Then
expect(uploadExtensionsBundle).toHaveBeenCalledWith({
appManifest: {
name: 'App',
handle: '',
modules: [
{
type: 'point_of_sale_external',
handle: 'point_of_sale',
uid: 'point_of_sale',
uuid: undefined,
assets: 'point_of_sale',
target: '',
config: expect.any(Object),
},
],
},
appId: 'app-id',
apiKey: 'api-key',
name: app.name,
organizationId: 'org-id',
appModules: [],
developerPlatformClient,
appModuleRegistrationIds: {},
release: true,
commitReference,
})
expect(bundleAndBuildExtensions).toHaveBeenCalledOnce()
})

test('returns deployment data without a completion banner', async () => {
await inTemporaryDirectory(async (directory) => {
const app = testAppLinked({directory, allExtensions: []})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {DeveloperPlatformClient} from '../../../../utilities/developer-platform-
import {AppLinkedInterface} from '../../../../models/app/app.js'
import {AppEventWatcher} from '../../app-events/app-event-watcher.js'
import {
DEFAULT_CONFIG,
testAppAccessConfigExtension,
testAppLinked,
testDeveloperPlatformClient,
Expand Down Expand Up @@ -512,6 +513,30 @@ describe('pushUpdatesForDevSession', () => {
})
})

test('inherits app configuration modules on an extension-only update when include_config_on_deploy is false', async () => {
vi.mocked(readdir).mockResolvedValue([])
const updatedExtension = await testUIExtension()
updatedExtension.deployConfig = vi.fn().mockResolvedValue({})
const appAccess = await testAppAccessConfigExtension()
const appWithDeprecatedFlag = testAppLinked({
configuration: {...DEFAULT_CONFIG, build: {include_config_on_deploy: false}},
allExtensions: [updatedExtension, appAccess],
})

await pushUpdatesForDevSession({stderr, stdout, abortSignal: abortController.signal}, options)
await appWatcher.start({stdout, stderr, signal: abortController.signal})
await flushPromises()
appWatcher.emit('all', {
app: appWithDeprecatedFlag,
extensionEvents: [{type: 'updated', extension: updatedExtension}],
})
await flushPromises()

expect(developerPlatformClient.devSessionUpdate).toHaveBeenCalledWith(
expect.objectContaining({inheritedModuleUids: [appAccess.uid]}),
)
})

test('writes full manifest to bundle on session update, not just create', async () => {
// Given
vi.mocked(readdir).mockResolvedValue([])
Expand Down
Loading