Skip to content

Commit

Permalink
Use TS uploader for shopify theme share command
Browse files Browse the repository at this point in the history
This commit switches the theme share command to use the TS uploader
It keeps the ruby implementation as a fallback.
  • Loading branch information
EvilGenius13 committed Oct 4, 2024
1 parent 327e554 commit 9e53ff9
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/theme/src/cli/commands/theme/share.ts
Original file line number Diff line number Diff line change
@@ -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.'
Expand All @@ -30,11 +29,15 @@ export default class Share extends ThemeCommand {

async run(): Promise<void> {
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)
}
}

0 comments on commit 9e53ff9

Please sign in to comment.