From d7cf5425c418450f99b3f2e2e649a2b454202a68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isaac=20Rold=C3=A1n?= Date: Fri, 29 Nov 2024 11:42:22 +0100 Subject: [PATCH] Show app init success after getting linked app --- packages/app/src/cli/commands/app/init.ts | 11 +---------- packages/app/src/cli/services/init/init.ts | 11 ++++++++++- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/app/src/cli/commands/app/init.ts b/packages/app/src/cli/commands/app/init.ts index f8d9b7b1fac..c90c77b05a1 100644 --- a/packages/app/src/cli/commands/app/init.ts +++ b/packages/app/src/cli/commands/app/init.ts @@ -7,7 +7,6 @@ import {validateFlavorValue, validateTemplateValue} from '../../services/init/va import {MinimalOrganizationApp, Organization, OrganizationApp} from '../../models/organization.js' import {appNamePrompt, createAsNewAppPrompt, selectAppPrompt} from '../../prompts/dev.js' import {searchForAppsByNameFactory} from '../../services/dev/prompt-helpers.js' -import {linkedAppContext} from '../../services/app-context.js' import {Flags} from '@oclif/core' import {globalFlags} from '@shopify/cli-kit/node/cli' import {resolvePath, cwd} from '@shopify/cli-kit/node/path' @@ -109,7 +108,7 @@ export default class Init extends AppCommand { cmd_create_app_template_url: promptAnswers.template, })) - const result = await initService({ + const {app} = await initService({ name: appName, selectedAppOrNameResult: selectAppResult, packageManager: inferredPackageManager, @@ -123,14 +122,6 @@ export default class Init extends AppCommand { }, }) - const {app} = await linkedAppContext({ - directory: result.outputDirectory, - clientId: undefined, - forceRelink: false, - userProvidedConfigName: undefined, - unsafeReportMode: false, - }) - return {app} } } diff --git a/packages/app/src/cli/services/init/init.ts b/packages/app/src/cli/services/init/init.ts index 8056d1cbf78..6cdfa3417f9 100644 --- a/packages/app/src/cli/services/init/init.ts +++ b/packages/app/src/cli/services/init/init.ts @@ -5,6 +5,7 @@ import {OrganizationApp} from '../../models/organization.js' import {DeveloperPlatformClient} from '../../utilities/developer-platform-client.js' import {loadConfigForAppCreation} from '../../models/app/loader.js' import {SelectAppOrNewAppNameResult} from '../../commands/app/init.js' +import {linkedAppContext} from '../app-context.js' import { findUpAndReadPackageJson, lockfiles, @@ -218,6 +219,14 @@ async function init(options: InitOptions) { false, ) + const appContextResult = await linkedAppContext({ + directory: outputDirectory, + clientId: undefined, + forceRelink: false, + userProvidedConfigName: undefined, + unsafeReportMode: false, + }) + renderSuccess({ headline: [{userInput: hyphenizedName}, 'is ready for you to build!'], nextSteps: [ @@ -234,7 +243,7 @@ async function init(options: InitOptions) { ], }) - return {outputDirectory} + return {app: appContextResult.app} } async function ensureAppDirectoryIsAvailable(directory: string, name: string): Promise {