Skip to content
Closed
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
12 changes: 6 additions & 6 deletions packages/theme/src/cli/commands/theme/check.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {themeFlags} from '../../flags.js'
import { themeFlags } from '../../flags.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import {cli} from '@shopify/cli-kit'
import {Flags} from '@oclif/core'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'
import { cli } from '@shopify/cli-kit'
import { Flags } from '@oclif/core'

export default class Check extends ThemeCommand {
static description = 'Validate the theme'
Expand Down Expand Up @@ -88,8 +88,8 @@ Excludes checks matching any category when specified more than once`,
]

async run(): Promise<void> {
const {flags} = await this.parse(Check)
await execCLI2(['theme', 'check', flags.path, ...this.passThroughFlags(flags, {allowedFlags: Check.cli2Flags})], {
const { flags } = await this.parse(Check)
await execCLI2(['theme', 'check', flags.path, ...this.passThroughFlags(flags, { allowedFlags: Check.cli2Flags })], {
directory: flags.path,
})
}
Expand Down
16 changes: 8 additions & 8 deletions packages/theme/src/cli/commands/theme/delete.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {getThemeStore} from '../../utilities/theme-store.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {themeFlags} from '../../flags.js'
import {Flags} from '@oclif/core'
import {cli, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { themeFlags } from '../../flags.js'
import { Flags } from '@oclif/core'
import { cli, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Delete extends ThemeCommand {
static description = "Delete remote themes from the connected store. This command can't be undone"
Expand Down Expand Up @@ -35,7 +35,7 @@ export default class Delete extends ThemeCommand {
static cli2Flags = ['development', 'show-all', 'force']

async run(): Promise<void> {
const {flags, argv} = await this.parse(Delete)
const { flags, argv } = await this.parse(Delete)

const store = await getThemeStore(flags)

Expand All @@ -45,10 +45,10 @@ export default class Delete extends ThemeCommand {
command.push(...argv)
}

const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Delete.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Delete.cli2Flags })
command.push(...flagsToPass)

const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)
await execCLI2(command, {adminSession})
await execCLI2(command, { adminSession })
}
}
16 changes: 8 additions & 8 deletions packages/theme/src/cli/commands/theme/dev.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {themeFlags} from '../../flags.js'
import {getThemeStore} from '../../utilities/theme-store.js'
import { themeFlags } from '../../flags.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {Flags} from '@oclif/core'
import {cli, output, session, abort} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { Flags } from '@oclif/core'
import { cli, output, session, abort } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Dev extends ThemeCommand {
static description =
Expand Down Expand Up @@ -87,9 +87,9 @@ export default class Dev extends ThemeCommand {
ThemeRefreshTimeoutInMinutes = 90

async run(): Promise<void> {
const {flags} = await this.parse(Dev)
const { flags } = await this.parse(Dev)

const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Dev.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Dev.cli2Flags })
const command = ['theme', 'serve', flags.path, ...flagsToPass]

const store = await getThemeStore(flags)
Expand All @@ -111,6 +111,6 @@ export default class Dev extends ThemeCommand {
async execute(store: string, command: string[], controller: AbortController) {
const adminSession = await session.ensureAuthenticatedThemes(store, undefined, [], true)
const storefrontToken = await session.ensureAuthenticatedStorefront()
await execCLI2(command, {adminSession, storefrontToken, signal: controller.signal as abort.Signal})
await execCLI2(command, { adminSession, storefrontToken, signal: controller.signal as abort.Signal })
}
}
16 changes: 8 additions & 8 deletions packages/theme/src/cli/commands/theme/open.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {getThemeStore} from '../../utilities/theme-store.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {themeFlags} from '../../flags.js'
import {Flags} from '@oclif/core'
import {cli, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { themeFlags } from '../../flags.js'
import { Flags } from '@oclif/core'
import { cli, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Open extends ThemeCommand {
static description = 'Opens the preview of your remote theme.'
Expand Down Expand Up @@ -37,12 +37,12 @@ export default class Open extends ThemeCommand {
static cli2Flags = ['development', 'editor', 'live', 'theme']

async run(): Promise<void> {
const {flags} = await this.parse(Open)
const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Open.cli2Flags})
const { flags } = await this.parse(Open)
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Open.cli2Flags })
const command = ['theme', 'open', ...flagsToPass]

const store = await getThemeStore(flags)
const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)
await execCLI2(command, {adminSession})
await execCLI2(command, { adminSession })
}
}
18 changes: 9 additions & 9 deletions packages/theme/src/cli/commands/theme/publish.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import {getThemeStore} from '../../utilities/theme-store.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {themeFlags} from '../../flags.js'
import {Flags} from '@oclif/core'
import {cli, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { themeFlags } from '../../flags.js'
import { Flags } from '@oclif/core'
import { cli, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Publish extends ThemeCommand {
static description = 'Set a remote theme as the live theme.'

static args = [{name: 'themeId', description: 'The ID of the theme', required: false}]
static args = [{ name: 'themeId', description: 'The ID of the theme', required: false }]

static flags = {
...cli.globalFlags,
Expand All @@ -24,17 +24,17 @@ export default class Publish extends ThemeCommand {
static cli2Flags = ['force']

async run(): Promise<void> {
const {flags, args} = await this.parse(Publish)
const { flags, args } = await this.parse(Publish)

const store = await getThemeStore(flags)
const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Publish.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Publish.cli2Flags })
const command = ['theme', 'publish']
if (args.themeId) {
command.push(args.themeId)
}
command.push(...flagsToPass)

const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)
await execCLI2(command, {adminSession})
await execCLI2(command, { adminSession })
}
}
19 changes: 10 additions & 9 deletions packages/theme/src/cli/commands/theme/pull.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {themeFlags} from '../../flags.js'
import {getThemeStore} from '../../utilities/theme-store.js'
import { themeFlags } from '../../flags.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {Flags} from '@oclif/core'
import {cli, path, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { Flags } from '@oclif/core'
import { cli, path, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Pull extends ThemeCommand {
static description = 'Download your remote theme files locally.'
Expand Down Expand Up @@ -46,27 +46,28 @@ export default class Pull extends ThemeCommand {
force: Flags.boolean({
hidden: true,
char: 'f',
description: 'Proceed without confirmation, if current directory does not seem to be theme directory.',
description:
'Proceed without confirmation, if current directory is not empty, or does not seem to be theme directory.',
env: 'SHOPIFY_FLAG_FORCE',
}),
}

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

async run(): Promise<void> {
const {flags} = await this.parse(Pull)
const { flags } = await this.parse(Pull)

let validPath = flags.path
if (!path.isAbsolute(validPath)) {
validPath = path.resolve(flags.path)
}

const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Pull.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Pull.cli2Flags })

const command = ['theme', 'pull', validPath, ...flagsToPass]

const store = await getThemeStore(flags)
const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)
await execCLI2(command, {adminSession})
await execCLI2(command, { adminSession })
}
}
16 changes: 8 additions & 8 deletions packages/theme/src/cli/commands/theme/push.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {themeFlags} from '../../flags.js'
import {getThemeStore} from '../../utilities/theme-store.js'
import { themeFlags } from '../../flags.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {Flags} from '@oclif/core'
import {cli, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import { Flags } from '@oclif/core'
import { cli, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'

export default class Push extends ThemeCommand {
static description =
Expand Down Expand Up @@ -94,13 +94,13 @@ export default class Push extends ThemeCommand {
]

async run(): Promise<void> {
const {flags} = await this.parse(Push)
const { flags } = await this.parse(Push)

const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Push.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Push.cli2Flags })
const command = ['theme', 'push', flags.path, ...flagsToPass]

const store = await getThemeStore(flags)
const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)
await execCLI2(command, {adminSession})
await execCLI2(command, { adminSession })
}
}
16 changes: 8 additions & 8 deletions packages/theme/src/cli/commands/theme/share.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {themeFlags} from '../../flags.js'
import {getThemeStore} from '../../utilities/theme-store.js'
import { themeFlags } from '../../flags.js'
import { getThemeStore } from '../../utilities/theme-store.js'
import ThemeCommand from '../../utilities/theme-command.js'
import {cli, path, session} from '@shopify/cli-kit'
import {execCLI2} from '@shopify/cli-kit/node/ruby'
import {Flags} from '@oclif/core'
import { cli, path, session } from '@shopify/cli-kit'
import { execCLI2 } from '@shopify/cli-kit/node/ruby'
import { Flags } from '@oclif/core'

export default class Share extends ThemeCommand {
static description =
Expand All @@ -23,13 +23,13 @@ export default class Share extends ThemeCommand {
static cli2Flags = ['force']

async run(): Promise<void> {
const {flags} = await this.parse(Share)
const { flags } = await this.parse(Share)
const directory = flags.path ? path.resolve(flags.path) : process.cwd()
const flagsToPass = this.passThroughFlags(flags, {allowedFlags: Share.cli2Flags})
const flagsToPass = this.passThroughFlags(flags, { allowedFlags: Share.cli2Flags })

const store = await getThemeStore(flags)
const adminSession = await session.ensureAuthenticatedThemes(store, flags.password)

await execCLI2(['theme', 'share', directory, ...flagsToPass], {adminSession})
await execCLI2(['theme', 'share', directory, ...flagsToPass], { adminSession })
}
}
2 changes: 1 addition & 1 deletion packages/theme/src/cli/utilities/theme-command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ interface PassThroughFlagsOptions {
}

export default abstract class ThemeCommand extends Command {
passThroughFlags(flags: FlagValues, {allowedFlags}: PassThroughFlagsOptions): string[] {
passThroughFlags(flags: FlagValues, { allowedFlags }: PassThroughFlagsOptions): string[] {
const passThroughFlags: string[] = []
for (const [label, value] of Object.entries(flags)) {
if (!(allowedFlags ?? []).includes(label)) {
Expand Down