-
Notifications
You must be signed in to change notification settings - Fork 104
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
Dynamic log prefixes for app dev
output
#3797
Conversation
Thanks for your contribution! Depending on what you are working on, you may want to request a review from a Shopify team:
|
packages/cli-kit/src/private/node/ui/components/ConcurrentOutput.tsx
Outdated
Show resolved
Hide resolved
* add dynamic prefix to some build commands
packages/cli-kit/src/private/node/ui/components/ConcurrentOutput.tsx
Outdated
Show resolved
Hide resolved
packages/cli-kit/src/private/node/ui/components/ConcurrentOutput.tsx
Outdated
Show resolved
Hide resolved
* it didn't need to be that hard
packages/app/src/cli/services/dev/processes/draftable-extension.ts
Outdated
Show resolved
Hide resolved
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/node/ui/components.d.ts@@ -1 +1 @@
-export { ConcurrentOutput } from '../../../private/node/ui/components/ConcurrentOutput.js';
\ No newline at end of file
+export { ConcurrentOutput, ConcurrentOutputContext, useConcurrentOutputContext, } from '../../../private/node/ui/components/ConcurrentOutput.js';
\ No newline at end of file
packages/cli-kit/dist/private/node/ui/components/ConcurrentOutput.d.ts@@ -3,10 +3,15 @@ import { AbortSignal } from '../../../../public/node/abort.js';
import { FunctionComponent } from 'react';
export interface ConcurrentOutputProps {
processes: OutputProcess[];
+ prefixColumnSize?: number;
abortSignal: AbortSignal;
showTimestamps?: boolean;
keepRunningAfterProcessesResolve?: boolean;
}
+interface ConcurrentOutputContext {
+ outputPrefix: string;
+}
+declare function useConcurrentOutputContext<T>(context: ConcurrentOutputContext, callback: () => T): T;
/**
* Renders output from concurrent processes to the terminal.
* Output will be divided in a three column layout
@@ -20,4 +25,4 @@ export interface ConcurrentOutputProps {
* rsnode backend/index.js
*/
declare const ConcurrentOutput: FunctionComponent<ConcurrentOutputProps>;
-export { ConcurrentOutput };
\ No newline at end of file
+export { ConcurrentOutput, ConcurrentOutputContext, useConcurrentOutputContext };
\ No newline at end of file
|
interface ConcurrentOutputContext { | ||
outputPrefix: 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.
Do we want to add stdout/stderr here? maybe in a follow up PR?
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.
I think that's a bigger refactor, and I'm not sure whether it would actually be the same context object to be honest -- it's communicating from ConcurrentOutput
to our log utilities. The code doing the logging may not need any knowledge of it at all.
I can log a separate issue for this.
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.
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.
🎩'ed and works great 👌
WHY are these changes introduced?
Enables extension-specific prefixes in the
app dev
output. This improves the existingapp dev
output for extensions by allowing log prefixes to match the extension handle, which is already the case forapp build
. It also enables extension-specific prefixes in the forthcoming app/function log streaming.WHAT is this pull request doing?
ConcurrentOutput
now looks for a prefix stashed in anAsyncLocalStorage
, which it will use instead of the process prefix.ConcurrentOutput
allows for prefix column width to be set externally and not just on known processes.extensions
.app dev
output to better confirm to our UX principles for Shopify CLI.The colors used in
app dev
output weren't changed, but we might consider adding to them in a follow up PR.Before
After
How to test your changes?
The best test is running
app dev
against an app with many extensions. I have one here:https://github.com/Shopify/nw-scratch/tree/many-extension-app
Measuring impact
How do we know this change was effective? Please choose one:
Checklist
dev
ordeploy
have been reflected in the internal flowchart.