From 473a3801d0f6b9b7dccd2430ff57e21fd3d12315 Mon Sep 17 00:00:00 2001 From: Hung Viet Nguyen Date: Sat, 11 Jun 2022 15:38:59 +0700 Subject: [PATCH] chore Polish deprecation message --- src/configure.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/configure.ts b/src/configure.ts index 4fc85466..66019ab8 100644 --- a/src/configure.ts +++ b/src/configure.ts @@ -1,7 +1,7 @@ import path from 'path'; import fs from 'fs'; import { exec } from 'child_process'; - +import chalk from 'chalk'; import { CACHE_FOLDER, SASS_LOAD_PATHS_CONFIG } from './constants'; import { createCacheFolderIfNeeded } from './utils'; import { debug } from './preview'; @@ -53,16 +53,14 @@ export async function jestPreviewConfigure( } externalCss?.forEach((cssFile) => { - // TODO: To add a yellow warning here - // `chalk` is installed in https://github.com/nvh95/jest-preview/pull/129, so we can merge that PR first - // Link to migration guide (haven't written yet) - // https://github.com/nvh95/jest-preview/issues/124 // Avoid name collision // Example: src/common/styles.css => cache-src___common___styles.css console.log( - 'externalCss is deprecated. Please import css files directly in your setup file.', + chalk.yellow( + 'externalCss is deprecated. Please import css files directly in your setup file.', + 'See the migration guide at www.jest-preview.com/blog/deprecate-externalCss', + ), ); - console.log('See the instruction to migrate here: TODO'); const delimiter = '___'; const destinationBasename = `cache-${cssFile.replace(/\//g, delimiter)}`; const destinationFile = path.join(CACHE_FOLDER, destinationBasename);