Skip to content

Commit

Permalink
test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmengo committed Nov 14, 2024
1 parent dcde301 commit 88dc8aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 52 deletions.
53 changes: 2 additions & 51 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ import HelpCommand from './cli/commands/help.js'
import List from './cli/commands/notifications/list.js'
import Generate from './cli/commands/notifications/generate.js'
import ClearCache from './cli/commands/cache/clear.js'
import ThemeCommands, {
push as ThemePush,
pull as ThemePull,
fetchStoreThemes as ThemeFetchStoreThemes,
} from '@shopify/theme'
import ThemeCommands from '@shopify/theme'
import {COMMANDS as HydrogenCommands, HOOKS as HydrogenHooks} from '@shopify/cli-hydrogen'
import {commands as AppCommands} from '@shopify/app'
import {commands as PluginCommandsCommands} from '@oclif/plugin-commands'
Expand All @@ -27,59 +23,14 @@ import {runCLI} from '@shopify/cli-kit/node/cli'
import {launchCLI} from '@shopify/cli-kit/node/cli-launcher'
import {renderFatalError} from '@shopify/cli-kit/node/ui'
import {FatalError} from '@shopify/cli-kit/node/error'
import {Theme} from '@shopify/cli-kit/node/themes/types'
import fs from 'fs'

export {DidYouMeanHook} from '@shopify/plugin-did-you-mean'
export {default as TunnelStartHook} from '@shopify/plugin-cloudflare/hooks/tunnel'
export {default as TunnelProviderHook} from '@shopify/plugin-cloudflare/hooks/provider'
export {hooks as PluginHook} from '@oclif/plugin-plugins'
export {AppSensitiveMetadataHook, AppInitHook, AppPublicMetadataHook} from '@shopify/app'

export const push: (options: {
/** Path to the theme directory */
path: string
/** Store URL (e.g. my-store.myshopify.com) */
store: string
/** Admin API access token. Will prompt if not provided */
password?: string
/** Theme ID. Will create new theme if not provided */
theme?: string
/** Keep remote files that don't exist locally */
nodelete?: boolean
/** Development theme suffix */
development?: boolean
/** Only upload files that have changed */
only?: string[]
/** Ignore specific files */
ignore?: string[]
/** Live reload */
live?: boolean
/** Allow live reload to work outside local environments */
'allow-live'?: boolean
}) => Promise<void> = ThemePush

export const pull: (options: {
/** Theme ID to pull from */
theme: string
/** Store URL (e.g. my-store.myshopify.com) */
store: string
/** Admin API access token. Will prompt if not provided */
password?: string
/** Development theme suffix */
development?: boolean
/** Only download specific files */
only?: string[]
/** Ignore specific files */
ignore?: string[]
}) => Promise<void> = ThemePull

export const fetchStoreThemes: (options: {
/** Store URL (e.g. my-store.myshopify.com) */
store: string
/** Admin API access token. Will prompt if not provided */
password: string
}) => Promise<Theme[]> = (options) => ThemeFetchStoreThemes(options.store, options.password)
export {push, pull, fetchStoreThemes, type PullFlags, type PushFlags, type PublicFetchStoreThemes} from '@shopify/theme'

export const HydrogenInitHook = HydrogenHooks.init

Expand Down
5 changes: 4 additions & 1 deletion packages/theme/src/cli/utilities/theme-selector/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ import {Theme} from '@shopify/cli-kit/node/themes/types'
export type Role = 'live' | 'development' | 'unpublished'
export const ALLOWED_ROLES: Role[] = ['live', 'unpublished', 'development']

// Export the function type
export type PublicFetchStoreThemes = (store: string, password: string) => Promise<Theme[]>

/**
* Fetches the themes from the store.
* @param store - Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com).
* @param password - Password generated from the Theme Access app.
* @returns An array of themes from the store.
*/
export async function publicFetchStoreThemes(store: string, password: string) {
export const publicFetchStoreThemes: PublicFetchStoreThemes = async (store, password) => {
const adminSession = await ensureAuthenticatedThemes(store, password)
return fetchStoreThemes(adminSession)
}
Expand Down

0 comments on commit 88dc8aa

Please sign in to comment.