-
Notifications
You must be signed in to change notification settings - Fork 125
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
Enforce that all commands load an app #4509
base: login-on-init
Are you sure you want to change the base?
Conversation
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
Coverage report
Show files with reduced coverage 🔻
Test suite run success1927 tests passing in 872 suites. Report generated by 🧪jest coverage report action from 02e6acb |
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 declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/public/common/url.d.ts@@ -5,4 +5,11 @@
* @returns True if the URL is valid, false otherwise.
* @throws An error if URL's constructor throws an error other than .
*/
-export declare function isValidURL(url: string): boolean;
\ No newline at end of file
+export declare function isValidURL(url: string): boolean;
+/**
+ * Safely parse a string into a URL.
+ *
+ * @param url - The string to parse into a URL.
+ * @returns A URL object if the parsing is successful, undefined otherwise.
+ */
+export declare function safeParseURL(url: string): URL | undefined;
\ No newline at end of file
packages/cli-kit/dist/public/node/node-package-manager.d.ts@@ -293,4 +293,17 @@ export declare function addResolutionOrOverride(directory: string, dependencies:
* @param packageJSON - Package.json file to write.
*/
export declare function writePackageJSON(directory: string, packageJSON: PackageJson): Promise<void>;
+/**
+ * Infers the package manager to be used based on the provided options and environment.
+ *
+ * This function determines the package manager in the following order of precedence:
+ * 1. Uses the package manager specified in the options, if valid.
+ * 2. Infers the package manager from the user agent string.
+ * 3. Infers the package manager used for the global CLI installation.
+ * 4. Defaults to 'npm' if no other method succeeds.
+ *
+ * @param optionsPackageManager - The package manager specified in the options (if any).
+ * @returns The inferred package manager as a PackageManager type.
+ */
+export declare function inferPackageManager(optionsPackageManager: string | undefined, env?: NodeJS.ProcessEnv): PackageManager;
export {};
\ No newline at end of file
|
WHY are these changes introduced?
All commands should track all app-related details.
To enforce that, we make every app command return an
AppInterface
, which means that an app was loaded at some point.WHAT is this pull request doing?
app/commands
extendAppCommand
AppCommand
define therun
function to return an object with anAppInterface
, TS will force all child classes to use the same return type.AppCommand
, all return anAppInterface
now.IN A FUTURE PR:
loadAppContext
How to test your changes?
Nothing to test in the CLI itself, you can try to modify the code of a command and see that the rules are being applied.
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist