Skip to content

Commit

Permalink
Use logger instead of custom info and error tag funcs
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Wang committed Jul 22, 2024
1 parent ab389a8 commit 249c664
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 39 deletions.
6 changes: 2 additions & 4 deletions packages/cli/lib/sandboxSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const {
uiAccountDescription,
uiLine,
uiLink,
uiInfoTag,
uiCommandDisabledBanner,
} = require('./ui');
const { isDevelopmentSandbox } = require('./accountTypes');
Expand Down Expand Up @@ -173,7 +172,7 @@ const syncSandbox = async ({
if (!slimInfoMessage) {
logger.log();
uiLine();
uiInfoTag(
logger.info(
i18n(
`${i18nKey}.info.${isDevSandbox ? 'syncMessageDevSb' : 'syncMessage'}`,
{
Expand All @@ -182,8 +181,7 @@ const syncSandbox = async ({
syncStatusUrl
),
}
),
true
)
);
uiLine();
logger.log();
Expand Down
36 changes: 1 addition & 35 deletions packages/cli/lib/ui/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,23 +139,6 @@ const uiBetaTag = (message, log = true) => {
}
};

const uiInfoTag = (message, log = true) => {
const i18nKey = 'lib.ui';

const terminalUISupport = getTerminalUISupport();
const tag = i18n(`${i18nKey}.infoTag`);

const result = `${
terminalUISupport.color ? chalk.cyan(tag) : tag
} ${message}`;

if (log) {
logger.log(result);
} else {
return result;
}
};

const uiDeprecatedTag = (message, log = true) => {
const i18nKey = 'lib.ui';

Expand All @@ -173,21 +156,6 @@ const uiDeprecatedTag = (message, log = true) => {
}
};

const uiErrorTag = (message, log = true) => {
const i18nKey = 'lib.ui';

const terminalUISupport = getTerminalUISupport();
const tag = i18n(`${i18nKey}.errorTag`);

const result = `${terminalUISupport.color ? chalk.red(tag) : tag} ${message}`;

if (log) {
logger.log(result);
} else {
return result;
}
};

const uiCommandDisabledBanner = (
command,
url = undefined,
Expand All @@ -205,7 +173,7 @@ const uiCommandDisabledBanner = (

logger.log();
uiLine();
uiErrorTag(tag, true);
logger.error(tag);
uiLine();
logger.log();
};
Expand Down Expand Up @@ -246,9 +214,7 @@ module.exports = {
uiAccountDescription,
uiCommandReference,
uiBetaTag,
uiInfoTag,
uiDeprecatedTag,
uiErrorTag,
uiFeatureHighlight,
uiInfoSection,
uiLine,
Expand Down

0 comments on commit 249c664

Please sign in to comment.