Skip to content

Commit 473cb97

Browse files
committed
chore(cli): register app:config:pull in oclif manifest
1 parent b869857 commit 473cb97

File tree

2 files changed

+80
-41
lines changed

2 files changed

+80
-41
lines changed

packages/app/src/cli/services/app/config/link.ts

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -141,18 +141,6 @@ async function selectOrCreateRemoteAppToLinkTo(options: LinkOptions): Promise<{
141141
}
142142
}
143143

144-
// NEW: if a specific config file was requested and it already knows its client_id,
145-
// try to resolve the remote app from that config and skip interactive selection.
146-
const remoteAppFromConfig = await tryGetRemoteAppFromExistingConfig(options)
147-
if (remoteAppFromConfig) {
148-
return {
149-
remoteApp: remoteAppFromConfig,
150-
appDirectory,
151-
developerPlatformClient: remoteAppFromConfig.developerPlatformClient,
152-
}
153-
}
154-
155-
// Existing behavior: prompt to fetch or create an app
156144
const remoteApp = await fetchOrCreateOrganizationApp({...creationOptions, directory: appDirectory})
157145

158146
const developerPlatformClient = remoteApp.developerPlatformClient
@@ -201,34 +189,6 @@ async function getAppCreationDefaultsFromLocalApp(options: LinkOptions): Promise
201189
}
202190
}
203191

204-
async function tryGetRemoteAppFromExistingConfig(
205-
options: LinkOptions,
206-
): Promise<OrganizationApp | undefined> {
207-
if (!options.configName) return undefined
208-
209-
try {
210-
const app = await loadApp({
211-
specifications: await loadLocalExtensionsSpecifications(),
212-
directory: options.directory,
213-
mode: 'report',
214-
userProvidedConfigName: options.configName,
215-
remoteFlags: undefined,
216-
})
217-
218-
const configuration = app.configuration
219-
220-
if (!isCurrentAppSchema(configuration) || !configuration.client_id) {
221-
return undefined
222-
}
223-
224-
const remoteApp = await appFromIdentifiers({apiKey: configuration.client_id})
225-
return remoteApp ?? undefined
226-
} catch {
227-
return undefined
228-
}
229-
}
230-
231-
232192
type LocalAppOptions =
233193
| {
234194
state: 'legacy'

packages/cli/oclif.manifest.json

Lines changed: 80 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,85 @@
164164
"strict": true,
165165
"summary": "Fetch your app configuration from the Developer Dashboard."
166166
},
167+
"app:config:pull": {
168+
"aliases": [
169+
],
170+
"args": {
171+
},
172+
"customPluginName": "@shopify/app",
173+
"description": "Pulls the latest configuration from the already-linked Shopify app and updates the selected configuration file.\n\nThis command reuses the existing linked app and organization and skips all interactive prompts. Use the --config flag to target a specific configuration file, or omit it to use the default one.",
174+
"descriptionWithMarkdown": "Pulls the latest configuration from the already-linked Shopify app and updates the selected configuration file.\n\nThis command reuses the existing linked app and organization and skips all interactive prompts. Use `--config` to target a specific configuration file, or omit it to use the default one.",
175+
"flags": {
176+
"client-id": {
177+
"description": "The Client ID of your app.",
178+
"env": "SHOPIFY_FLAG_CLIENT_ID",
179+
"exclusive": [
180+
"config"
181+
],
182+
"hasDynamicHelp": false,
183+
"hidden": false,
184+
"multiple": false,
185+
"name": "client-id",
186+
"type": "option"
187+
},
188+
"config": {
189+
"char": "c",
190+
"description": "The name of the app configuration.",
191+
"env": "SHOPIFY_FLAG_APP_CONFIG",
192+
"hasDynamicHelp": false,
193+
"hidden": false,
194+
"multiple": false,
195+
"name": "config",
196+
"type": "option"
197+
},
198+
"no-color": {
199+
"allowNo": false,
200+
"description": "Disable color output.",
201+
"env": "SHOPIFY_FLAG_NO_COLOR",
202+
"hidden": false,
203+
"name": "no-color",
204+
"type": "boolean"
205+
},
206+
"path": {
207+
"description": "The path to your app directory.",
208+
"env": "SHOPIFY_FLAG_PATH",
209+
"hasDynamicHelp": false,
210+
"multiple": false,
211+
"name": "path",
212+
"noCacheDefault": true,
213+
"type": "option"
214+
},
215+
"reset": {
216+
"allowNo": false,
217+
"description": "Reset all your settings.",
218+
"env": "SHOPIFY_FLAG_RESET",
219+
"exclusive": [
220+
"config"
221+
],
222+
"hidden": false,
223+
"name": "reset",
224+
"type": "boolean"
225+
},
226+
"verbose": {
227+
"allowNo": false,
228+
"description": "Increase the verbosity of the output.",
229+
"env": "SHOPIFY_FLAG_VERBOSE",
230+
"hidden": false,
231+
"name": "verbose",
232+
"type": "boolean"
233+
}
234+
},
235+
"hasDynamicHelp": false,
236+
"hiddenAliases": [
237+
],
238+
"id": "app:config:pull",
239+
"pluginAlias": "@shopify/cli",
240+
"pluginName": "@shopify/cli",
241+
"pluginType": "core",
242+
"strict": true,
243+
"summary": "Refresh an already-linked app configuration without prompts."
244+
},
245+
167246
"app:config:use": {
168247
"aliases": [
169248
],
@@ -7239,4 +7318,4 @@
72397318
}
72407319
},
72417320
"version": "3.87.0"
7242-
}
7321+
}

0 commit comments

Comments
 (0)