Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/next' into valentin/propagate-er…
Browse files Browse the repository at this point in the history
…ror-in-testing
  • Loading branch information
valentinpalkovic committed Sep 5, 2024
2 parents 67f91ec + f34c897 commit 6109294
Show file tree
Hide file tree
Showing 8 changed files with 412 additions and 113 deletions.
3 changes: 3 additions & 0 deletions code/addons/test/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@
"@storybook/csf": "^0.1.11"
},
"devDependencies": {
"@types/semver": "^7",
"@vitest/browser": "^2.0.0",
"boxen": "^8.0.1",
"find-up": "^7.0.0",
"semver": "^7.6.3",
"tinyrainbow": "^1.2.0",
"ts-dedent": "^2.2.0",
"vitest": "^2.0.0"
Expand Down
2 changes: 1 addition & 1 deletion code/addons/test/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"targets": {
"build": {}
}
}
}
34 changes: 34 additions & 0 deletions code/addons/test/src/postinstall-logger.ts
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 });
Loading

0 comments on commit 6109294

Please sign in to comment.