-
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
21 changed files
with
819 additions
and
15 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,6 @@ | ||
--- | ||
'@shopify/theme': minor | ||
'@shopify/cli': minor | ||
--- | ||
|
||
Developers can now use the `shopify theme metafields pull` command to download metafields, which can then be used for more refined code completion. |
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 definitions from your shop 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
87 changes: 87 additions & 0 deletions
87
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,87 @@ | ||
/* 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: { | ||
key: string | ||
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: 'key'}}, | ||
{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
14 changes: 14 additions & 0 deletions
14
...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,14 @@ | ||
query metafieldDefinitionsByOwnerType($ownerType: MetafieldOwnerType!) { | ||
metafieldDefinitions(ownerType: $ownerType, first: 250) { | ||
nodes { | ||
key | ||
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.