-
Notifications
You must be signed in to change notification settings - Fork 149
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
Migrate themeCreate to GraphQL #5249
base: main
Are you sure you want to change the base?
Conversation
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success2045 tests passing in 913 suites. Report generated by 🧪jest coverage report action from 4a3895c |
f0c0b74
to
2a64370
Compare
This comment has been minimized.
This comment has been minimized.
2a64370
to
dcb5814
Compare
@@ -406,135 +419,10 @@ export async function passwordProtected(session: AdminSession): Promise<boolean> | |||
return passwordProtection.enabled | |||
} | |||
|
|||
async function request<T>( |
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.
🔥 🔥 🔥
dcb5814
to
1fa637d
Compare
source: themeSource, | ||
role: (params.role ?? DEVELOPMENT_THEME_ROLE).toUpperCase() as ThemeRole, | ||
}, | ||
'2025-04', |
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.
To remove post RC 2025-04
. role
argument was recently added and is only in 2025-04
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.
How will we remember to do this?
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.
Currently I just have it as a cal reminder for april 1st 😅 Unless there's a remind me / todo func in the CLI repo?
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.
You may be able to schedule an issue via a workflow but that feels like overkill 🤷🏼
1fa637d
to
3a3dc8e
Compare
import {GetThemeFileChecksums} from '../../../cli/api/graphql/admin/generated/get_theme_file_checksums.js' | ||
import {ThemeFilesUpsert} from '../../../cli/api/graphql/admin/generated/theme_files_upsert.js' | ||
import {ThemeFilesDelete} from '../../../cli/api/graphql/admin/generated/theme_files_delete.js' | ||
import {OnlineStoreThemeFileBodyInputType} from '../../../cli/api/graphql/admin/generated/types.js' | ||
import {GetThemes} from '../../../cli/api/graphql/admin/generated/get_themes.js' | ||
import {GetTheme} from '../../../cli/api/graphql/admin/generated/get_theme.js' | ||
import {test, vi, expect, describe} from 'vitest' | ||
import {adminRequestDoc, restRequest, supportedApiVersions} from '@shopify/cli-kit/node/api/admin' |
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.
oooh. 🔥
source: themeSource, | ||
role: (params.role ?? DEVELOPMENT_THEME_ROLE).toUpperCase() as ThemeRole, | ||
}, | ||
'2025-04', |
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.
How will we remember to do this?
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationspackages/cli-kit/dist/cli/api/graphql/admin/generated/theme_create.d.tsimport * as Types from './types.js';
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
export type ThemeCreateMutationVariables = Types.Exact<{
name: Types.Scalars['String']['input'];
source: Types.Scalars['URL']['input'];
role: Types.ThemeRole;
}>;
export type ThemeCreateMutation = {
themeCreate?: {
theme?: {
id: string;
name: string;
role: Types.ThemeRole;
} | null;
userErrors: {
field?: string[] | null;
message: string;
}[];
} | null;
};
export declare const ThemeCreate: DocumentNode<ThemeCreateMutation, ThemeCreateMutationVariables>;
Existing type declarationspackages/cli-kit/dist/public/node/themes/api.d.ts@@ -5,7 +5,7 @@ export type ThemeParams = Partial<Pick<Theme, 'name' | 'role' | 'processing' | '
export type AssetParams = Pick<ThemeAsset, 'key'> & Partial<Pick<ThemeAsset, 'value' | 'attachment'>>;
export declare function fetchTheme(id: number, session: AdminSession): Promise<Theme | undefined>;
export declare function fetchThemes(session: AdminSession): Promise<Theme[]>;
-export declare function createTheme(params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
+export declare function themeCreate(params: ThemeParams, session: AdminSession): Promise<Theme | undefined>;
export declare function fetchThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<ThemeAsset[]>;
export declare function deleteThemeAssets(id: number, filenames: Key[], session: AdminSession): Promise<Result[]>;
export declare function bulkUploadThemeAssets(id: number, assets: AssetParams[], session: AdminSession): Promise<Result[]>;
|
WHY are these changes introduced?
Migrate theme create to use GraphQL
themeCreate
mutation. Use skeleton theme (minimal theme that contains onlytheme.liquid
,password.liquid
, andsettings_schema.json
) created my @jamesmengoHow to test your changes?
shopify theme dev
orshopify theme push
How do we know this change was effective? Please choose one:
Checklist