-
Notifications
You must be signed in to change notification settings - Fork 229
Rename extension-to-toml → extension-config-builder #6945
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Contributor
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. 🎨 Code Style: Multiple test descriptions in this file state 'correctly builds a toml object' (lines 6, 48, 88, 128). The function being tested now builds and returns a configuration object, not TOML. The test descriptions should be updated to say 'correctly builds a config object' or 'correctly builds an extension config' to align with the rename from buildTomlObject to buildExtensionConfig. Suggestion: Update all test descriptions from 'correctly builds a toml object for...' to 'correctly builds a config object for...' to maintain consistency with the refactoring's stated goal.
Contributor
Author
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. mirroring existing behavior -- happy to change as separate pr, but I'm trying to reduce surface area given this is a large change. the syntax here is pre-existing pattern |
ryancbahan marked this conversation as resolved.
Show resolved
Hide resolved
|
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -31,7 +31,7 @@ interface FlowWebhookConfig { | |||||
| * Given a flow extension config file, convert it to toml | ||||||
|
Contributor
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. 🎨 Code Style: The comment states 'convert it to toml' but this function returns a configuration object. The TOML conversion is handled by the caller via TomlFile, not by this function. The comment should align with the refactored function naming. Suggestion:
Suggested change
|
||||||
| * Works for both trigger and action because trigger config is a subset of action config | ||||||
| */ | ||||||
| export function buildTomlObject(extension: ExtensionRegistration): object { | ||||||
| export function buildExtensionConfig(extension: ExtensionRegistration): object { | ||||||
| const versionConfig = extension.activeVersion?.config ?? extension.draftVersion?.config | ||||||
| if (!versionConfig) throw new Error('No config found for extension') | ||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -26,7 +26,7 @@ interface ImportAllOptions { | |||||
|
|
||||||
| interface ImportOptions extends ImportAllOptions { | ||||||
| extensionTypes: string[] | ||||||
| buildTomlObject: ( | ||||||
| buildExtensionConfig: ( | ||||||
| ext: ExtensionRegistration, | ||||||
| allExtensions: ExtensionRegistration[], | ||||||
| appConfig: CurrentAppConfiguration, | ||||||
|
|
@@ -79,7 +79,7 @@ async function handleExtensionDirectory({ | |||||
| } | ||||||
|
|
||||||
| export async function importExtensions(options: ImportOptions) { | ||||||
| const {app, remoteApp, developerPlatformClient, extensionTypes, extensions, buildTomlObject, all} = options | ||||||
| const {app, remoteApp, developerPlatformClient, extensionTypes, extensions, buildExtensionConfig, all} = options | ||||||
|
|
||||||
| let extensionsToMigrate = extensions.filter((ext) => extensionTypes.includes(ext.type.toLowerCase())) | ||||||
| extensionsToMigrate = filterOutImportedExtensions(app, extensionsToMigrate) | ||||||
|
|
@@ -111,7 +111,7 @@ export async function importExtensions(options: ImportOptions) { | |||||
| extensionUuids[handle] = ext.uuid | ||||||
|
|
||||||
| if (action === DirectoryAction.Write) { | ||||||
| const tomlContent = buildTomlObject(ext, extensions, app.configuration) | ||||||
| const tomlContent = buildExtensionConfig(ext, extensions, app.configuration) | ||||||
|
Contributor
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. 💡 Improvement: The variable is named Suggestion: Consider renaming this variable to
Suggested change
|
||||||
| const tomlPath = joinPath(directory, 'shopify.extension.toml') | ||||||
| const file = new TomlFile(tomlPath, tomlContent as JsonMapType) | ||||||
| await file.replace(tomlContent as JsonMapType) | ||||||
|
|
@@ -150,7 +150,7 @@ export async function importAllExtensions(options: ImportAllOptions) { | |||||
| return importExtensions({ | ||||||
| ...options, | ||||||
| extensionTypes: choice.extensionTypes, | ||||||
| buildTomlObject: choice.buildTomlObject, | ||||||
| buildExtensionConfig: choice.buildExtensionConfig, | ||||||
| all: true, | ||||||
| }) | ||||||
| }), | ||||||
|
|
||||||
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.
⭐ Praise: The renaming from
buildTomlObjecttobuildExtensionConfighas been applied consistently across function definitions, interface properties, and all callsites throughout the codebase. The new import aliases (buildPaymentsConfig,buildFlowConfig, etc.) are more concise and clearly convey that these functions build configuration objects. This is solid refactoring work.