Skip to content

Commit e617e2c

Browse files
committed
Revert hosted app project changes
This reverts all changes from the hosted app project (Admin Extensibility → 'hosted app' sub-project). The hosted app project is being discontinued. This PR removes: - The admin extension specification (static_root, allowed_domains) - The HOSTED_APPS environment variable and template switching - Web build execution during deploy - Template application_url preservation during app creation - Admin-specific dev server asset serving What's preserved: - Asset upload infrastructure (include_assets client step) - used by other extension types - admin_link specification - separate extension type for admin links with intents - Client steps system - general build pipeline infrastructure - devSessionWatchConfig - general watch path infrastructure Reverted PRs: - #7027 - Add admin hosted app local spec - #7096 - Switch app init template to hosted app when HOSTED_APPS env var is set - #7208 - Run web build commands during deploy for hosted apps - #7225 - Preserve template application_url during app creation - #7227 - notify extension dev server of app assets updates (admin parts only) - #7312 - Default allowed_domains to empty array when not configured
1 parent dd1278d commit e617e2c

25 files changed

Lines changed: 13 additions & 888 deletions

File tree

packages/app/src/cli/models/app/app.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -432,18 +432,12 @@ export class App<
432432
}
433433

434434
creationDefaultOptions(): CreateAppOptions {
435-
const applicationUrl = this.configuration.application_url
436-
const redirectUrls = this.configuration.auth?.redirect_urls
437-
const staticRoot = this.configuration.admin?.static_root
438435
return {
439436
isLaunchable: this.appIsLaunchable(),
440437
scopesArray: getAppScopesArray(this.configuration),
441438
name: this.name,
442439
isEmbedded: this.appIsEmbedded,
443440
directory: this.directory,
444-
applicationUrl,
445-
redirectUrls,
446-
staticRoot,
447441
}
448442
}
449443

packages/app/src/cli/models/app/loader.test.ts

Lines changed: 0 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -3505,79 +3505,6 @@ value = true
35053505
})
35063506
})
35073507

3508-
test('extracts application_url from template config', async () => {
3509-
await inTemporaryDirectory(async (tmpDir) => {
3510-
const config = `
3511-
client_id = ""
3512-
name = "my-app"
3513-
application_url = "https://extensions.shopifycdn.com"
3514-
embedded = true
3515-
3516-
[access_scopes]
3517-
scopes = "write_products"
3518-
3519-
[auth]
3520-
redirect_urls = ["https://shopify.dev/apps/default-app-home/api/auth"]
3521-
`
3522-
await writeFile(joinPath(tmpDir, 'shopify.app.toml'), config)
3523-
await writeFile(joinPath(tmpDir, 'package.json'), '{}')
3524-
3525-
const result = await loadConfigForAppCreation(tmpDir, 'my-app')
3526-
3527-
expect(result).toEqual({
3528-
isLaunchable: false,
3529-
scopesArray: ['write_products'],
3530-
name: 'my-app',
3531-
directory: normalizePath(tmpDir),
3532-
isEmbedded: false,
3533-
applicationUrl: 'https://extensions.shopifycdn.com',
3534-
redirectUrls: ['https://shopify.dev/apps/default-app-home/api/auth'],
3535-
staticRoot: undefined,
3536-
})
3537-
})
3538-
})
3539-
3540-
test('extracts admin.static_root from template config', async () => {
3541-
await inTemporaryDirectory(async (tmpDir) => {
3542-
const config = `
3543-
client_id = ""
3544-
name = "my-app"
3545-
application_url = "https://extensions.shopifycdn.com"
3546-
embedded = true
3547-
3548-
[admin]
3549-
static_root = "./dist"
3550-
3551-
[access_scopes]
3552-
scopes = "write_products"
3553-
`
3554-
await writeFile(joinPath(tmpDir, 'shopify.app.toml'), config)
3555-
await writeFile(joinPath(tmpDir, 'package.json'), '{}')
3556-
3557-
const result = await loadConfigForAppCreation(tmpDir, 'my-app')
3558-
3559-
expect(result.staticRoot).toBe('./dist')
3560-
})
3561-
})
3562-
3563-
test('defaults applicationUrl and redirectUrls to undefined when not in template config', async () => {
3564-
await inTemporaryDirectory(async (tmpDir) => {
3565-
const config = `
3566-
client_id = ""
3567-
name = "my-app"
3568-
3569-
[access_scopes]
3570-
scopes = "write_products"
3571-
`
3572-
await writeFile(joinPath(tmpDir, 'shopify.app.toml'), config)
3573-
await writeFile(joinPath(tmpDir, 'package.json'), '{}')
3574-
3575-
const result = await loadConfigForAppCreation(tmpDir, 'my-app')
3576-
3577-
expect(result.applicationUrl).toBeUndefined()
3578-
expect(result.redirectUrls).toBeUndefined()
3579-
})
3580-
})
35813508
})
35823509

