From 6b0d646d85e97502f158c8137e09df8265ef60e6 Mon Sep 17 00:00:00 2001 From: johnkenny54 <45182853+johnkenny54@users.noreply.github.com> Date: Thu, 3 Oct 2024 07:29:06 -0700 Subject: [PATCH] Add deprecation warnings. (#31) --- lib/svgo/coa.js | 9 +++++++-- plugins/moveGroupAttrsToElems.js | 8 ++++++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/svgo/coa.js b/lib/svgo/coa.js index 8ee83a3..3e288b6 100644 --- a/lib/svgo/coa.js +++ b/lib/svgo/coa.js @@ -109,7 +109,7 @@ export default function makeProgram(program) { .option('--no-color', 'Output plain text without color') .option( '-p, --precision ', - 'Set number of digits in the fractional part, overrides plugins params', + 'DEPRECATED. Set number of digits in the fractional part, overrides plugins params', ) .action(action); } @@ -240,7 +240,12 @@ async function action(args, opts, command) { } if (opts.multipass) { console.warn( - 'The --multipass option is deprecated. Use --max-passes instead.', + 'The --multipass option is deprecated and will be removed in a future release. Use --max-passes instead.', + ); + } + if (opts.precision) { + console.warn( + 'The --precision option is deprecated and will be removed in a future release.', ); } diff --git a/plugins/moveGroupAttrsToElems.js b/plugins/moveGroupAttrsToElems.js index 7b5457e..ef1b141 100644 --- a/plugins/moveGroupAttrsToElems.js +++ b/plugins/moveGroupAttrsToElems.js @@ -7,6 +7,8 @@ export const description = const pathElemsWithGroupsAndText = [...pathElems, 'g', 'text']; +let deprecationWarning = true; + /** * Move group attrs to the content elements. * @@ -26,6 +28,12 @@ const pathElemsWithGroupsAndText = [...pathElems, 'g', 'text']; * @type {import('./plugins-types.js').Plugin<'moveGroupAttrsToElems'>} */ export const fn = () => { + if (deprecationWarning) { + console.warn( + 'The moveGroupAttrsToElems plugin is deprecated and will be removed in a future release.', + ); + deprecationWarning = false; + } return { element: { enter: (node) => {