Skip to content

Commit

Permalink
fix(button): удален вызов console.warn, если process.env.NODE_ENV !==…
Browse files Browse the repository at this point in the history
… 'development'
  • Loading branch information
dmitrsavk committed Dec 13, 2021
1 parent dc4763e commit d3e14ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/button/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ export type ButtonProps = Partial<AnchorButtonProps | NativeButtonProps>;
export const LOADER_MIN_DISPLAY_INTERVAL = 500;

const logWarning = (view: Required<ComponentProps>['view']) => {
if (process.env.NODE_ENV !== 'development') {
return;
}

const viewsMap: { [key: string]: string } = {
filled: 'secondary',
transparent: 'secondary',
Expand All @@ -114,7 +118,7 @@ const logWarning = (view: Required<ComponentProps>['view']) => {
// eslint-disable-next-line prefer-template
`@alfalab/core-components/button: view='${view}' будет удален в следующих мажорных версиях. ` +
`Используйте view='${viewsMap[view]}'. Чтобы поменять все кнопки на проекте разом, можно воспользоваться codemod: ` +
'npx core-components-codemod --components=ButtonViews src/**/*.tsx',
'npx core-components-codemod --transformers=button-views src/**/*.tsx',
);
};

Expand Down

0 comments on commit d3e14ce

Please sign in to comment.