35833510
describe('loadOpaqueApp', () => {

packages/app/src/cli/models/app/loader.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -206,10 +206,6 @@ export async function loadConfigForAppCreation(directory: string, name: string):
206206
const isLaunchable = webs.some((web) => isWebType(web, WebType.Frontend) || isWebType(web, WebType.Backend))
207207

208208
const scopesArray = getAppScopesArray(rawConfig as CurrentAppConfiguration)
209-
const appConfig = rawConfig as CurrentAppConfiguration
210-
const applicationUrl = appConfig.application_url
211-
const redirectUrls = appConfig.auth?.redirect_urls
212-
const staticRoot = appConfig.admin?.static_root
213209

214210
return {
215211
isLaunchable,
@@ -218,9 +214,6 @@ export async function loadConfigForAppCreation(directory: string, name: string):
218214
directory: project.directory,
219215
// By default, and ONLY for `app init`, we consider the app as embedded if it is launchable.
220216
isEmbedded: isLaunchable,
221-
applicationUrl,
222-
redirectUrls,
223-
staticRoot,
224217
}
225218
}
226219

packages/app/src/cli/models/extensions/extension-instance.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,8 +529,6 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi
529529
} else {
530530
return nonRandomUUID(JSON.stringify(this.configuration))
531531
}
532-
default:
533-
return this.specification.identifier
534532
}
535533
}
536534

packages/app/src/cli/models/extensions/load-specifications.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import webPixelSpec from './specifications/web_pixel_extension.js'
2828
import editorExtensionCollectionSpecification from './specifications/editor_extension_collection.js'
2929
import channelSpecificationSpec from './specifications/channel.js'
3030
import orderAttributionConfigSpec from './specifications/order_attribution_config.js'
31-
import adminSpecificationSpec from './specifications/admin.js'
3231
import adminLinkSpec from './specifications/admin_link.js'
3332

3433
const SORTED_CONFIGURATION_SPEC_IDENTIFIERS = [
@@ -64,7 +63,6 @@ function loadSpecifications() {
6463
appWebhooksSpec,
6564
appWebhookSubscriptionSpec,
6665
appEventsSpec,
67-
adminSpecificationSpec,
6866
]
6967
const moduleSpecs = [
7068
checkoutPostPurchaseSpec,

packages/app/src/cli/models/extensions/specifications/admin.ts

Lines changed: 0 additions & 68 deletions
This file was deleted.

packages/app/src/cli/prompts/init/init.test.ts

Lines changed: 1 addition & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
1-
import init, {buildNoneTemplate, InitOptions, visibleTemplates} from './init.js'
1+
import init, {InitOptions, visibleTemplates} from './init.js'
22
import {describe, expect, vi, test, beforeEach} from 'vitest'
33
import {renderSelectPrompt} from '@shopify/cli-kit/node/ui'
44
import {installGlobalCLIPrompt} from '@shopify/cli-kit/node/is-global'
5-
import {isHostedAppsMode} from '@shopify/cli-kit/node/context/local'
65

76
vi.mock('@shopify/cli-kit/node/ui')
87
vi.mock('@shopify/cli-kit/node/is-global')
9-
vi.mock('@shopify/cli-kit/node/context/local')
108

119
const globalCLIResult = {install: true, alreadyInstalled: false}
1210

@@ -49,32 +47,6 @@ describe('init', () => {
4947
})
5048
})
5149

52-
describe('buildNoneTemplate', () => {
53-
test('returns hosted app label and URL when HOSTED_APPS is enabled', () => {
54-
// Given
55-
vi.mocked(isHostedAppsMode).mockReturnValue(true)
56-
57-
// When
58-
const got = buildNoneTemplate()
59-
60-
// Then
61-
expect(got.label).toBe('Build an extension-only app (Shopify-hosted Preact app home and extensions, no back-end)')
62-
expect(got.url).toBe('https://github.com/Shopify/shopify-app-template-extension-only')
63-
})
64-
65-
test('returns default label and URL when HOSTED_APPS is not set', () => {
66-
// Given
67-
vi.mocked(isHostedAppsMode).mockReturnValue(false)
68-
69-
// When
70-
const got = buildNoneTemplate()
71-
72-
// Then
73-
expect(got.label).toBe('Build an extension-only app')
74-
expect(got.url).toBe('https://github.com/Shopify/shopify-app-template-none')
75-
})
76-
})
77-
7850
test('it renders branches for templates that have them', async () => {
7951
const answers = {
8052
template: 'https://github.com/Shopify/shopify-app-template-react-router#javascript-cli',

packages/app/src/cli/prompts/init/init.ts

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {InstallGlobalCLIPromptResult, installGlobalCLIPrompt} from '@shopify/cli-kit/node/is-global'
2-
import {isHostedAppsMode} from '@shopify/cli-kit/node/context/local'
32
import {renderSelectPrompt} from '@shopify/cli-kit/node/ui'
43

54
export interface InitOptions {
@@ -29,19 +28,6 @@ interface Template {
2928
}
3029
}
3130

32-
export function buildNoneTemplate(): Template {
33-
const hostedAppsEnabled = isHostedAppsMode()
34-
return {
35-
url: hostedAppsEnabled
36-
? 'https://github.com/Shopify/shopify-app-template-extension-only'
37-
: 'https://github.com/Shopify/shopify-app-template-none',
38-
label: hostedAppsEnabled
39-
? 'Build an extension-only app (Shopify-hosted Preact app home and extensions, no back-end)'
40-
: 'Build an extension-only app',
41-
visible: true,
42-
}
43-
}
44-
4531
// Eventually this list should be taken from a remote location
4632
// That way we don't have to update the CLI every time we add a template
4733
export const templates = {
@@ -71,7 +57,11 @@ export const templates = {
7157
},
7258
},
7359
} as Template,
74-
none: buildNoneTemplate(),
60+
none: {
61+
url: 'https://github.com/Shopify/shopify-app-template-none',
62+
label: 'Build an extension-only app',
63+
visible: true,
64+
} as Template,
7565
node: {
7666
url: 'https://github.com/Shopify/shopify-app-template-node',
7767
visible: false,

0 commit comments

Comments
 (0)