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

only replace font urls when content type is not present or it is a text #1886

Merged
merged 5 commits into from
May 2, 2023

Conversation

JLoppert
Copy link

@JLoppert JLoppert commented May 2, 2023

WHY are these changes introduced?

Fixes https://github.com/Shopify/assets/issues/653

New vanity urls are breaking theme development

related to #1862
fork of #1867

WHAT is this pull request doing?

Ensure the fonts url replacement only happens on text assets (or when content type is not present)

How to test your changes?

bundle exec rake test TEST=test/shopify-cli/theme/dev_server/cdn_fonts_test.rb

OR

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
  • I've made sure that any changes to dev or deploy have been reflected in the internal flowchart.

@JLoppert JLoppert force-pushed the jloppert/fix-vanity-url-stable-3-45 branch from eb0f06f to 4be9dd7 Compare May 2, 2023 13:06
@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

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/constants.d.ts
@@ -17,16 +17,9 @@ export declare const environmentVariables: {
     codespaceName: string;
     codespaces: string;
     gitpod: string;
-    cloudShell: string;
     spin: string;
     spinAppPort: string;
     spinAppHost: string;
-    organization: string;
-    identityToken: string;
-    refreshToken: string;
-};
-export declare const systemEnvironmentVariables: {
-    backendPort: string;
 };
 export declare const pathConstants: {
     executables: {
packages/cli-kit/dist/private/node/ui.d.ts
@@ -1,6 +1,6 @@
-/// <reference types="react" />
 /// <reference types="node" resolution-mode="require"/>
 import { Logger, LogLevel } from '../../public/node/output.js';
+import { ReactElement } from 'react';
 import { Key, RenderOptions } from 'ink';
 import { EventEmitter } from 'events';
 interface RenderOnceOptions {
@@ -10,7 +10,11 @@ interface RenderOnceOptions {
 }
 export declare function renderOnce(element: JSX.Element, { logLevel, logger, renderOptions }: RenderOnceOptions): string | undefined;
 export declare function render(element: JSX.Element, options?: RenderOptions): Promise<void>;
-export declare class Stdout extends EventEmitter {
+interface Instance {
+    output: string | undefined;
+    unmount: () => void;
+}
+export declare class OutputStream extends EventEmitter {
     columns: number;
     rows: number;
     readonly frames: string[];
@@ -22,5 +26,6 @@ export declare class Stdout extends EventEmitter {
     write: (frame: string) => void;
     lastFrame: () => string | undefined;
 }
+export declare const renderString: (element: ReactElement, renderOptions?: RenderOptions) => Instance;
 export declare function handleCtrlC(input: string, key: Key): void;
 export {};
\ No newline at end of file
packages/cli-kit/dist/public/common/version.d.ts
@@ -1 +1 @@
-export declare const CLI_KIT_VERSION = "3.46.0-pre.3";
\ No newline at end of file
+export declare const CLI_KIT_VERSION = "3.45.1";
\ No newline at end of file
packages/cli-kit/dist/public/node/cli.d.ts
@@ -31,7 +31,6 @@ export declare function localCliPackage(): Promise<CliPackageInfo | undefined>;
  * are shared across all the commands.
  */
 export declare const globalFlags: {
-    'no-color': import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
     verbose: import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
 };
 export default runCLI;
\ No newline at end of file
packages/cli-kit/dist/public/node/environment.d.ts
@@ -21,25 +21,4 @@ export declare function getPartnersToken(): string | undefined;
  *
  * @returns True if the current proccess is running using the partners token.
  */
-export declare function usePartnersToken(): boolean;
-/**
- * Returns the value of the organization id from the environment variables.
- *
- * @returns True if the current proccess is running using the partners token.
- */
-export declare function getOrganization(): string | undefined;
-/**
- * Return the backend port value.
- *
- * @returns The port as a number. Undefined otherwise.
- */
-export declare function getBackendPort(): number | undefined;
-/**
- * Returns the information of the identity token.
- *
- * @returns The identity token information in case it exists.
- */
-export declare function getIdentityTokenInformation(): {
-    accessToken: string;
-    refreshToken: string;
-} | undefined;
\ No newline at end of file
+export declare function usePartnersToken(): boolean;
\ No newline at end of file
packages/cli-kit/dist/public/node/fs.d.ts
@@ -169,17 +169,12 @@ export declare function fileSizeSync(path: string): number;
  */
 export declare function unlinkFileSync(path: string): void;
 /**
- * Create a read stream for a file with optional options.
+ * Create a read stream for a file.
  *
  * @param path - Path to the file.
- * @param options - Options for the read stream.
  * @returns A read stream for the file.
  */
-export declare function createFileReadStream(path: string, options?: {
-    encoding?: BufferEncoding;
-    start?: number;
-    end?: number;
-}): ReadStream;
+export declare function createFileReadStream(path: string): ReadStream;
 /**
  * Create a write stream for a file.
  *
packages/cli-kit/dist/public/node/output.d.ts
@@ -1,5 +1,4 @@
 /// <reference types="node" resolution-mode="require"/>
-/// <reference types="node" resolution-mode="require"/>
 import { PackageManager } from './node-package-manager.js';
 import { AbortSignal } from './abort.js';
 import { ColorContentToken, CommandContentToken, ContentToken, ErrorContentToken, HeadingContentToken, ItalicContentToken, JsonContentToken, LinesDiffContentToken, LinkContentToken, PathContentToken, RawContentToken, SubHeadingContentToken } from '../../private/node/content-tokens.js';
@@ -167,10 +166,9 @@ export declare function unstyled(message: string): string;
 /**
  * Checks if the console outputs should display colors or not.
  *
- * @param _process - Optional, the process-like object to use to check if the console should display colors. Defaults to the global process.
  * @returns True if the console outputs should display colors, false otherwise.
  */
-export declare function shouldDisplayColors(_process?: NodeJS.Process): boolean;
+export declare function shouldDisplayColors(): boolean;
 /**
  * Generates a message to remind the user to update the CLI.
  *
packages/cli-kit/dist/public/node/system.d.ts
@@ -1,7 +1,5 @@
 /// <reference types="node" resolution-mode="require"/>
-/// <reference types="node" resolution-mode="require"/>
 import { AbortSignal } from './abort.js';
-import { ReadStream } from 'tty';
 import type { Writable, Readable } from 'stream';
 export interface ExecOptions {
     cwd?: string;
@@ -43,12 +41,4 @@ export declare function exec(command: string, args: string[], options?: ExecOpti
  *
  * @param seconds - Number of seconds to wait.
  */
-export declare function sleep(seconds: number): Promise<void>;
-/**
- * In case an standard input stream is passed check if it supports raw mode. Otherwise default standard input stream
- * will be used.
- *
- * @param stdin - The standard input stream to check.
- * @returns True in the selected input stream support raw mode.
- */
-export declare function terminalSupportsRawMode(stdin?: ReadStream): boolean;
\ No newline at end of file
+export declare function sleep(seconds: number): Promise<void>;
\ No newline at end of file
packages/cli-kit/dist/public/node/ui.d.ts
@@ -10,7 +10,6 @@ import { Task } from '../../private/node/ui/components/Tasks.js';
 import { TextPromptProps } from '../../private/node/ui/components/TextPrompt.js';
 import { AutocompletePromptProps } from '../../private/node/ui/components/AutocompletePrompt.js';
 import { InlineToken, LinkToken, TokenItem } from '../../private/node/ui/components/TokenizedText.js';
-import { InfoTableSection } from '../../private/node/ui/components/Prompts/InfoTable.js';
 import { Key as InkKey, RenderOptions } from 'ink';
 type PartialBy<T, TKey extends keyof T> = Omit<T, TKey> & Partial<Pick<T, TKey>>;
 export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps, 'abortController'> {
@@ -26,13 +25,13 @@ export interface RenderConcurrentOptions extends PartialBy<ConcurrentOutputProps
  * 0000-00-00 00:00:00 │ frontend │ second frontend message
  * 0000-00-00 00:00:00 │ frontend │ third frontend message
  *
- * › Press p │ preview in your browser
+ * › Press p │ open your browser
  * › Press q │ quit.
  *
  * Preview URL: https://shopify.com
  *
  */
-export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<void | void[]>;
+export declare function renderConcurrent({ renderOptions, ...props }: RenderConcurrentOptions): Promise<void>;
 export type AlertCustomSection = CustomSection;
 export type RenderAlertOptions = Omit<AlertOptions, 'type'>;
 /**
@@ -322,4 +321,4 @@ export declare function renderText({ text, logLevel, logger }: RenderTextOptions
 /** Waits for any key to be pressed except Ctrl+C which will terminate the process. */
 export declare const keypress: () => Promise<unknown>;
 export type Key = InkKey;
-export { Task, TokenItem, InlineToken, LinkToken, TableColumn, InfoTableSection };
\ No newline at end of file
+export { Task, TokenItem, InlineToken, LinkToken, TableColumn };
\ No newline at end of file
packages/cli-kit/dist/private/node/context/utilities.d.ts
@@ -1,4 +1,3 @@
-/// <reference types="node" resolution-mode="require"/>
 /**
  * Returns whether an environment variable value represents a truthy value.
  */
@@ -6,17 +5,4 @@ export declare function isTruthy(variable: string | undefined): boolean;
 /**
  * Returns whether an environment variable has been set and is non-empty
  */
-export declare function isSet(variable: string | undefined): boolean;
-/**
- * Returns an object with environment variables from the specified CI environment.
- */
-export declare function getCIMetadata(envName: string, envs: NodeJS.ProcessEnv): Metadata;
-export interface Metadata {
-    actor?: string;
-    branch?: string;
-    build?: string;
-    commitMessage?: string;
-    commitSha?: string;
-    run?: string;
-    url?: string;
-}
\ No newline at end of file
+export declare function isSet(variable: string | undefined): boolean;
\ No newline at end of file
packages/cli-kit/dist/private/node/testing/ui.d.ts
@@ -1,41 +1,14 @@
 /// <reference types="node" resolution-mode="require"/>
-import { Stdout } from '../ui.js';
-import { ReactElement } from 'react';
+import { render } from 'ink-testing-library';
 import { EventEmitter } from 'events';
-declare class Stderr extends EventEmitter {
-    readonly frames: string[];
-    private _lastFrame?;
-    write: (frame: string) => void;
-    lastFrame: () => string | undefined;
-}
 export declare class Stdin extends EventEmitter {
     isTTY: boolean;
-    constructor(options?: {
-        isTTY?: boolean;
-    });
     write: (data: string) => void;
     setEncoding(): void;
     setRawMode(): void;
     resume(): void;
     pause(): void;
 }
-interface Instance {
-    rerender: (tree: ReactElement) => void;
-    unmount: () => void;
-    cleanup: () => void;
-    stdout: Stdout;
-    stderr: Stderr;
-    stdin: Stdin;
-    frames: string[];
-    lastFrame: () => string | undefined;
-    waitUntilExit: () => Promise<void>;
-}
-interface RenderOptions {
-    stdout?: EventEmitter;
-    stderr?: EventEmitter;
-    stdin?: EventEmitter;
-}
-export declare const render: (tree: ReactElement, options?: RenderOptions) => Instance;
 /**
  * Wait for the component to be ready to accept input.
  */
@@ -74,5 +47,4 @@ export declare function sendInputAndWaitForContent(renderInstance: ReturnType<ty
  *
  * The reason this function exists is that in CI Ink will clear the last frame on unmount.
  */
-export declare function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>): string | undefined;
-export {};
\ No newline at end of file
+export declare function getLastFrameAfterUnmount(renderInstance: ReturnType<typeof render>): string | undefined;
\ No newline at end of file
packages/cli-kit/dist/public/node/context/local.d.ts
@@ -1,5 +1,4 @@
 /// <reference types="node" resolution-mode="require"/>
-import { Metadata } from '../../../private/node/context/utilities.js';
 /**
  * It returns true if the terminal is interactive.
  *
@@ -109,7 +108,7 @@ export declare function isCloudEnvironment(env?: NodeJS.ProcessEnv): boolean;
  * @returns Cloud platform information.
  */
 export declare function cloudEnvironment(env?: NodeJS.ProcessEnv): {
-    platform: 'spin' | 'codespaces' | 'gitpod' | 'cloudShell' | 'localhost';
+    platform: 'spin' | 'codespaces' | 'gitpod' | 'localhost';
     editor: boolean;
 };
 /**
@@ -127,16 +126,13 @@ export declare function hasGit(): Promise<boolean>;
 export declare function ciPlatform(env?: NodeJS.ProcessEnv): {
     isCI: true;
     name: string;
-    metadata: Metadata;
 } | {
     isCI: false;
     name?: undefined;
-    metadata?: undefined;
 };
 /**
  * Returns the first mac address found.
  *
  * @returns Mac address.
  */
-export declare function macAddress(): Promise<string>;
-export type CIMetadata = Metadata;
\ No newline at end of file
+export declare function macAddress(): Promise<string>;
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/List.d.ts
@@ -1,12 +1,10 @@
 import { InlineToken, TokenItem } from './TokenizedText.js';
-import { TextProps } from 'ink';
 import { FunctionComponent } from 'react';
 interface ListProps {
     title?: string;
     items: TokenItem<InlineToken>[];
     ordered?: boolean;
     margin?: boolean;
-    color?: TextProps['color'];
 }
 /**
  *  displays an unordered or ordered list with text aligned with the bullet point
packages/cli-kit/dist/private/node/ui/components/TextPrompt.d.ts
@@ -6,7 +6,6 @@ export interface TextPromptProps {
     password?: boolean;
     validate?: (value: string) => string | undefined;
     allowEmpty?: boolean;
-    emptyDisplayedValue?: string;
 }
 declare const TextPrompt: FunctionComponent<TextPromptProps>;
 export { TextPrompt };
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/Prompts/InfoTable.d.ts
@@ -1,17 +1,9 @@
 import { InlineToken, TokenItem } from '../TokenizedText.js';
-import { TextProps } from 'ink';
 import { FunctionComponent } from 'react';
-type Items = TokenItem<InlineToken>[];
-export interface InfoTableSection {
-    color?: TextProps['color'];
-    header: string;
-    helperText?: string;
-    items: Items;
-}
 export interface InfoTableProps {
     table: {
-        [header: string]: Items;
-    } | InfoTableSection[];
+        [header: string]: TokenItem<InlineToken>[];
+    };
 }
 declare const InfoTable: FunctionComponent<InfoTableProps>;
 export { InfoTable };
\ No newline at end of file

@github-actions
Copy link
Contributor

github-actions bot commented May 2, 2023

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements 73.42% 4337/5907
🟡 Branches 70.06% 1973/2816
🟡 Functions 70.66% 1144/1619
🟡 Lines 74.8% 4141/5536

Test suite run success

1109 tests passing in 544 suites.

Report generated by 🧪jest coverage report action from 4be9dd7

@isaacroldan isaacroldan merged commit b071592 into stable/3.45 May 2, 2023
@isaacroldan isaacroldan deleted the jloppert/fix-vanity-url-stable-3-45 branch May 2, 2023 13:20
@shopify-shipit shopify-shipit bot temporarily deployed to stable_3_45 May 2, 2023 15:49 Inactive
@isaacroldan isaacroldan mentioned this pull request May 3, 2023
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants