Skip to content

Commit

Permalink
Merge pull request #5047 from Shopify/shauns/12-06-make_launcher_opti…
Browse files Browse the repository at this point in the history
…on_for_cli_optional

Make launcher option for CLI optional
  • Loading branch information
shauns authored Dec 6, 2024
2 parents 4dc64d7 + b3233ff commit 7835a90
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 19 deletions.
3 changes: 2 additions & 1 deletion packages/cli-kit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"./context/utilities.js",
"../../private/node/conf-store.js",
"../../private/node/constants.js",
"url"
"url",
"./cli-launcher.js"
]
}
]
Expand Down
5 changes: 3 additions & 2 deletions packages/cli-kit/src/public/node/cli.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {isTruthy} from './context/utilities.js'
import {launchCLI as defaultLaunchCli} from './cli-launcher.js'
import {cacheClear} from '../../private/node/conf-store.js'
import {environmentVariables} from '../../private/node/constants.js'
import {Flags} from '@oclif/core'
Expand Down Expand Up @@ -74,7 +75,7 @@ function forceNoColor(argv: string[] = process.argv, env: NodeJS.ProcessEnv = pr
*/
export async function runCLI(
options: RunCLIOptions & {runInCreateMode?: boolean},
launchCLI: (options: {moduleURL: string}) => Promise<void>,
launchCLI: (options: {moduleURL: string}) => Promise<void> = defaultLaunchCli,
argv: string[] = process.argv,
env: NodeJS.ProcessEnv = process.env,
versions: NodeJS.ProcessVersions = process.versions,
Expand Down Expand Up @@ -111,7 +112,7 @@ async function addInitToArgvWhenRunningCreateCLI(
*/
export async function runCreateCLI(
options: RunCLIOptions,
launchCLI: (options: {moduleURL: string}) => Promise<void>,
launchCLI: (options: {moduleURL: string}) => Promise<void> = defaultLaunchCli,
argv: string[] = process.argv,
env: NodeJS.ProcessEnv = process.env,
versions: NodeJS.ProcessVersions = process.versions,
Expand Down
12 changes: 4 additions & 8 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {commands as PluginCommandsCommands} from '@oclif/plugin-commands'
import {commands as PluginPluginsCommands} from '@oclif/plugin-plugins'
import {DidYouMeanCommands} from '@shopify/plugin-did-you-mean'
import {runCLI} from '@shopify/cli-kit/node/cli'
import {launchCLI} from '@shopify/cli-kit/node/cli-launcher'
import {renderFatalError} from '@shopify/cli-kit/node/ui'
import {FatalError} from '@shopify/cli-kit/node/error'
import fs from 'fs'
Expand Down Expand Up @@ -67,13 +66,10 @@ interface RunShopifyCLIOptions {
}

async function runShopifyCLI({development}: RunShopifyCLIOptions) {
await runCLI(
{
moduleURL: import.meta.url,
development,
},
launchCLI,
)
await runCLI({
moduleURL: import.meta.url,
development,
})
}

// Hide plugins command
Expand Down
12 changes: 4 additions & 8 deletions packages/create-app/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
import {commands} from '@shopify/app'
import {runCreateCLI} from '@shopify/cli-kit/node/cli'
import {launchCLI} from '@shopify/cli-kit/node/cli-launcher'

async function runCreateAppCLI(development: boolean) {
await runCreateCLI(
{
moduleURL: import.meta.url,
development,
},
launchCLI,
)
await runCreateCLI({
moduleURL: import.meta.url,
development,
})
}

export const COMMANDS: unknown = {
Expand Down

0 comments on commit 7835a90

Please sign in to comment.