Skip to content

Commit f562355

Browse files
committed
Refactor init command to use ThemeCommand's run method
Previously `theme init` command implemented its own `run` logic. This commit refactors `init` to use ThemeCommand's base `run()` method. This will help to standardize command architecture and allow for out of the box authentication and environments support
1 parent c5e181c commit f562355

File tree

1 file changed

+6
-2
lines changed
  • packages/theme/src/cli/commands/theme

1 file changed

+6
-2
lines changed

packages/theme/src/cli/commands/theme/init.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@ import {generateRandomNameForSubdirectory} from '@shopify/cli-kit/node/fs'
1313
import {renderTextPrompt} from '@shopify/cli-kit/node/ui'
1414
import {joinPath} from '@shopify/cli-kit/node/path'
1515
import {terminalSupportsPrompting} from '@shopify/cli-kit/node/system'
16+
import {InferredArgs, InferredFlags} from '@oclif/core/interfaces'
17+
import {AdminSession} from '@shopify/cli-kit/node/session'
18+
19+
type InitFlags = InferredFlags<typeof Init.flags>
20+
type InitArgs = InferredArgs<typeof Init.args>
1621

1722
export default class Init extends ThemeCommand {
1823
static summary = 'Clones a Git repository to use as a starting point for building a new theme.'
@@ -52,8 +57,7 @@ export default class Init extends ThemeCommand {
5257
}),
5358
}
5459

55-
async run(): Promise<void> {
56-
const {args, flags} = await this.parse(Init)
60+
async command(flags: InitFlags, _adminSession: AdminSession, _multiEnvironment: boolean, args: InitArgs) {
5761
const name = args.name || (await this.promptName(flags.path))
5862
const repoUrl = flags['clone-url']
5963
const destination = joinPath(flags.path, name)

0 commit comments

Comments
 (0)