-
Notifications
You must be signed in to change notification settings - Fork 225
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
b014978
Add missing ThemeManager tests
graygilmore 7abf580
Add ability to fetch development themes by name
graygilmore f2d1910
Allow --development flag to optionally create new theme
graygilmore 840f446
Change [yours] to [current] in theme list
graygilmore 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,13 @@ | ||
| --- | ||
| '@shopify/cli-kit': minor | ||
| '@shopify/theme': minor | ||
| '@shopify/cli': minor | ||
| --- | ||
|
|
||
| Add optional context name to `--development` flag in `theme push` | ||
|
|
||
| The `--development` flag now accepts an optional context name value (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. | ||
|
|
||
| Usage: | ||
| - `shopify theme push --development` (creates/uses unnamed development theme) | ||
| - `shopify theme push --development "PR-123"` (creates/reuses development theme named "PR-123") |
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?