Skip to content
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

Make launcher option for CLI optional #5047

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading