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
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,8 @@ export class ExtensionInstance<TConfiguration extends BaseConfigType = BaseConfi
} else {
return nonRandomUUID(JSON.stringify(this.configuration))
}
default:
return this.specification.identifier
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import uiExtensionSpec from './specifications/ui_extension.js'
import webPixelSpec from './specifications/web_pixel_extension.js'
import editorExtensionCollectionSpecification from './specifications/editor_extension_collection.js'
import channelSpecificationSpec from './specifications/channel.js'
import adminSpecificationSpec from './specifications/admin.js'

const SORTED_CONFIGURATION_SPEC_IDENTIFIERS = [
BrandingSpecIdentifier,
Expand Down Expand Up @@ -61,6 +62,7 @@ function loadSpecifications() {
appWebhooksSpec,
appWebhookSubscriptionSpec,
appEventsSpec,
adminSpecificationSpec,
]
const moduleSpecs = [
checkoutPostPurchaseSpec,
Expand Down
3 changes: 2 additions & 1 deletion packages/app/src/cli/models/extensions/specification.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ export function createConfigExtensionSpecification<TConfiguration extends BaseCo
export function createContractBasedModuleSpecification<TConfiguration extends BaseConfigType = BaseConfigType>(
spec: Pick<
CreateExtensionSpecType<TConfiguration>,
'identifier' | 'appModuleFeatures' | 'buildConfig' | 'uidStrategy' | 'clientSteps'
'identifier' | 'appModuleFeatures' | 'buildConfig' | 'uidStrategy' | 'clientSteps' | 'transformRemoteToLocal'
>,
) {
return createExtensionSpecification({
Expand All @@ -299,6 +299,7 @@ export function createContractBasedModuleSpecification<TConfiguration extends Ba
clientSteps: spec.clientSteps,
buildConfig: spec.buildConfig ?? {mode: 'none'},
uidStrategy: spec.uidStrategy ?? 'single',
transformRemoteToLocal: spec.transformRemoteToLocal,
deployConfig: async (config, directory) => {
let parsedConfig = configWithoutFirstClassFields(config)
if (spec.appModuleFeatures().includes('localization')) {
Expand Down
42 changes: 42 additions & 0 deletions packages/app/src/cli/models/extensions/specifications/admin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import {createContractBasedModuleSpecification} from '../specification.js'

const adminSpecificationSpec = createContractBasedModuleSpecification({
identifier: 'admin',
uidStrategy: 'single',
transformRemoteToLocal: (remoteContent) => {
return {
admin: {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
static_root: (remoteContent as any).admin.static_root,
Copy link
Copy Markdown
Contributor

@isaacroldan isaacroldan Mar 30, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should probably validate here that admin is not null, otherwise it could crash

},
}
},
buildConfig: {
mode: 'copy_files',
filePatterns: [],
},
clientSteps: [
{
lifecycle: 'deploy',
steps: [
{
id: 'hosted_app_copy_files',
name: 'Hosted App Copy Files',
type: 'include_assets',
config: {
generateManifest: true,
inclusions: [
{
type: 'configKey',
key: 'admin.static_root',
},
],
},
},
],
},
],
appModuleFeatures: () => [],
})

export default adminSpecificationSpec
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const FILE_EXTENSIONS = ['json', 'toml', 'yaml', 'yml', 'svg']

const channelSpecificationSpec = createContractBasedModuleSpecification({
identifier: 'channel_config',
uidStrategy: 'single',
buildConfig: {
mode: 'copy_files',
filePatterns: FILE_EXTENSIONS.map((ext) => joinPath(SUBDIRECTORY_NAME, '**', `*.${ext}`)),
Expand Down
Loading