-
Notifications
You must be signed in to change notification settings - Fork 229
add admin section to the hosted app specification #6895
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
base: graphite-base/6895
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,23 +5,28 @@ import {dirname, joinPath} from '@shopify/cli-kit/node/path' | |
| import {zod} from '@shopify/cli-kit/node/schema' | ||
|
|
||
| const HostedAppHomeSchema = BaseSchemaWithoutHandle.extend({ | ||
| static_root: zod.string().optional(), | ||
| admin: zod | ||
| .object({ | ||
| static_root: zod.string().optional(), | ||
| }) | ||
| .optional(), | ||
| }) | ||
|
|
||
| const HostedAppHomeTransformConfig: TransformationConfig = { | ||
| static_root: 'static_root', | ||
| admin: 'admin', | ||
| } | ||
|
|
||
| export const HostedAppHomeSpecIdentifier = 'hosted_app_home' | ||
| export const HostedAppHomeSpecIdentifier = 'admin' | ||
|
|
||
| const hostedAppHomeSpec = createConfigExtensionSpecification({ | ||
| identifier: HostedAppHomeSpecIdentifier, | ||
| buildConfig: {mode: 'hosted_app_home'} as const, | ||
| schema: HostedAppHomeSchema, | ||
| transformConfig: HostedAppHomeTransformConfig, | ||
| copyStaticAssets: async (config, directory, outputPath) => { | ||
| if (!config.static_root) return | ||
| const sourceDir = joinPath(directory, config.static_root) | ||
| const staticRoot = config.admin?.static_root | ||
| if (!staticRoot) return | ||
| const sourceDir = joinPath(directory, staticRoot) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Schema changed to The schema changed from top-level |
||
| const outputDir = dirname(outputPath) | ||
|
|
||
| return copyDirectoryContents(sourceDir, outputDir).catch((error) => { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Identifier renamed to
adminwithout alias/back-compat handlingThe config extension spec identifier was changed from
hosted_app_hometoadmin(export const HostedAppHomeSpecIdentifier = 'admin'). This identifier is used to match/route config modules (e.g., included inCONFIG_EXTENSION_IDS, used in spec list sorting). If existing projects/platform still send/expecthosted_app_home, the CLI may not recognize the module, may fail schema validation, or may fail to load/copy assets. This is high-risk because it can break builds/deploys for users on older config versions.