-
Notifications
You must be signed in to change notification settings - Fork 227
Allow --development flag to create a new theme
#6657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
graygilmore
wants to merge
4
commits into
main
Choose a base branch
from
gg-push-with-name
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,9 @@ | ||
| --- | ||
| '@shopify/cli-kit': patch | ||
| '@shopify/theme': patch | ||
| '@shopify/cli': patch | ||
| --- | ||
|
|
||
| Change wording for current development theme in `theme list` | ||
|
|
||
| Previously you could only have one development theme at a time so we'd add `[yours]` beside the development theme that you were currently attached to. Now you can have multiple development themes so we're changing the language to `[current]` to show which theme you are actively connected to. |
This file contains hidden or 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,9 @@ | ||
| --- | ||
| '@shopify/cli-kit': minor | ||
| '@shopify/theme': minor | ||
| '@shopify/cli': minor | ||
| --- | ||
|
|
||
| Add `--development-context` flag to `theme push` | ||
|
|
||
| The new `--development-context` flag (short: `-c`) allows you to specify a unique identifier for a development theme context (e.g., PR number, branch name). This gives developers the ability to programmatically create or reuse named development themes; particularly useful when running `shopify theme push` in a CI environment where you might want to associate a particular development theme to a branch or pull request. |
This file contains hidden or 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
This file contains hidden or 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
72 changes: 72 additions & 0 deletions
72
packages/cli-kit/src/cli/api/graphql/admin/generated/find_development_theme_by_name.ts
This file contains hidden or 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,72 @@ | ||
| /* 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 FindDevelopmentThemeByNameQueryVariables = Types.Exact<{ | ||
| name: Types.Scalars['String']['input'] | ||
| }> | ||
|
|
||
| export type FindDevelopmentThemeByNameQuery = { | ||
| themes?: {nodes: {id: string; name: string; role: Types.ThemeRole; processing: boolean}[]} | null | ||
| } | ||
|
|
||
| export const FindDevelopmentThemeByName = { | ||
| kind: 'Document', | ||
| definitions: [ | ||
| { | ||
| kind: 'OperationDefinition', | ||
| operation: 'query', | ||
| name: {kind: 'Name', value: 'findDevelopmentThemeByName'}, | ||
| variableDefinitions: [ | ||
| { | ||
| kind: 'VariableDefinition', | ||
| variable: {kind: 'Variable', name: {kind: 'Name', value: 'name'}}, | ||
| type: {kind: 'NonNullType', type: {kind: 'NamedType', name: {kind: 'Name', value: 'String'}}}, | ||
| }, | ||
| ], | ||
| selectionSet: { | ||
| kind: 'SelectionSet', | ||
| selections: [ | ||
| { | ||
| kind: 'Field', | ||
| name: {kind: 'Name', value: 'themes'}, | ||
| arguments: [ | ||
| {kind: 'Argument', name: {kind: 'Name', value: 'first'}, value: {kind: 'IntValue', value: '2'}}, | ||
| { | ||
| kind: 'Argument', | ||
| name: {kind: 'Name', value: 'names'}, | ||
| value: {kind: 'ListValue', values: [{kind: 'Variable', name: {kind: 'Name', value: 'name'}}]}, | ||
| }, | ||
| { | ||
| kind: 'Argument', | ||
| name: {kind: 'Name', value: 'roles'}, | ||
| value: {kind: 'ListValue', values: [{kind: 'EnumValue', value: 'DEVELOPMENT'}]}, | ||
| }, | ||
| ], | ||
| selectionSet: { | ||
| kind: 'SelectionSet', | ||
| selections: [ | ||
| { | ||
| kind: 'Field', | ||
| name: {kind: 'Name', value: 'nodes'}, | ||
| selectionSet: { | ||
| kind: 'SelectionSet', | ||
| selections: [ | ||
| {kind: 'Field', name: {kind: 'Name', value: 'id'}}, | ||
| {kind: 'Field', name: {kind: 'Name', value: 'name'}}, | ||
| {kind: 'Field', name: {kind: 'Name', value: 'role'}}, | ||
| {kind: 'Field', name: {kind: 'Name', value: 'processing'}}, | ||
| {kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
| ], | ||
| }, | ||
| }, | ||
| {kind: 'Field', name: {kind: 'Name', value: '__typename'}}, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| } as unknown as DocumentNode<FindDevelopmentThemeByNameQuery, FindDevelopmentThemeByNameQueryVariables> |
10 changes: 10 additions & 0 deletions
10
packages/cli-kit/src/cli/api/graphql/admin/queries/find_development_theme_by_name.graphql
This file contains hidden or 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,10 @@ | ||
| query findDevelopmentThemeByName($name: String!) { | ||
| themes(first: 2, names: [$name], roles: [DEVELOPMENT]) { | ||
| nodes { | ||
| id | ||
| name | ||
| role | ||
| processing | ||
| } | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋🏻 @binarymonkey84! Going to respond here so we can thread replies
This is fully up to theme developers to decide how they want to leverage this. Maybe we could add it as an example of configuring a GitHub action, though!
This is already working! The additional functionality I've added doesn't have any effect on the
--jsonflag so this should continue working as normal.I'm not sure if we've ever shared the exact timing for this. I'll sync with the team to see if we can get some official documentation around this. Keep in mind, too, that there is a limit to the amount of development themes you can have (also undocumented, we'll see about having official guidelines on that, too).
This might have been true at some point but is not true now. We'll get this cleaned up.
In CI you'll be running the same command but also passing the
--passwordflag. Perhaps I'm misunderstanding? Or is this in relation to the confusing wording about when development themes are deleted?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @graygilmore
Yeah, I guess it's just because in the PR there were already opinions on how devs could name their theme (think it was pull request name and something else), so I thought if we're making suggestions, then suggesting commit ID might be worth doing since it encourages using this for theme instances that are more likely to correspond to a PR at a specific commit. Not too fussed on this though!
Great! Wasn't sure if the --json flag was only supported with certain flags or contexts. Given this will be probably used by developers in conjunction with the command, makes sense to check it does work but if it's guaranteed to work then all good.
Amazing, yes having that clarity would really help to plan and set expectations.
It's just in relation to the confusing wording :) As in, if themes are deleted on 'shopify auth logout', but that CLI command won't be run in the CI action, it wasn't clear when the theme would actually be deleted.
Cheers for all your work on this!