Skip to content
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

Draft
wants to merge 17 commits into
base: main
Choose a base branch
from
Draft

Add theme profile command #5109

wants to merge 17 commits into from

Conversation

macournoyer
Copy link

@macournoyer macournoyer commented Dec 13, 2024

WHY are these changes introduced?

https://hackdays.shopify.io/projects/19234

We want to expose Liquid profiling via:

  1. Speedscope, in the browser
  2. In our Theme VSCode extensions

The new theme profile command will be called for both. The VSCode extensions will use the --json flag.

WHAT is this pull request doing?

Add a shopify theme profile --url command that calls SFR asking for profiling data (using the Accept header).

Left to do

How to test your changes?

Run dev shopify theme profile --store [YOUR STORE DOMAIN] --url /. Should open a browser window with Speedscope in it.

Post-release steps

Measuring impact

How do we know this change was effective? Please choose one:

  • n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix
  • Existing analytics will cater for this addition
  • PR includes analytics changes to measure impact

Checklist

  • I've considered possible cross-platform impacts (Mac, Linux, Windows)
  • I've considered possible documentation changes

`dev shopify theme profile --url https://coded-courses.myshopify.com/`

Only opens a browser page for now, no auth.
Copy link
Contributor

github-actions bot commented Dec 13, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
75.28% (-0.06% 🔻)
8770/11650
🟡 Branches
70.54% (-0.1% 🔻)
4274/6059
🟡 Functions
75.04% (-0.15% 🔻)
2294/3057
🟡 Lines
75.83% (-0.04% 🔻)
8292/10935
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟡
... / context.ts
70.75%
60% (-2.07% 🔻)
73.91% 73.33%
🔴
... / extension.ts
51.02% (-4.54% 🔻)
45% (-12.69% 🔻)
50%
52.08% (-4.52% 🔻)
🟢
... / app-event-watcher.ts
93.83% (-1.23% 🔻)
86.49% (-2.7% 🔻)
90.48% 98.61%
🟢
... / dev-session.ts
85.96% (-1.03% 🔻)
68.33% (+1.09% 🔼)
91.67% (-0.93% 🔻)
92.93% (-0.4% 🔻)
🟢
... / binaries.ts
96.92% (+0.98% 🔼)
88.89% (+2.68% 🔼)
92.86% (-1.59% 🔻)
96.92% (+0.98% 🔼)
🟡
... / build.ts
74% (-2.36% 🔻)
61.36%
75.76% (-1.39% 🔻)
71.74% (-2.77% 🔻)
🟢
... / getTomls.ts
90.91%
50% (-12.5% 🔻)
100% 90.91%
🟡
... / api.ts
65.91% (-2.27% 🔻)
45.76% (-5.08% 🔻)
77.78% (-11.11% 🔻)
65.88% (-1.18% 🔻)
🟢
... / ConcurrentOutput.tsx
98.36% (-1.64% 🔻)
88% (-4% 🔻)
100%
98.33% (-1.67% 🔻)
🟢
... / node-package-manager.ts
86.74% (-0.07% 🔻)
84.44% 88.89%
86.59% (-0.07% 🔻)
🟡
... / graphql.ts
76.47% (-7.53% 🔻)
33.33% (-4.17% 🔻)
66.67% (-33.33% 🔻)
76.47% (-6.86% 🔻)

Test suite run success

1975 tests passing in 896 suites.

Report generated by 🧪jest coverage report action from 4f84642

Comment on lines +33 to +43
if (import.meta.resolve) {
return import.meta.resolve('speedscope/dist/release/index.html')
} else {
try {
const speedscopePath = require.resolve('speedscope/package.json')
const speedscopeDir = speedscopePath.replace('/package.json', '')
return `file://${speedscopeDir}/dist/release/index.html`
} catch (error) {
throw new Error("Can't find Speedscope package")
}
}
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to work both in tests and with dev shopify. Is there some packaging magic that could make this not work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants