diff --git a/packages/theme/src/cli/commands/theme/check.ts b/packages/theme/src/cli/commands/theme/check.ts index 0e01036c5d1..b487260be86 100644 --- a/packages/theme/src/cli/commands/theme/check.ts +++ b/packages/theme/src/cli/commands/theme/check.ts @@ -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' @@ -88,8 +88,8 @@ Excludes checks matching any category when specified more than once`, ] async run(): Promise { - 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, }) } diff --git a/packages/theme/src/cli/commands/theme/delete.ts b/packages/theme/src/cli/commands/theme/delete.ts index 3c26e8006d0..9bce5114460 100644 --- a/packages/theme/src/cli/commands/theme/delete.ts +++ b/packages/theme/src/cli/commands/theme/delete.ts @@ -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" @@ -35,7 +35,7 @@ export default class Delete extends ThemeCommand { static cli2Flags = ['development', 'show-all', 'force'] async run(): Promise { - const {flags, argv} = await this.parse(Delete) + const { flags, argv } = await this.parse(Delete) const store = await getThemeStore(flags) @@ -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 }) } } diff --git a/packages/theme/src/cli/commands/theme/dev.ts b/packages/theme/src/cli/commands/theme/dev.ts index 5f4f37e2a76..dcb05585d4d 100644 --- a/packages/theme/src/cli/commands/theme/dev.ts +++ b/packages/theme/src/cli/commands/theme/dev.ts @@ -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 = @@ -87,9 +87,9 @@ export default class Dev extends ThemeCommand { ThemeRefreshTimeoutInMinutes = 90 async run(): Promise { - 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) @@ -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 }) } } diff --git a/packages/theme/src/cli/commands/theme/open.ts b/packages/theme/src/cli/commands/theme/open.ts index e6627f26cb7..e96918943c8 100644 --- a/packages/theme/src/cli/commands/theme/open.ts +++ b/packages/theme/src/cli/commands/theme/open.ts @@ -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.' @@ -37,12 +37,12 @@ export default class Open extends ThemeCommand { static cli2Flags = ['development', 'editor', 'live', 'theme'] async run(): Promise { - 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 }) } } diff --git a/packages/theme/src/cli/commands/theme/publish.ts b/packages/theme/src/cli/commands/theme/publish.ts index 24888df5a45..af350c046d0 100644 --- a/packages/theme/src/cli/commands/theme/publish.ts +++ b/packages/theme/src/cli/commands/theme/publish.ts @@ -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, @@ -24,10 +24,10 @@ export default class Publish extends ThemeCommand { static cli2Flags = ['force'] async run(): Promise { - 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) @@ -35,6 +35,6 @@ export default class Publish extends ThemeCommand { command.push(...flagsToPass) const adminSession = await session.ensureAuthenticatedThemes(store, flags.password) - await execCLI2(command, {adminSession}) + await execCLI2(command, { adminSession }) } } diff --git a/packages/theme/src/cli/commands/theme/pull.ts b/packages/theme/src/cli/commands/theme/pull.ts index 83b3f377318..3f84be7d907 100644 --- a/packages/theme/src/cli/commands/theme/pull.ts +++ b/packages/theme/src/cli/commands/theme/pull.ts @@ -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.' @@ -46,7 +46,8 @@ 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', }), } @@ -54,19 +55,19 @@ export default class Pull extends ThemeCommand { static cli2Flags = ['theme', 'development', 'live', 'nodelete', 'only', 'ignore', 'force'] async run(): Promise { - 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 }) } } diff --git a/packages/theme/src/cli/commands/theme/push.ts b/packages/theme/src/cli/commands/theme/push.ts index f231bac2d09..e066033269a 100644 --- a/packages/theme/src/cli/commands/theme/push.ts +++ b/packages/theme/src/cli/commands/theme/push.ts @@ -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 = @@ -94,13 +94,13 @@ export default class Push extends ThemeCommand { ] async run(): Promise { - 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 }) } } diff --git a/packages/theme/src/cli/commands/theme/share.ts b/packages/theme/src/cli/commands/theme/share.ts index 595e054ac9b..0aa0db10720 100644 --- a/packages/theme/src/cli/commands/theme/share.ts +++ b/packages/theme/src/cli/commands/theme/share.ts @@ -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 = @@ -23,13 +23,13 @@ export default class Share extends ThemeCommand { static cli2Flags = ['force'] async run(): Promise { - 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 }) } } diff --git a/packages/theme/src/cli/utilities/theme-command.ts b/packages/theme/src/cli/utilities/theme-command.ts index 7dc2c79ca57..e66fc61309b 100644 --- a/packages/theme/src/cli/utilities/theme-command.ts +++ b/packages/theme/src/cli/utilities/theme-command.ts @@ -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)) {