-
Notifications
You must be signed in to change notification settings - Fork 143
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
Add theme profile
command
#5109
Open
macournoyer
wants to merge
41
commits into
main
Choose a base branch
from
theme-profile
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.
+1,655
−24
Open
Changes from 32 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
bab02b0
Setup `theme profile` command
macournoyer 037a0fa
Output profiling JSON data to stdout
macournoyer 45bb9f4
Open theme profile in Speedscope by default
macournoyer 1347120
Add token auth to theme profile command
macournoyer dbbdcf6
Refresh manifests
macournoyer 7559132
pnpm update-docs
macournoyer 0ab1b0f
Update lock file
macournoyer 60fe55c
Add knip entry for speedscope
macournoyer 2495c6b
Add new generated doc files I missed
macournoyer b65e554
Switch to using mime type for Liquid profiling
macournoyer e981668
Add tests for theme profile command
macournoyer 34a2184
Add more doc to theme profile
macournoyer 2141fc6
Add more validation around theme profile command
macournoyer b7cda8c
Add .changeset file
macournoyer 91ff0c4
Fix error handling in theme profile command
macournoyer 487ed2f
Adjust tests expectations
macournoyer a0955f7
Switch `theme profile` to use DevServer rendering
macournoyer a5ceb0b
Update theme profile tests
macournoyer de4b963
Ignore typescipt error for conditional in resolveSpeedscope
macournoyer 71f2677
Lint
macournoyer 2d7ef73
more descriptive changelogs
macournoyer a49cf3e
Swtich to minor version bump
macournoyer 2241a17
Refresh OCLIF manifest
macournoyer 1a56b88
Regen docs
macournoyer d33d13e
Add waiting rainbow to theme profile command
macournoyer 7d21e67
Add imports for Task in theme profile
macournoyer 6810b3b
Don't use native node os and fs modules
macournoyer e222c18
Restructure theme profile test following Given/When/Then
macournoyer 5e9ef0b
Lint
macournoyer 93d2018
Try removing speedscope from ignoreDependencies
macournoyer 1e4e69c
Fix speedscope error on `shopify theme profile` (#5178)
karreiro dbfa8b9
Fix json flag polluting stdout in theme profile
macournoyer 25d4dd2
Add use for theme profile w/o url flag
macournoyer 6e9888c
Add --environment flag to theme profile
macournoyer f8bb4d6
Move speedscore from deps to assets
frandiox c1062a9
Fix path in unbundled unit tests
frandiox 8eb3b92
Ignore cli dep in knip
frandiox c3d1d92
Regenerate types.d.ts
frandiox 12b9c49
Merge pull request #5214 from Shopify/fd-fix-speedscope-bundling
macournoyer 82e8981
Merge branch 'main' into theme-profile
frandiox 88d83f7
Update usage of isStorefrontPasswordProtected
frandiox 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 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/theme': minor | ||
--- | ||
|
||
Add `theme profile` command which allows users to get a performance profile for Liquid rendering on a given page |
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 @@ | ||
theme profile --url /products/classic-leather-jacket |
50 changes: 50 additions & 0 deletions
50
docs-shopify.dev/commands/interfaces/theme-profile.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,50 @@ | ||
// This is an autogenerated file. Don't edit this file manually. | ||
export interface themeprofile { | ||
/** | ||
* Output the result as JSON. | ||
* @environment SHOPIFY_FLAG_JSON | ||
*/ | ||
'-j, --json'?: '' | ||
|
||
/** | ||
* 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 | ||
|
||
/** | ||
* 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 | ||
|
||
/** | ||
* The password for storefronts with password protection. | ||
* @environment SHOPIFY_FLAG_STORE_PASSWORD | ||
*/ | ||
'--store-password <value>'?: string | ||
|
||
/** | ||
* Theme ID or name of the remote theme. | ||
* @environment SHOPIFY_FLAG_THEME_ID | ||
*/ | ||
'-t, --theme <value>'?: string | ||
|
||
/** | ||
* The url to be used as context | ||
* @environment SHOPIFY_FLAG_URL | ||
*/ | ||
'--url <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 profile', | ||
description: `Profile the Shopify Liquid on a given page. | ||
This command will open a web page with the Speedscope profiler detailing the time spent executing Liquid on the given page.`, | ||
overviewPreviewDescription: `Profile the Liquid rendering of a theme page.`, | ||
type: 'command', | ||
isVisualComponent: false, | ||
defaultExample: { | ||
codeblock: { | ||
tabs: [ | ||
{ | ||
title: 'theme profile', | ||
code: './examples/theme-profile.example.sh', | ||
language: 'bash', | ||
}, | ||
], | ||
title: 'theme profile', | ||
}, | ||
}, | ||
definitions: [ | ||
{ | ||
title: 'Flags', | ||
description: 'The following flags are available for the `theme profile` command:', | ||
type: 'themeprofile', | ||
}, | ||
], | ||
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
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
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
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
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
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.
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.
why is this dependency in both cli and theme package.json's? It should be enough with the theme one
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.
Good question... not sure @karreiro if you had to add this to fix the packaging?
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.
I did a short exploration into this when I had some free time.
I am relatively green to TS / JS so I won't purport to be an expert on the module system ( or have much knowledge here at all yet) - info here
Would definitely prefer not to have to udpate the
cli
package.jsonThere 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.
@jamesmengo thanks for the exploration! I'm unclear what solution you're suggesting, out of those:
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.
That's actually not the reason why you need it there for require.resolve to work.
We bundle dependencies, once bundled, you can't access specific files with require.resolve. By adding it as a dependency of CLI, you are basically telling the CLI not to bundle this package, which will affect the total size and speed of the CLI installation.
You need to solve this issue in the bundle script, manually copying the files you want to access with require.resolve. (cli/bin/bundle.js).
Sorry but adding dependencies to CLI directly is not allowed as it affects all users performance.
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.
@isaacroldan thanks for the context!
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.
I should add some lint rule so that teams are warned about this earlier in the dev process and not in the final review, sorry I didn't see it earlier 🙏