-
Notifications
You must be signed in to change notification settings - Fork 149
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
Authenticate on app init command #4492
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success1928 tests passing in 872 suites. Report generated by 🧪jest coverage report action from ad6d0ab |
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.
The code in this file was just moved from the original init.ts
and extracted to its own file. I also added tests, but I'd say you don't need to spend a lot reviewing this
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
/snapit |
🫰✨ Thanks @isaacroldan! Your snapshot has been published to npm. Test the snapshot by intalling your package globally: pnpm i -g @shopify/cli@0.0.0-snapshot-20240923104240
|
* The Client ID of your app. | ||
* @environment SHOPIFY_FLAG_CLIENT_ID | ||
*/ | ||
'--client-id <value>'?: string |
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.
This would be used to init an app, but linked to an existing? 🤔
Command docs should reflect that if so.
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.
yep, this is actually the file for the command docs.
I added this for the case where you might want to have some automated CI test that create new apps, you'd need to have a non-interactive option to create them. By passing this you avoid the prompts to select an app.
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.
Can we add that to the flag description, so it's more obvious when you would use it?
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.
It works as expected with Partners, but not with App Management API. We can have a look tomorrow.
/snapit |
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
|
🫰✨ Thanks @gonzaloriestra! Your snapshot has been published to npm. Test the snapshot by intalling your package globally: pnpm i -g @shopify/cli@0.0.0-snapshot-20240925094301
|
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.
Thanks for fixing the App Management issue! Everything looks perfect now 👌
WHY are these changes introduced?
All commands should require authentication, starting with app init.
WHAT is this pull request doing?.
Move the logic for the
init
command fromcreate-app
toapp
, so we are inverting the dependency, nowcreate-app
will depend onapp
and will expose the init command from there.This allows the init command to access all the shared stuff from
app
andcli-kit
Remove the name prompt, no longer needed since it will happen during app selection
Clear up some extra messages that are not needed anymore
Add an auth step to the
app init
command and forces the user to select and org and app so that the project is linked to a remote app from the start. (thelink
happens in the init service)Extract some of the utilities and validations to their own files and add tests for them.
How to test your changes?
Install the snapit version.
run:
or
Post-release steps
Measuring impact
How do we know this change was effective? Please choose one:
Checklist