Use self-signed certificates in `--no-tunnel` mode
WHY are these changes introduced?
Changes --no-tunnel to produce https://localhost... URLs, which are more widely compatible with the rest of the Shopify platform, making that mode a compelling alternative to using a tunnel.
- If
SHOPIFY_CLI_MKCERT_BINARYis set, use the binary at that path - Otherwise, look for
<app directory>/.shopify/mkcertin the app's codebase - Otherwise, prefer the system
mkcertif installed (viawhich) - Download
mkcertfrom github if needed, and place it in the app directory as above
dev is not typically used in CI/CD, but if desired, the use of the environment variable is probably best.
The certificates generated are localhost.pem and localhost-key.pem in <app directory>/.shopify.
Almost always, adding the mkcert binary and the .pem files to .gitignore is desirable. We should probably update our app templates accordingly.
WHAT is this pull request doing?
- Adds new utilities for managing github downloads and the mkcert binary
- Runs mkcert to generate certificates if running
devin--no-tunnelmode
How to test your changes?
Run dev with --no-tunnel. You can also use the --reset-mkcert option to get to a pristine state.
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
- [x] PR includes analytics changes to measure impact
Checklist
- [ ] I've considered possible cross-platform impacts (Mac, Linux, Windows)
- [x] I've considered possible documentation changes
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. If the changes are user-facing, run "pnpm changeset add" to track your changes and include them in the next release CHANGELOG.
Coverage report
St.:grey_question: |
Category | Percentage | Covered / Total |
|---|---|---|---|
| π‘ | Statements | 73.12% (+0.11% πΌ) |
8445/11550 |
| π‘ | Branches | 69.57% (+0.01% πΌ) |
4115/5915 |
| π‘ | Functions | 71.96% (+0.21% πΌ) |
2189/3042 |
| π‘ | Lines | 73.44% (+0.09% πΌ) |
7991/10881 |
Show new covered files π£
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π‘ | ... / mkcert.ts |
77.78% | 60.71% | 75% | 76.74% |
| π’ | ... / test-with-temp-dir.ts |
100% | 100% | 100% | 100% |
Show files with reduced coverage π»
St.:grey_question: |
File | Statements | Branches | Functions | Lines |
|---|---|---|---|---|---|
| π‘ | ... / dev.ts |
74.47% (-1.62% π») |
65% | 72.22% (-4.25% π») |
70.73% (-1.77% π») |
| π΄ | ... / dev.ts |
9.48% (-0.25% π») |
1.52% (-0.05% π») |
15.79% | 9.35% (-0.27% π») |
| π’ | ... / github.ts |
91.11% (+4.9% πΌ) |
85.71% (-2.52% π») |
87.5% (+7.5% πΌ) |
91.11% (+4.9% πΌ) |
Test suite run success
1900 tests passing in 861 suites.
Report generated by π§ͺjest coverage report action from cc4b21aee2a5253efcca478def1d2c0f2e874041
Differences in type declarations
We 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:
- Some seemingly private modules might be re-exported through public modules.
- If the branch is behind
mainyou might see odd diffs, rebasemaininto this branch.
New type declarations
packages/cli-kit/dist/public/node/testing/test-with-temp-dir.d.ts
import { TestAPI } from 'vitest';
interface TempDirFixture {
tempDir: string;
}
/**
* Vitest fixture providing the test with a temporary directory to work in.
*/
export declare const testWithTempDir: TestAPI<TempDirFixture>;
export {};
Existing type declarations
packages/cli-kit/dist/public/node/github.d.ts
@@ -47,4 +47,5 @@ export interface GithubRepositoryReference {
* @param reference - A GitHub repository URL (e.g. https://github.com/Shopify/cli/blob/main/package.json)
*/
export declare function parseGitHubRepositoryReference(reference: string): GithubRepositoryReference;
+export declare function downloadGitHubRelease(repo: string, version: string, assetName: string, targetPath: string): Promise<void>;
export {};
\ No newline at end of file
/snapit
π«°β¨ Thanks @shauns! Your snapshot has been published to npm.
Test the snapshot by intalling your package globally:
pnpm i -g @shopify/[email protected]
After installing, validate the version by running just
shopifyin your terminal If the versions don't match, you might have multiple global instances installed. Usewhich shopifyto find out which one you are running and uninstall it.
/snapit
π«°β¨ Thanks @shauns! Your snapshot has been published to npm.
Test the snapshot by intalling your package globally:
pnpm i -g @shopify/[email protected]
After installing, validate the version by running just
shopifyin your terminal If the versions don't match, you might have multiple global instances installed. Usewhich shopifyto find out which one you are running and uninstall it.
This PR seems inactive. If it's still relevant, please add a comment saying so. Otherwise, take no action. β If there's no activity within a week, then a bot will automatically close this. Thanks for helping to improve Shopify's dev tooling and experience.