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

[Themes] Console - Make storefront password storage sticky #4295

Merged
merged 2 commits into from
Aug 14, 2024

Conversation

jamesmengo
Copy link
Contributor

@jamesmengo jamesmengo commented Aug 8, 2024

WHY are these changes introduced?

WHAT is this pull request doing?

  • Stores the storefront password in local storage so that users don't have to continually provide the password via a flag or text input
  • Passwords are stored separately for each store

This includes

  • Basic storage of valid passwords
  • Ability to override the stored value with the --store-password flag
  • Removal of incorrect or outdated passwords
asdf.mp4

How to test your changes?

Basic Usage:

  1. Run the command with a correct password
  2. Run the command again without providing a password - it should work

Override Capability:
3) Override the stored password by using the --store-password flag with an incorrect value
4) You should be prompted to input another password again

Incorrect Password Handling:
5) Provide incorrect password
6) Terminate the session ctrl + c
7) Run the command again and verify that you're prompted to provide the password

Notes

  • A hacky way to "flush" local storage is to modify the project name here and run p build
  • You can also test changing the password via the admin panel to invalidate the stored password

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

@jamesmengo jamesmengo added the #gsd:40767 Fortify local development experience for Liquid themes label Aug 8, 2024
@jamesmengo jamesmengo self-assigned this Aug 8, 2024
Copy link
Contributor

github-actions bot commented Aug 8, 2024

Thanks for your contribution!

Depending on what you are working on, you may want to request a review from a Shopify team:

  • Themes: @shopify/advanced-edits
  • UI extensions: @shopify/ui-extensions-cli
    • Checkout UI extensions: @shopify/checkout-ui-extensions-api-stewardship
  • Hydrogen: @shopify/hydrogen
  • Other: @shopify/app-management

Copy link
Contributor

github-actions bot commented Aug 8, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
72.62% (+0.01% 🔼)
7913/10896
🟡 Branches
69.41% (+0.02% 🔼)
3886/5599
🟡 Functions 71.32% 2076/2911
🟡 Lines
72.96% (+0.01% 🔼)
7478/10250

Test suite run success

1804 tests passing in 822 suites.

Report generated by 🧪jest coverage report action from 528b38d

Copy link
Contributor

github-actions bot commented Aug 8, 2024

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/public/node/http.d.ts
@@ -7,7 +7,7 @@ export { FetchError, Request } from 'node-fetch';
  * @returns A FormData object.
  */
 export declare function formData(): FormData;
-export type Response = ReturnType<typeof nodeFetch>;
+export type Response = Awaited<ReturnType<typeof nodeFetch>>;
 /**
  * An interface that abstracts way node-fetch. When Node has built-in
  * support for "fetch" in the standard library, we can drop the node-fetch
@@ -20,7 +20,7 @@ export type Response = ReturnType<typeof nodeFetch>;
  * @param init - An object containing any custom settings that you want to apply to the request.
  * @returns A promise that resolves with the response.
  */
-export declare function fetch(url: RequestInfo, init?: RequestInit): Response;
+export declare function fetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
 /**
  * A fetch function to use with Shopify services. The function ensures the right
  * TLS configuragion is used based on the environment in which the service is running
@@ -30,7 +30,7 @@ export declare function fetch(url: RequestInfo, init?: RequestInit): Response;
  * @param init - An object containing any custom settings that you want to apply to the request.
  * @returns A promise that resolves with the response.
  */
-export declare function shopifyFetch(url: RequestInfo, init?: RequestInit): Response;
+export declare function shopifyFetch(url: RequestInfo, init?: RequestInit): Promise<Response>;
 /**
  * Download a file from a URL to a local path.
  *
packages/cli-kit/dist/public/node/ui.d.ts
@@ -7,7 +7,7 @@ import { AlertOptions } from '../../private/node/ui/alert.js';
 import { CustomSection } from '../../private/node/ui/components/Alert.js';
 import ScalarDict from '../../private/node/ui/components/Table/ScalarDict.js';
 import { TableColumn, TableProps } from '../../private/node/ui/components/Table/Table.js';
-import { Token, InlineToken, LinkToken, ListToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
+import { InlineToken, LinkToken, ListToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
 import { DangerousConfirmationPromptProps } from '../../private/node/ui/components/DangerousConfirmationPrompt.js';
 import { SelectPromptProps } from '../../private/node/ui/components/SelectPrompt.js';
 import { Task } from '../../private/node/ui/components/Tasks.js';
@@ -394,4 +394,4 @@ interface IsTTYOptions {
 export declare function isTTY({ stdin, uiDebugOptions }?: IsTTYOptions): boolean;
 export type Key = InkKey;
 export type InfoMessage = InfoMessageProps['message'];
-export { Token, Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC };
\ No newline at end of file
+export { Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection, ListToken, render, handleCtrlC };
\ No newline at end of file
packages/cli-kit/dist/public/node/api/business-platform.d.ts
@@ -24,20 +24,10 @@ export declare function businessPlatformRequestDoc<TResult, TVariables extends V
  *
  * @param query - GraphQL query to execute.
  * @param token - Business Platform token.
- * @param organizationId - Organization ID as a numeric (non-GID) value.
- * @param variables - GraphQL variables to pass to the query.
- * @returns The response of the query of generic type <T>.
- */
-export declare function businessPlatformOrganizationsRequest<T>(query: string, token: string, organizationId: string, variables?: GraphQLVariables): Promise<T>;
-/**
- * Executes a GraphQL query against the Business Platform Organizations API. Uses typed documents.
- *
- * @param query - GraphQL query to execute.
- * @param token - Business Platform token.
  * @param organizationId - Organization ID as a numeric value.
  * @param variables - GraphQL variables to pass to the query.
  * @returns The response of the query of generic type <T>.
  */
-export declare function businessPlatformOrganizationsRequestDoc<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
+export declare function businessPlatformOrganizationsRequest<TResult>(query: TypedDocumentNode<TResult, GraphQLVariables> | TypedDocumentNode<TResult, Exact<{
     [key: string]: never;
 }>>, token: string, organizationId: string, variables?: GraphQLVariables): Promise<TResult>;
\ No newline at end of file

@jamesmengo jamesmengo marked this pull request as ready for review August 8, 2024 17:36
Copy link
Contributor

github-actions bot commented Aug 8, 2024

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.

Base automatically changed from jmeng/themeconsole to main August 9, 2024 14:16
Copy link
Contributor

@karreiro karreiro left a comment

Choose a reason for hiding this comment

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

Thank you, @jamesmengo! Great stuff 🔥🚀 LGTM and works as expected as well :)

@karreiro karreiro added this pull request to the merge queue Aug 14, 2024
Merged via the queue into main with commit a953300 Aug 14, 2024
37 checks passed
@karreiro karreiro deleted the jmeng/console-sticky branch August 14, 2024 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
#gsd:40767 Fortify local development experience for Liquid themes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants