From 9e53ff921b96945133391c2f15c7ef2e44130919 Mon Sep 17 00:00:00 2001 From: Josh Faigan Date: Thu, 3 Oct 2024 15:59:03 -0400 Subject: [PATCH] Use TS uploader for shopify theme share command This commit switches the theme share command to use the TS uploader It keeps the ruby implementation as a fallback. --- packages/theme/src/cli/commands/theme/share.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/theme/src/cli/commands/theme/share.ts b/packages/theme/src/cli/commands/theme/share.ts index 23398fd78aa..51ac15d2d63 100644 --- a/packages/theme/src/cli/commands/theme/share.ts +++ b/packages/theme/src/cli/commands/theme/share.ts @@ -1,10 +1,9 @@ import {themeFlags} from '../../flags.js' -import {ensureThemeStore} from '../../utilities/theme-store.js' import ThemeCommand from '../../utilities/theme-command.js' -import {execCLI2} from '@shopify/cli-kit/node/ruby' +import {push, PushFlags} from '../../services/push.js' import {Flags} from '@oclif/core' import {globalFlags} from '@shopify/cli-kit/node/cli' -import {ensureAuthenticatedThemes} from '@shopify/cli-kit/node/session' +import {getRandomName} from '@shopify/cli-kit/common/string' export default class Share extends ThemeCommand { static summary = 'Creates a shareable, unpublished, and new theme on your theme library with a randomized name.' @@ -30,11 +29,15 @@ export default class Share extends ThemeCommand { async run(): Promise { const {flags} = await this.parse(Share) - const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Share.cli2Flags}) - const store = ensureThemeStore(flags) - const adminSession = await ensureAuthenticatedThemes(store, flags.password) + const pushFlags: PushFlags = { + path: flags.path, + password: flags.password, + verbose: flags.verbose, + unpublished: true, + theme: getRandomName('creative'), + } - await execCLI2(['theme', 'share', flags.path, ...flagsToPass], {store, adminToken: adminSession.token}) + await push(pushFlags) } }