Skip to content

Commit

Permalink
Merge pull request #4557 from Shopify/jm/remove-ruby/pull
Browse files Browse the repository at this point in the history
[Themes] Remove Ruby from `theme pull` command
  • Loading branch information
jamesmengo authored Oct 8, 2024
2 parents 95989ce + 6697412 commit bddcc23
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 173 deletions.
18 changes: 0 additions & 18 deletions packages/cli/oclif.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5629,16 +5629,6 @@
],
"args": {
},
"cli2Flags": [
"theme",
"development",
"live",
"nodelete",
"only",
"ignore",
"force",
"development-theme-id"
],
"customPluginName": "@shopify/theme",
"description": "Retrieves theme files from Shopify.\n\nIf no theme is specified, then you're prompted to select the theme to pull from the list of the themes in your store.",
"descriptionWithMarkdown": "Retrieves theme files from Shopify.\n\nIf no theme is specified, then you're prompted to select the theme to pull from the list of the themes in your store.",
Expand Down Expand Up @@ -5678,14 +5668,6 @@
"name": "ignore",
"type": "option"
},
"legacy": {
"allowNo": false,
"description": "Use the legacy Ruby implementation for the `shopify theme pull` command.",
"env": "SHOPIFY_FLAG_LEGACY",
"hidden": true,
"name": "legacy",
"type": "boolean"
},
"live": {
"allowNo": false,
"char": "l",
Expand Down
105 changes: 0 additions & 105 deletions packages/theme/src/cli/commands/theme/pull.test.ts

This file was deleted.

52 changes: 2 additions & 50 deletions packages/theme/src/cli/commands/theme/pull.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,8 @@
import {themeFlags} from '../../flags.js'
import ThemeCommand, {FlagValues} from '../../utilities/theme-command.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {pull, PullFlags} from '../../services/pull.js'
import {ensureThemeStore} from '../../utilities/theme-store.js'
import {DevelopmentThemeManager} from '../../utilities/development-theme-manager.js'
import {showEmbeddedCLIWarning} from '../../utilities/embedded-cli-warning.js'
import {globalFlags} from '@shopify/cli-kit/node/cli'
import {Flags} from '@oclif/core'
import {ensureAuthenticatedThemes} from '@shopify/cli-kit/node/session'
import {useEmbeddedThemeCLI} from '@shopify/cli-kit/node/context/local'
import {execCLI2} from '@shopify/cli-kit/node/ruby'

export default class Pull extends ThemeCommand {
static summary = 'Download your remote theme files locally.'
Expand Down Expand Up @@ -60,17 +54,9 @@ If no theme is specified, then you're prompted to select the theme to pull from
description: 'Proceed without confirmation, if current directory does not seem to be theme directory.',
env: 'SHOPIFY_FLAG_FORCE',
}),
legacy: Flags.boolean({
hidden: true,
description: 'Use the legacy Ruby implementation for the `shopify theme pull` command.',
env: 'SHOPIFY_FLAG_LEGACY',
}),
}

static cli2Flags = ['theme', 'development', 'live', 'nodelete', 'only', 'ignore', 'force', 'development-theme-id']

async run(): Promise<void> {
showEmbeddedCLIWarning()
const {flags} = await this.parse(Pull)
const pullFlags: PullFlags = {
path: flags.path,
Expand All @@ -86,40 +72,6 @@ If no theme is specified, then you're prompted to select the theme to pull from
force: flags.force,
}

if (flags.legacy) {
await this.execLegacy()
} else {
await pull(pullFlags)
}
}

async execLegacy() {
const {flags} = await this.parse(Pull)
const store = ensureThemeStore({store: flags.store})
const adminSession = await ensureAuthenticatedThemes(store, flags.password)

const developmentThemeManager = new DevelopmentThemeManager(adminSession)
const developmentTheme = await (flags.development
? developmentThemeManager.find()
: developmentThemeManager.fetch())

const flagsForCli2 = flags as typeof flags & FlagValues

if (developmentTheme) {
if (flagsForCli2.development) {
flagsForCli2.theme = `${developmentTheme.id}`
flagsForCli2.development = false
}
if (useEmbeddedThemeCLI()) {
flagsForCli2['development-theme-id'] = developmentTheme.id
}
}

const flagsToPass = this.passThroughFlags(flagsForCli2, {allowedFlags: Pull.cli2Flags})
const command = ['theme', 'pull', flagsForCli2.path, ...flagsToPass].filter((arg) => {
return arg !== undefined
})

await execCLI2(command, {store, adminToken: adminSession.token})
await pull(pullFlags)
}
}

0 comments on commit bddcc23

Please sign in to comment.