-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Addon Test: Improve messages and post install script handling #29036
Merged
Merged
Changes from 5 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
eb881e5
wip
yannbf 9bd038f
wip: Better logging
ghengeveld 8c97afa
Many improvements
ghengeveld 253623a
Merge branch 'next' into cli/improve-sb-add-messages
ghengeveld 7ca2804
Bail on auto config when a vitest workspace file exists or a vite con…
ghengeveld 22d1814
Consistently use absolute paths
ghengeveld c38d961
CONSTANT_CASE for constants
ghengeveld 07843b6
Consistently naming the 'Storybook Test' addon
ghengeveld 493a917
additional fixes
yannbf 581e008
add helpful links
yannbf da69836
Merge branch 'next' into cli/improve-sb-add-messages
yannbf 2b2a83f
add explanation in sb add command
yannbf 7d2e30b
review improvements
yannbf f1d1896
Merge branch 'next' into cli/improve-sb-add-messages
yannbf b6b6c24
use named import from dedent
yannbf 30d951f
only install the necessary dependencies
yannbf bd0942c
final fixes
yannbf 8170e25
only append addon to main.js if not already added
yannbf File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ | |
"targets": { | ||
"build": {} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { colors, logger } from 'storybook/internal/node-logger'; | ||
|
||
import boxen, { type Options } from 'boxen'; | ||
|
||
const fancy = | ||
process.platform !== 'win32' || process.env.CI || process.env.TERM === 'xterm-256color'; | ||
|
||
export const step = colors.gray('›'); | ||
export const info = colors.blue(fancy ? 'ℹ' : 'i'); | ||
export const success = colors.green(fancy ? '✔' : '√'); | ||
export const warning = colors.orange(fancy ? '⚠' : '‼'); | ||
export const error = colors.red(fancy ? '✖' : '×'); | ||
|
||
const baseOptions: Options = { | ||
borderStyle: 'round', | ||
padding: 1, | ||
}; | ||
|
||
export const print = (message: string, options: Options) => { | ||
logger.line(1); | ||
logger.plain(boxen(message, { ...baseOptions, ...options })); | ||
}; | ||
|
||
export const printInfo = (title: string, message: string, options?: Options) => | ||
print(message, { borderColor: 'blue', title, ...options }); | ||
|
||
export const printWarning = (title: string, message: string, options?: Options) => | ||
print(message, { borderColor: 'yellow', title, ...options }); | ||
|
||
export const printError = (title: string, message: string, options?: Options) => | ||
print(message, { borderColor: 'red', title, ...options }); | ||
|
||
export const printSuccess = (title: string, message: string, options?: Options) => | ||
print(message, { borderColor: 'green', title, ...options }); | ||
Comment on lines
+24
to
+34
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. style: These functions are very similar. Consider using a single function with an enum parameter for the message type to reduce code duplication |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
style: Consider using a more descriptive variable name than 'fancy', such as 'useFancyCharacters' or 'useUnicodeSymbols'