-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create
shopify theme metafields pull
command
- Loading branch information
Showing
16 changed files
with
805 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
'@shopify/theme': minor | ||
'@shopify/cli': minor | ||
--- | ||
|
||
New CLI command under `shopify theme` to pull metafield definitions from the shop | ||
|
||
Run command by calling `shopify theme metafields pull` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@shopify/cli-kit': patch | ||
--- | ||
|
||
Introduce method to fetch metafield definitions by ownerType from Admin API |
1 change: 1 addition & 0 deletions
1
docs-shopify.dev/commands/examples/theme-metafields-pull.example.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
shopify theme metafields pull [flags] |
32 changes: 32 additions & 0 deletions
32
docs-shopify.dev/commands/interfaces/theme-metafields-pull.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// This is an autogenerated file. Don't edit this file manually. | ||
export interface thememetafieldspull { | ||
/** | ||
* Disable color output. | ||
* @environment SHOPIFY_FLAG_NO_COLOR | ||
*/ | ||
'--no-color'?: '' | ||
|
||
/** | ||
* Password generated from the Theme Access app. | ||
* @environment SHOPIFY_CLI_THEME_TOKEN | ||
*/ | ||
'--password <value>'?: string | ||
|
||
/** | ||
* The path to your theme directory. | ||
* @environment SHOPIFY_FLAG_PATH | ||
*/ | ||
'--path <value>'?: string | ||
|
||
/** | ||
* Store URL. It can be the store prefix (example) or the full myshopify.com URL (example.myshopify.com, https://example.myshopify.com). | ||
* @environment SHOPIFY_FLAG_STORE | ||
*/ | ||
'-s, --store <value>'?: string | ||
|
||
/** | ||
* Increase the verbosity of the output. | ||
* @environment SHOPIFY_FLAG_VERBOSE | ||
*/ | ||
'--verbose'?: '' | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// This is an autogenerated file. Don't edit this file manually. | ||
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs' | ||
|
||
const data: ReferenceEntityTemplateSchema = { | ||
name: 'theme metafields pull', | ||
description: `Retrieves metafields from Shopify Admin. | ||
If the metafields file already exists, it will be overwritten.`, | ||
overviewPreviewDescription: `Download metafields defined on Shopify Admin into a local file.`, | ||
type: 'command', | ||
isVisualComponent: false, | ||
defaultExample: { | ||
codeblock: { | ||
tabs: [ | ||
{ | ||
title: 'theme metafields pull', | ||
code: './examples/theme-metafields-pull.example.sh', | ||
language: 'bash', | ||
}, | ||
], | ||
title: 'theme metafields pull', | ||
}, | ||
}, | ||
definitions: [ | ||
{ | ||
title: 'Flags', | ||
description: 'The following flags are available for the `theme metafields pull` command:', | ||
type: 'thememetafieldspull', | ||
}, | ||
], | ||
category: 'theme', | ||
related: [ | ||
], | ||
} | ||
|
||
export default data |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
packages/cli-kit/src/cli/api/graphql/admin/generated/metafield_definitions_by_owner_type.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* eslint-disable @typescript-eslint/consistent-type-definitions */ | ||
import * as Types from './types.js' | ||
|
||
import {TypedDocumentNode as DocumentNode} from '@graphql-typed-document-node/core' | ||
|
||
export type MetafieldDefinitionsByOwnerTypeQueryVariables = Types.Exact<{ | ||
ownerType: Types.MetafieldOwnerType | ||
}> | ||
|
||
export type MetafieldDefinitionsByOwnerTypeQuery = { | ||
metafieldDefinitions: { | ||
nodes: {name: string; namespace: string; description?: string | null; type: {category: string; name: string}}[] | ||
} | ||
} | ||
|
||
export const MetafieldDefinitionsByOwnerType = { | ||
kind: 'Document', | ||
definitions: [ | ||
{ | ||
kind: 'OperationDefinition', | ||
operation: 'query', | ||
name: {kind: 'Name', value: 'metafieldDefinitionsByOwnerType'}, | ||
variableDefinitions: [ | ||
{ | ||
kind: 'VariableDefinition', | ||
variable: {kind: 'Variable', name: {kind: 'Name', value: 'ownerType'}}, | ||
type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'MetafieldOwnerType'}}}, | ||
}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'metafieldDefinitions'}, | ||
arguments: [ | ||
{ | ||
kind: 'Argument', | ||
name: {kind: 'Name', value: 'ownerType'}, | ||
value: {kind: 'Variable', name: {kind: 'Name', value: 'ownerType'}}, | ||
}, | ||
{kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '250'}}, | ||
], | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'nodes'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'name'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'namespace'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'description'}}, | ||
{ | ||
kind: 'Field', | ||
name: {kind: 'Name', value: 'type'}, | ||
selectionSet: { | ||
kind: 'SelectionSet', | ||
selections: [ | ||
{kind: 'Field', name: {kind: 'Name', value: 'category'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: 'name'}}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
{kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
], | ||
}, | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
} as unknown as DocumentNode<MetafieldDefinitionsByOwnerTypeQuery, MetafieldDefinitionsByOwnerTypeQueryVariables> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
...ges/cli-kit/src/cli/api/graphql/admin/queries/metafield_definitions_by_owner_type.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
query metafieldDefinitionsByOwnerType($ownerType: MetafieldOwnerType!) { | ||
metafieldDefinitions(ownerType: $ownerType, first: 250) { | ||
nodes { | ||
name | ||
namespace | ||
description | ||
type { | ||
category | ||
name | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.