cli icon indicating copy to clipboard operation
cli copied to clipboard

show warning message when installing mkcert in WSL

Open isaacroldan opened this issue 9 months ago β€’ 9 comments

WHY are these changes introduced?

Provide guidance on certificate trust configuration for windows users under WSL.

WHAT is this pull request doing?

When a user is running the CLI in WSL, they'll now see a warning explaining that additional steps are required to configure certificate trust in Windows, along with a link to documentation that provides detailed instructions.

The PR also:

  • Adds a pause (keypress prompt) after the warning to ensure users see the message
  • Updates tests to cover the new WSL detection and warning functionality

How to test your changes?

  1. Run the CLI in a WSL environment
  2. Generate a certificate using the CLI
  3. Verify that the WSL warning appears with a link to documentation
  4. Verify that the CLI pauses for user input after displaying the warning

Measuring impact

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

  • [x] n/a - this doesn't need measurement, e.g. a linting rule or a bug-fix

Checklist

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

isaacroldan avatar Apr 30 '25 10:04 isaacroldan

This stack of pull requests is managed by Graphite. Learn more about stacking.

isaacroldan avatar Apr 30 '25 10:04 isaacroldan

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 main you might see odd diffs, rebase main into this branch.

New type declarations

We found no new type declarations in this PR

Existing type declarations

packages/cli-kit/dist/private/node/analytics.d.ts
@@ -21,6 +21,7 @@ interface EnvironmentData {
     env_package_manager: string;
     env_is_global: boolean;
     env_auth_method: string;
+    env_is_wsl: boolean;
 }
 export declare function getEnvironmentData(config: Interfaces.Config): Promise<EnvironmentData>;
 export declare function getSensitiveEnvironmentData(config: Interfaces.Config): Promise<{

packages/cli-kit/dist/public/node/monorail.d.ts
@@ -2,7 +2,7 @@ import { JsonMap } from '../../private/common/json.js';
 import { DeepRequired } from '../common/ts/deep-required.js';
 export { DeepRequired };
 type Optional<T> = T | null;
-export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.16";
+export declare const MONORAIL_COMMAND_TOPIC = "app_cli3_command/1.17";
 export interface Schemas {
     [MONORAIL_COMMAND_TOPIC]: {
         sensitive: {

packages/cli-kit/dist/public/node/system.d.ts
@@ -56,4 +56,10 @@ export declare function terminalSupportsPrompting(): boolean;
  *
  * @returns True if the current environment is a CI environment.
  */
-export declare function isCI(): boolean;
\ No newline at end of file
+export declare function isCI(): boolean;
+/**
+ * Check if the current environment is a WSL environment.
+ *
+ * @returns True if the current environment is a WSL environment.
+ */
+export declare const isWsl: boolean;
\ No newline at end of file

github-actions[bot] avatar Apr 30 '25 10:04 github-actions[bot]

Coverage report

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements
76.64% (+0.02% πŸ”Ό)
9607/12535
🟑 Branches
71.97% (+0.02% πŸ”Ό)
4752/6603
🟑 Functions 76.56% 2485/3246
🟑 Lines
77.15% (+0.02% πŸ”Ό)
9079/11768

Test suite run success

2271 tests passing in 983 suites.

Report generated by πŸ§ͺjest coverage report action from ce3d7604054098595be016523a4b5c35a9bfb896

github-actions[bot] avatar Apr 30 '25 10:04 github-actions[bot]

We detected some changes at packages/*/src 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.

[!CAUTION] DO NOT create changesets for features which you do not wish to be included in the public changelog of the next CLI release.

github-actions[bot] avatar May 06 '25 14:05 github-actions[bot]

/snapit

nickwesselman avatar May 09 '25 14:05 nickwesselman

🫰✨ Thanks @nickwesselman! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

[!TIP] If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

[!CAUTION] After installing, validate the version by running just shopify in your terminal. If the versions don't match, you might have multiple global instances installed. Use which shopify to find out which one you are running and uninstall it.

github-actions[bot] avatar May 09 '25 14:05 github-actions[bot]

We have a bit of a delay after "pressing any key"... I assume because expensive dev things are starting, but it makes it seem like the keypress didn't work. πŸ€”

I wonder if even adding the print of a blank line would help, since your keypress then gives the appearance of advancing the dev process.

nickwesselman avatar May 09 '25 14:05 nickwesselman

Makes sense, we can add a blank line or if you think a short text might help we could do that. (For now i'll add the empty line)

isaacroldan avatar May 09 '25 14:05 isaacroldan

Yeah give it a try with an empty line first. If it doesn't feel responsive enough, maybe something like

Resuming `app dev`...

(with a blank line at the bottom to separate it from the dev output)

nickwesselman avatar May 09 '25 14:05 nickwesselman

/snapit

nickwesselman avatar May 13 '25 17:05 nickwesselman

🫰✨ Thanks @nickwesselman! Your snapshot has been published to npm.

Test the snapshot by installing your package globally:

pnpm i -g @shopify/[email protected]

[!TIP] If you get an ETARGET error, install it with NPM and the flag --@shopify:registry=https://registry.npmjs.org

[!CAUTION] After installing, validate the version by running just shopify in your terminal. If the versions don't match, you might have multiple global instances installed. Use which shopify to find out which one you are running and uninstall it.

github-actions[bot] avatar May 13 '25 17:05 github-actions[bot]