-
Notifications
You must be signed in to change notification settings - Fork 142
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
Rework app info to use components #5170
Conversation
e4cc408
to
8144601
Compare
Coverage report
Show new covered files 🐣
Show files with reduced coverage 🔻
Test suite run success2003 tests passing in 904 suites. Report generated by 🧪jest coverage report action from 7df0f33 |
3bf58a5
to
2d18f38
Compare
This comment has been minimized.
This comment has been minimized.
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 won't speak to the introduction of a new component but this is such a massive improvement for apps – thank you!
this.tableSection( | ||
'Current app configuration', | ||
[ | ||
['Configuration file', {filePath: basename(this.app.configuration.path) || configurationFileNames.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.
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 is very surprising! It's supposed to be italicized, I wonder what your settings are such that colors are inverted instead.
3970ccc
to
413f784
Compare
import {CLI_KIT_VERSION} from '@shopify/cli-kit/common/version' | ||
|
||
type CustomSection = Exclude<Parameters<typeof renderInfo>[0]['customSections'], undefined>[number] |
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 you add a comment to clarify what this type represents? Asking because hovering on it in Cursor just says type CustomSection = CustomSection
😅
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 realized we do already export the AlertCustomSection
type so I'm just going to use that.
[' config file', relativePath(extension.directory, extension.configurationPath)], | ||
const details: InlineToken[][] = [ | ||
[`📂 ${extension.handle || NOT_LOADED_TEXT}`, {filePath: relativePath(this.app.directory, extension.directory)}], | ||
[' config file', {filePath: relativePath(extension.directory, extension.configurationPath)}], |
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 is probably unnecessary, since the config file is always shopify.extension.toml
.
Should we remove 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.
I think it is still valuable for consistency and for new users who are still learning how apps work.
{ | ||
body: [ | ||
'💡 To change these, run', | ||
{command: formatPackageManagerCommand(this.app.packageManager, 'dev', '--reset')}, |
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.
since we are modifying info, it's probably better to recommend running app config link
.
Also, formatPackageManagerCommand
expects a full global command as default, so this should be:
{command: formatPackageManagerCommand(this.app.packageManager, 'shopify app config link')},
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.
Happy to make the change and I think it's an improvement. But I have some thoughts about making this better in general, since now it won't really account for changing the dev store. Basically this was set up at a time when the CLI worked differently, and it needs a refresh.
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.
Agree we need to rework that section 👌
413f784
to
362151e
Compare
1. Add a default relative path (otherwise relativePath returns a blank string) 2. Move roles to a separate line item
We removed the upgrade reminders in #4310 but we missed deleting the tests!
362151e
to
7429878
Compare
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 declarationspackages/cli-kit/dist/private/node/ui/components/TabularData.d.tsimport { InlineToken } from './TokenizedText.js';
import { FunctionComponent } from 'react';
export interface TabularDataProps {
tabularData: InlineToken[][];
firstColumnSubdued?: boolean;
}
declare const TabularData: FunctionComponent<TabularDataProps>;
export { TabularData };
Existing type declarationspackages/cli-kit/dist/private/node/ui/components/Alert.d.ts@@ -1,9 +1,10 @@
import { BannerType } from './Banner.js';
import { BoldToken, InlineToken, LinkToken, TokenItem } from './TokenizedText.js';
+import { TabularDataProps } from './TabularData.js';
import { FunctionComponent } from 'react';
export interface CustomSection {
title?: string;
- body: TokenItem;
+ body: TabularDataProps | TokenItem;
}
export interface AlertProps {
type: Exclude<BannerType, 'external_error'>;
|
WHY are these changes introduced?
web
section for extension-only apps.WHAT is this pull request doing?
Instead of the mess of string generation, we reorganize the code to generate headers and data tables, then do the actual rendering in UI kit.
To make this work nicely, I added a new
TabularData
concept to UI kit, which does seem useful in general. It even has a parameter to dim the leftmost column, which I think creates a pleasant effect.App with many extensions, before:
And after:
Extension-only app, before:
And after:
App with many errors, before:
And after:
How to test your changes?
Run
shopify app info
on various apps.Measuring impact
How do we know this change was effective? Please choose one:
Checklist